Login  Register

Re: Problem with normalized variance for stack

Posted by Michael Schmid on Feb 01, 2013; 10:43am
URL: http://imagej.273.s1.nabble.com/Problem-with-normalized-variance-for-stack-tp5001625p5001633.html

Hi Sathya,

this macro writes where it finds the maximum of the normalized variance.
Anyhow, it might be a good idea if you could have a look into macro programming yourself; it's not difficult, and you will be able to solve such problems yourself...

macro "Normalized_Variance_for_Stack" {
 saveSettings();
 run("Clear Results");
 run("Set Measurements...", "  mean standard redirect=None decimal=5");
 max = -1;
 sliceOfMax = -1;
 for (slice=1; slice<=nSlices(); slice++) {
   setSlice(slice);
   run("Measure");
   mean = getResult("Mean", slice-1);
   stddev = getResult("StdDev", slice-1);
   normVar = stddev*stddev/mean;
   if (normVar > max) {
     max = normVar;
     sliceOfMax = slice;
   }
   setResult("NormVar", slice-1, normVar);
 }
 print("Maximum in slice "+sliceOfMax);
restoreSettings();
}


Michael
________________________________________________________________
On Jan 31, 2013, at 22:39, sathya1 wrote:

> Hi Michael
> Sorry to bother you again, but I'm having another problem. I'm finding it
> difficult to search for the highest value in the normalized variance column
> and report its index value. Can you help me out?
> Thanks!
>
>
>
> --
> View this message in context: http://imagej.1557.n6.nabble.com/Problem-with-normalized-variance-for-stack-tp5001625p5001630.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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