I am using imageJ to extend some functionality of a Swing application
I want to open an image with ImageJ using java, but i want to keep the same image window and not a new window per each image opened..
ImagePlus imp = IJ.openImage(imageFilepath)
imp.show()
also tried something like that but could not figure it out from the documentation..
ImagePlus imp
imp = IJ.openImage(imageFile.absolutePath)
if (imp) {
imp.setImage(imp)
}
imp.show()
Readin the doc you should do something like this:
class YourClass {
ImagePlus imp;
public void openImage( String imageFilepath ) {
if ( imp == null {
imp = IJ.openImage(imageFilepath);
}
else {
// Reuse
ImagePlus imp2 = IJ.openImage(imageFilepath);
imp.setImage(imp2)
}
imp.show();
}
}
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.