ImageJ打开imagePlus窗口作为desktopPane内部的框架 [英] ImageJ opening imagePlus window as an internal frame inside a desktopPane
问题描述
我在ImageJ中使用其中一个文件遇到了一些麻烦。基本上设置一个分析和打开图像的桌面窗格。但是当程序打开图像时,它会将其作为单独的JFrame打开。我想成为一个内部JFrame。所以基本上图像在桌面窗格中打开。我尝试了一些事情,比如创建一个内部框架类并将win添加到desktopPane但似乎没有任何工作,它仍然将它作为一个单独的JFrame打开。我想知道是否有人知道如何做到这一点。
I am having some trouble in ImageJ with one of its files. Basically set up a desktop pane that analyzes and opens images. But when the program opens the image it opens it as a separate JFrame. I would like to be an internal JFrame. So basically the image opens up in the desktop pane. I have tried a couple of things like creating a internal frame class and adding the win to the desktopPane but nothing seems to work it still opens it as a separate JFrame. I was wondering if anyone knows how to do this.
这是我的代码(这个函数只是调用.show()来显示图像,打开窗口的实际JFrame的代码在ImageWindow.java中) :
This is my code (this function is just calling .show() to display the image, the code for the actual JFrame that opens the window is in ImageWindow.java):
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
FileOpener open = new FileOpener(file);
ImagePlus fopen = open.open(false);
if(fopen != null){
BufferedImage openImage = fopen.getBufferedImage();
new ImagePlus(path,openImage).show(desktop); //This functions displays the image
ImagePlus newImage = new ImagePlus(path,openImage);
img = newImage;
}
frame.setVisible(false);
}
推荐答案
创作一个新的JFrame硬编码到ImageJ的 ImagePlus
class:
The creation of a new JFrame is hardcoded into ImageJ's ImagePlus
class:
if (stackSize>1)
win = new StackWindow(this);
else
win = new ImageWindow(this);
如果要调整GUI,可以扩展 ImageWindow
或 StackWindow
类。请参阅可训练的Weka分段插件的一个很好的例子。
If you want to adapt the GUI, you can extend the ImageWindow
or StackWindow
classes. See the Trainable Weka Segmentation plugin for a nice example.
或者,使用 ImageJ2 ,即 ImgLib 的 ImgPlus
。这些设计独立于任何用户界面。
Alternatively, use the data structures of ImageJ2, namely ImgLib's ImgPlus
. These are designed to be independent of any user interface.
这篇关于ImageJ打开imagePlus窗口作为desktopPane内部的框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!