简体   繁体   English

如何禁用ImageJ中的对话框?

[英]How can I disable a dialog in ImageJ?

I'm using ImageJ a lot to look at image stacks composed of a number of single images sitting in one folder. 我经常使用ImageJ来查看由一个文件夹中的许多单个图像组成的图像堆栈。 I can just drag and drop the respective folder into the ImageJ GUI and it creates a scrollable visualization, which is very convenient. 我可以将相应的文件夹拖放到ImageJ GUI中,然后创建可滚动的可视化效果,这非常方便。 It could be even more convenient though since each time I do it, a dialog appears asking whether I want to open all images in the folder as a stack. 自从每次执行此操作以来,它可能会更加方便,但会出现一个对话框,询问我是否要以堆栈形式打开文件夹中的所有图像。 Is it possible to make it default to "Yes"? 是否可以将其默认设置为“是”? Would I need to change the source code and compile it myself..? 我需要更改源代码并自己编译..吗? If that is the case, where could I start looking? 如果是这样,我可以从哪里开始寻找?

A suggestion would be to make a feature request to the author of Imagej Wayne rasband, eg, at the Github repository: 建议例如在Github存储库中向Imagej Wayne rasband的作者提出功能请求:

https://github.com/imagej/imagej1 https://github.com/imagej/imagej1

Or you can write a small macro (use the macro recorder with the menu actions!) which can be also be installed in ImageJ. 或者,您可以编写一个小的宏(使用带有菜单操作的宏记录器!),也可以将其安装在ImageJ中。 Something like: 就像是:

run("Image Sequence...", "open=C:\\images\\ sort");

Here the macro docs: 这里是宏文档:

https://imagej.nih.gov/ij/developer/macro/macros.html https://imagej.nih.gov/ij/developer/macro/macros.html

https://imagej.nih.gov/ij/docs/guide/146-14.html https://imagej.nih.gov/ij/docs/guide/146-14.html

To disable the dialog in the source code: Find the source file ij>plugin>DragAndDrop.java . 要在源代码中禁用对话框:找到源文件ij>plugin>DragAndDrop.java From its openDirectory method, delete the dialog-related lines and assign boolean values to convertToRGB and virtualStack , both of which are normally defined by check boxes in the now defunct dialog window. 从其openDirectory方法中,删除与对话框相关的行,并将布尔值分配给convertToRGBvirtualStack ,这两个值通常由现已失效的对话框窗口中的复选框定义。 The code should now look like this: 现在,代码应如下所示:

    private void openDirectory(File f, String path) {
        if (path==null) return;
        if (!(path.endsWith(File.separator)||path.endsWith("/")))
            path += File.separator;
        String[] names = f.list();
        names = (new FolderOpener()).trimFileList(names);
        if (names==null)
            return;
        convertToRGB = false;
        virtualStack = false;
        String options  = " sort";
        if (convertToRGB) options += " convert_to_rgb";
        if (virtualStack) options += " use";
        IJ.run("Image Sequence...", "open=[" + path + "]"+options);
        DirectoryChooser.setDefaultDirectory(path);
        IJ.register(DragAndDrop.class);
    }

I did this with ImageJ 1.51p. 我是用ImageJ 1.51p完成的。 The source code can be downloaded here . 可以在此处下载源代码。 After making these changes, just run the build.xml ant script. 进行这些更改之后,只需运行build.xml ant脚本。

Note that writing a macro might provide a cleaner and more portable way to achieve this--refer to Marcel's answer for further reading. 请注意,编写宏可能会提供一种更简洁,更可移植的方式来实现此目的-请参阅Marcel的答案以进一步阅读。

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

相关问题 如何在Eclipse中将ImageJ添加到构建路径中,以及在哪里可以找到ImageJ .jar文件? - How can I add ImageJ to my build path in Eclipse, and where can I find the ImageJ .jar file? 如何将ImageJ用作单独Java应用程序的库? - How can I use ImageJ as a library for a separate Java application? 如何在Java或clojure中使用ImageJ进行批量图像处理? - How can I do batch image processing with ImageJ in Java or clojure? 如何在Java代码中实现ImageJ API? - How can I implement ImageJ API in my Java code? Java:如何在显示对话框时禁用单击面板? - Java: How can I disable clicking on a panel while showing dialog? ImageJ 如何在图像上写字符串? - ImageJ how do I write strings on an image? ImageJ,Java:如何将红色像素所包围的像素设置为红色(避免出现孔) - ImageJ, Java: How can I set Pixels red which are sourounded by red Pixels (avoid holes) 如何阻止ImageJ的非局部均值去噪算法使图像的所有边缘变为橙色? - How can I stop ImageJ's Non-Local Means denoising algorithm from making all the edges in an image orange? ImageJ JavaScript,如何循环浏览目录? - ImageJ JavaScript, how do I cycle through directories? 如何使用ImageJ中的线程打开文件夹? (JAVA) - How would I open a folder using threads in ImageJ? (Java)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM