Posted by
Michael Schmid on
Apr 12, 2017; 2:15pm
URL: http://imagej.273.s1.nabble.com/Macro-recorded-in-image-to-stack-tp5018521p5018522.html
Hi Adrián,
you ave two possibilities for analyzing many images:
(1) Process>Batch>Macro:
Paste your macro there and select the folder of the input files.
If you have many images, make sure that your macro closes all files
including the original one; otherwise you will end up with a large
number of open images; too many open windows can even crash ImageJ under
some operating systems.
To do this, you can add
run("Close All");
at the end of the macro.
(2) Have all images in a stack (as you suggested); in this case "Split
Channels" will also create stacks. For further commands to process the
whole stack, not only the current slice, add 'stack to the second
argument of the 'run' commands, e.g.
run("Gaussian Blur...", "sigma=5 stack");
run("Analyze Particles...", "size=400-Infinity exclude clear
summarize stack");
'run' commands that do not have a second argument will usually process
the full stack if you add a second "stack" argument, e.g.
run("Convert to Mask", "stack");
Michael
________________________________________________________________
On 12/04/2017 15:23, Adrián Villalba wrote:
> Dear all,
>
> I have recorded a macro that works fine for single images but when i do
> File > Impor sequence and I apply the macro to the stack it gives me
> different values than the recorded one used for each single image.
>
> Do you know how can i modify the macro to use it for each image in a stack?
> The main reason i want to use the macro in a stack is only to avoid running
> the macro individually for each image rather than run the macro one for all
> the different images i have.
>
> If it helps, this is the macro:
>
> title = getTitle();
> run("Split Channels");
> selectWindow(title+" (blue)");
> close();
> selectWindow(title+" (red)");
> close();
> selectWindow(title+" (green)");
> // process the green channel;
> run("Gaussian Blur...", "sigma=5");
>
>
> setThreshold(40, 255);
>
> setOption("BlackBackground", false);
>
>
> run("Convert to Mask");
>
> run("Erode");
> run("Analyze Particles...", "size=400-Infinity show=[Overlay Masks] display
> exclude clear summarize in_situ");
>
>
>
> Thank you in advance,
>
>
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html