質問

I need to write a macro in Fiji. First I record a macro to do what I wanted. The result was the following:

run("Size...", "width=512 height=512 depth=497 average interpolation=None");
run("Rotate 90 Degrees Right");
run("Flip Horizontally", "stack");
run("Make Substack...", "  slices=5-300");
run("isolum_cbs_strict");
run("Z Code Stack", "depth=Current");
run("Z Project...", "start=1 stop=296 projection=[Standard Deviation]");

I would like to do it in a batch mode. So I write a macro myself:

file = getArgument;
if (file=="") exit ("No argument!");
setBatchMode(true);
file_vasc = file;
open(file_vasc);
run("Size...", "width=512 height=512 depth=497 average interpolation=None");
run("Rotate 90 Degrees Right");
run("Flip Horizontally", "stack");
run("Make Substack...", "  slices=5-200");
run("isolum_cbs_strict"); 
run("Z Code Stack", "depth=Current");
run("Z Project...", "start=1 stop=196 projection=[Max Intensity]");
file_vasc_out = replace(file, "\\_pvar-8bit_combined.tif", "_maxZprojection.tif");
saveAs("Tiff", file_vasc);

However I got macro errors as undefined variable for run("isolum_cbs_strict") and a unrecognized command for run("Z Code Stack", "depth=Current"). How can I access to this lut which is in:

C:\Program Files\Fiji.app\luts\isolum_cbs.lut

and to the plugin which is in:

C:\Program Files\Fiji.app\plugins\Stacks - Z-functions

Thanks for your help,

Corinne

役に立ちましたか?

解決

A solution is to provide -ijpathpath as argument to Fiji. Then, luts, plugins, etc. are all derived relatively to this path. In other words, pass the following argument:

-ijpathpath "C:\Program Files\Fiji.app"

Note that, importantly, you must not have a backslash at the end of the path.

他のヒント

Instead of using the java runtime to start Fiji/ImageJ, use the provided launcher execuable to run your macro:

fiji-win64.exe D:\your_macro.ijm D:\your_image.tif

or (which is essentially the same):

ImageJ-win64.exe D:\your_macro.ijm D:\your_image.tif

The ImageJ launcher takes care to provide all the necessary environment to run macros and scripts from the command line. It even provides a --headless option to run your script without even showing the user interface. See Fiji's Headless documentation.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top