Posted by
Michael Schmid on
URL: http://imagej.273.s1.nabble.com/variance-of-pixel-values-tp5011278p5011296.html
On Jan 19, 2015, at 16:35, rabih assaf wrote:
> I want to calculate the variatons of many selected areas and put them in a new image correspondly to the selected areas. that's it.
Hi Rahib,
what you could try:
Take the 'Particle Properties to Image' macro at
http://imagejdocu.tudor.lu/doku.php?id=macro:Particle_Properties_to_Imageand add "StdDev" somewhere to the propertyNames array:
propertyNames = newArray("Area","Mean","StdDev","Min","Max","IntDen","RawIntDen");
Then create a mask with all the selected areas, i.e. an 8-bit image where all the areas that you are interested in are black (255), everything else is white (0). You get such a mask from a selection with e.g. from Edit>Selection>Create Mask.
[This assumes that 'Black Background' in Process>Binary>Options is deselected, i.e., off]
Then run the macro as shown on its web page, but select 'StdDev' as the 'Property that determines Pixel value'.
You will get an image with pixel value of the regions corresponding to the standard deviation of the pixels in each of the regions. Use Process>Math>Square to convert stddev to variance.
This only works if the regions don't ouch each other or overlap. For overlapping selections, you can get the data using the ROI Manager's More>Multi Measure, but I don't know a plugin or macro that would create an image from them.
Michael
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html