Re: raw data from plot profiles

Posted by Wayne Rasband on
URL: http://imagej.273.s1.nabble.com/raw-data-from-plot-profiles-tp3703515p3703517.html

> Hello,
>   I am new to ImageJ. I would like to get some more simple
> stats (e.g standard dev) from the Plot Profile tool instead of
> only the average. Is there a way or plugin to have the standard
> deviation from each verticle  pixel array listed as well as the
> mean. I ultimately would like to plot  the mean as well as
> another line illustrating the mean+standard deviation.

Here is a profile plotting macro that displays the mean and standard  
deviation, and also draws horizontal lines representing the mean, the  
mean+standard deviation and the mean-standard deviation.

-wayne

   profile = getProfile();
   n = profile.length;
   setBatchMode(true);
   newImage("tmp", "32-bit", n, 1, 1);
   for (i=0; i<n; i++)
       setPixel(i, 0, profile[i]);
   getStatistics(area, mean, ymin, ymax, sd);
   close();
   setBatchMode(false);
   Plot.create("Profile Plot", "X", "Value", profile);
   if (bitDepth==8 || bitDepth==24)
       {ymin=0;ymax=255;}
   Plot.setLimits(0, n, ymin, ymax);
   x = newArray(0, n);
   y = newArray(mean, mean);
   Plot.add("line", x, y);
   y[0]=mean-sd;  y[1]=mean-sd;
   Plot.add("line", x, y);
   y[0]=mean+sd;  y[1]=mean+sd;
   Plot.add("line", x, y);
   Plot.addText("Mean="+mean+", S.D.="+sd, 0.01, 0.1);