ImageJ jar file plugin shortcut creation

心不动则不痛 提交于 2019-12-25 04:44:31

问题


I have been working on a developmental biology project marking various nuclear markers along with a DAPI stain to determine percentage of marker expression. I have found that the ImageJ plugin ITCN (http://rsbweb.nih.gov/ij/plugins/itcn.html) works great for each marker when also using the CLAHE program. My problem is that I have around 6000 images to analyze and I would love to be able to automate the process. I have recorded a macro such as the following (which can itself be looped to individual image files) :

open("image");
run("8-bit");
run("CLAHE");
run("ITCN ");
close();

but the ITCN icon wont start analyzing automatically, nor is there an easily programmed short cut to do the job. I am completely ignorant to any Java programming and I would love to know if there is anyway to get around this likely easy problem.

Thanks in advance Michael


回答1:


The ITCN plugin is implemented as a PlugInFrame and its settings are not recordable, as you have discovered. However, looking at the source, it seems that the plugin just uses another class called ITCN_Runner once it has gathered the options, which you should be able to call programmatically.

However, you can't do this from the macro language. Probably the easiest alternative is to use ImageJ's built-in Javascript scripting. For example, start up the Macro Recorder as usual, but select "JavaScript" in the top left. Then the first couple of commands appear for me (with some reformatting for clarity) as:

imp = IJ.openImage("/home/mark/test.tif");
IJ.run(imp, "8-bit", "");
IJ.run(imp,
       "Enhance Local Contrast (CLAHE)",
       "blocksize=127 histogram=256 maximum=3 mask=*None* fast_(less_accurate)");

Then if you look at the source code of the ITCN plugin you can see how to create the ITCN_Runner class and run it - for example:

runner = new ITCN_Runner( imp,
                          1, /* width*/
                          5.0, /* minimum distance */
                          0, /* threshold */
                          false, /* detect dark peaks */
                          null /* mask ImagePlus */ )
runner.run()

That produces output in another window, which has the same name but with "Results " prefixed.




回答2:


Thanks Marc.

Unfortunately there is an error that results when I run the java scrip.

ReferenceError: "ITCN_Runner" is not defined. (#6) in at line number 6

It says there is an unknown source in the line of the ITCN runner. I can't tell if this is a problem with the code, the fact that I simply copied and pasted yours into the recorder without going into the source code to do so, or the ITCN runner itself.

Thanks again,

Michael



来源:https://stackoverflow.com/questions/4791072/imagej-jar-file-plugin-shortcut-creation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!