Macro Trouble with Mean Centering and Normalization

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Macro Trouble with Mean Centering and Normalization

Christopher Davis
Hi,

I am very new to ImageJ, macros and programing in general, so any help is
greatly appreciated to what is probably an obvious problem/solution.

I have sets of images taken with different imaging modalities and I would
like to know that the change I am seeing is not due to just different light
intensities or exposure times, etc...( I don't have a lot of information on
the images - a blinded training set).

To "even out" the images I've written this macro:

//convert to 8 bit image, then covert to 32 but floating point

run("8-bit");
run("32-bit");

// find the mean and stdDev from the results table
run("Measure");

//mean center image based on mean value from results table

run("Subtract...", "*value= getResultLabel(Mean)*");

//normalize image by getting stdDev value from results table

run("Divide...", *"value= getResultLabel(StdDev)*");
run("8-bit");


//run("Brightness/Contrast...");
run("Enhance Contrast", "saturated=0.35");
run("Apply LUT");
run("Close");


//clear results table before next image
run("Clear Results");

//end




* which throws this error *

run () fuction
Dialouge box title: "Subtract"
Key: "value: "
variable or variable name: ""


Can anyone help a newbie figure out how to fix this problem. What I want is
to input the mean and stddev for that specific image, not some generic
value. I don't really care if it comes from the results table, it is just
the only place I know to get it from.

Any help is greatly appreciated

-Chris

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Macro Trouble with Mean Centering and Normalization

Herbie-3
Christopher Davis,

you may try this:

getRawStatistics( nPixels, mean, min, max, std );
run( "Subtract...", "value=[mean]" );
run( "Divide...", "value=[std]" );

HTH

Herbie

:::::::::::::::::::::::::::::::::::::::::::
On 09.12.13 11:03, Christopher Davis wrote:

> Hi,
>
> I am very new to ImageJ, macros and programing in general, so any help is
> greatly appreciated to what is probably an obvious problem/solution.
>
> I have sets of images taken with different imaging modalities and I would
> like to know that the change I am seeing is not due to just different light
> intensities or exposure times, etc...( I don't have a lot of information on
> the images - a blinded training set).
>
> To "even out" the images I've written this macro:
>
> //convert to 8 bit image, then covert to 32 but floating point
>
> run("8-bit");
> run("32-bit");
>
> // find the mean and stdDev from the results table
> run("Measure");
>
> //mean center image based on mean value from results table
>
> run("Subtract...", "*value= getResultLabel(Mean)*");
>
> //normalize image by getting stdDev value from results table
>
> run("Divide...", *"value= getResultLabel(StdDev)*");
> run("8-bit");
>
>
> //run("Brightness/Contrast...");
> run("Enhance Contrast", "saturated=0.35");
> run("Apply LUT");
> run("Close");
>
>
> //clear results table before next image
> run("Clear Results");
>
> //end
>
>
>
>
> * which throws this error *
>
> run () fuction
> Dialouge box title: "Subtract"
> Key: "value: "
> variable or variable name: ""
>
>
> Can anyone help a newbie figure out how to fix this problem. What I want is
> to input the mean and stddev for that specific image, not some generic
> value. I don't really care if it comes from the results table, it is just
> the only place I know to get it from.
>
> Any help is greatly appreciated
>
> -Chris
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html