开发者

ImageJ jar file plugin shortcut creation

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 i开发者_如何学Cgnorant 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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜