Add the 'normalize' keyword and the macro will work as expected.
for(slice = 1; slice < nSlices; slice++) {
setSlice(slice);
run("Enhance Contrast", "saturated=0.5 normalize");
}
-wayne
On Jan 16, 2007, at 12:34 PM, McAuley, Grant (LLU) wrote:
> Hello List,
>
> I am trying to write a macro that will automatically enhance the
> contrast for each image in the stack. The code below seems to apply
> the contrast window determined for the first image to all the
> following images in the stack.
>
> How can I enhance the contrast for each image individually in the
> stack? Is there a sample 'Stack' macro that shows how to process
> stack images individually?
>
> Here is my macro code:
>
> for(slice = 1; slice < nSlices(); slice++) {
> if (nSlices > 1) run("Set Slice...", "slice=" + slice);
> run("Enhance Contrast", "saturated=0.5");
> }
>