简体   繁体   English

getImage是否总是在imageJ中返回Image对象吗?

[英]Does getImage always return an Image object in imageJ

I have created an ImagePlus object using the construstor, ImagePlus(java.lang.String pathOrURL) 我已经使用委托人ImagePlus(java.lang.String pathOrURL)创建了一个ImagePlus对象。

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

now I want to get the Image object(java.awt.Image) by calling getImage method. 现在我想通过调用getImage方法来获取Image对象(java.awt.Image)。

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. 是否必须使用构造函数(ImagePlus(java.lang.String title, java.awt.Image img)) ,如果我希望使用getImage()方法,它将使用Image对象创建一个ImagePlus对象。

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. 从源文件http://imagej.nih.gov/ij/source/ij/ImagePlus.java来看,它应该可以工作。 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. 我建议您将源链接到您的代码,在imp = new ImagePlus(...)方法上设置断点,启动调试器并逐步进入该调用,以查看imageJ调用内部发生了什么。


声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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