[英]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
方法中,删除与对话框相关的行,并将布尔值分配给convertToRGB
和virtualStack
,这两个值通常由现已失效的对话框窗口中的复选框定义。 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.