简体   繁体   中英

Does getImage always return an Image object in imageJ

I have created an ImagePlus object using the construstor, ImagePlus(java.lang.String pathOrURL)

imp=new ImagePlus(imgFile.getPath());

now I want to get the Image object(java.awt.Image) by calling getImage method.

img=imp.getImage();
jLabel2.setIcon(new ImageIcon(imgFile.getPath()));
jPanel3.validate();

but when i do that, i get nothing in return. Is it a must to use the constructor (ImagePlus(java.lang.String title, java.awt.Image img)) , which will create an ImagePlus object with an Image object, if i expect to use the getImage() method.

What do you mean with you get nothing in return? Null, an Exception or an empty image? Judging from the source file http://imagej.nih.gov/ij/source/ij/ImagePlus.java it should work. I'd advise you to link the sources to your code, set a breakpoint at the imp= new ImagePlus(...) method, start the debugger and step into the call to see what's happening inside the imageJ call.


The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM