variance of pixel values

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

variance of pixel values

rabih assaf
Hello,
I need a way or a plugin that can calculate the variance of pixel values ( progressively) in an image.
Thanks in advance,Rabih    
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: variance of pixel values

Василий Попков
Hello
Why u cant get values for mean and sd and calculate variance urself? If I
have got your idea right


2015-01-19 17:12 GMT+03:00 rabih assaf <[hidden email]>:

> Hello,
> I need a way or a plugin that can calculate the variance of pixel values (
> progressively) in an image.
> Thanks in advance,Rabih
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: variance of pixel values

rabih assaf
thank you,
ok, but how i can calculqte the mean?and the sd?
thanks> Date: Mon, 19 Jan 2015 17:41:06 +0300

> From: [hidden email]
> Subject: Re: variance of pixel values
> To: [hidden email]
>
> Hello
> Why u cant get values for mean and sd and calculate variance urself? If I
> have got your idea right
>
>
> 2015-01-19 17:12 GMT+03:00 rabih assaf <[hidden email]>:
>
> > Hello,
> > I need a way or a plugin that can calculate the variance of pixel values (
> > progressively) in an image.
> > Thanks in advance,Rabih
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
     
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: variance of pixel values

Seth Pappas
In reply to this post by rabih assaf


This would be a job for the stacking function, as long as all your images are of the same scene.
There is an image 'pulling' batch utility (Raw File Opener) you can find in the IJ wesite that opens a series of images,.(it works for raw images).
Then stack them. Then "Z project' them, selecting Standard Deviation (Image/Stacks/...). You will get an image of standard deviation for each pixel 'through' the stack. Then, presumably, square that value to get the variance.



 

 

 

-----Original Message-----
From: Василий Поп
 ков <[hidden email]>
To: IMAGEJ <[hidden email]>
Sent: Mon, Jan 19, 2015 9:42 am
Subject: Re: variance of pixel values


Hello
Why u cant get values for mean and sd and calculate variance urself? If I
have got your idea right


2015-01-19 17:12 GMT+03:00 rabih assaf <[hidden email]>:

> Hello,
> I need a way or a plugin that can calculate the variance of pixel values (
> progressively) in an image.
> Thanks in advance,Rabih
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

 




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

Re: variance of pixel values

gankaku
In reply to this post by rabih assaf
Hi Rabih,

I might give you a completely useless answer, since I do not exactly know
what you are looking for. What do you mean with "progressively". I assume
you want the variance for the pixels in one image only.
So, here is a try of a potentially helpful answer...

If you are talking about the variance in a small neighborhood all over the
image fro each pixel position than you might want to try the following
command:
>Process >Filters >Variance.
If you are dealing with grayscale images I would therefore convert the
image in a 32-bit image, avoid any auto scaling or histogram normalization
to still work on the original intensity data and then run the variance
filter on it.

If you want to have one value for the variance of the complete image you
might really need to calculate that. Here's a macro which does this:

//----------------------------------------------- macro start
original = getTitle();
w = getWidth();
h = getHeight();
getRawStatistics(area, mean, min, max, std);

for(y=0; y<h; y++) {
for(x=0; x<w; x++) {

summedIntensitySquares = summedIntensitySquares + pow((getPixel(x,y) -
mean), 2);
}
}

variance = (1 / (w * h)) * summedIntensitySquares
RMSC = sqrt((1 / (w * h)) * summedIntensitySquares);

print("Var: " + variance);
print("SD: " + RMSC);

//----------------------------------------------- macro end

Kind regards,
Jan


2015-01-19 15:12 GMT+01:00 rabih assaf <[hidden email]>:

> Hello,
> I need a way or a plugin that can calculate the variance of pixel values (
> progressively) in an image.
> Thanks in advance,Rabih
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>



--

CEO: Dr. rer. nat. Jan Brocher
phone:  +49 (0)6234 917 03 39
mobile: +49 (0)176 705 746 81
e-mail: [hidden email]
info: [hidden email]
inquiries: [hidden email]
web: www.biovoxxel.de

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

Re: variance of pixel values

rabih assaf
In reply to this post by Seth Pappas
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.> Date: Mon, 19 Jan 2015 10:12:00 -0500

> From: [hidden email]
> Subject: Re: variance of pixel values
> To: [hidden email]
>
>
>
> This would be a job for the stacking function, as long as all your images are of the same scene.
> There is an image 'pulling' batch utility (Raw File Opener) you can find in the IJ wesite that opens a series of images,.(it works for raw images).
> Then stack them. Then "Z project' them, selecting Standard Deviation (Image/Stacks/...). You will get an image of standard deviation for each pixel 'through' the stack. Then, presumably, square that value to get the variance.
>
>
>
>  
>
>  
>
>  
>
> -----Original Message-----
> From: Василий Поп
>  ков <[hidden email]>
> To: IMAGEJ <[hidden email]>
> Sent: Mon, Jan 19, 2015 9:42 am
> Subject: Re: variance of pixel values
>
>
> Hello
> Why u cant get values for mean and sd and calculate variance urself? If I
> have got your idea right
>
>
> 2015-01-19 17:12 GMT+03:00 rabih assaf <[hidden email]>:
>
> > Hello,
> > I need a way or a plugin that can calculate the variance of pixel values (
> > progressively) in an image.
> > Thanks in advance,Rabih
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>  
>
>
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
     
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: variance of pixel values

gankaku
In reply to this post by rabih assaf
Dear Rabih,

see attached a modified macro to measure the variance in a selection (if
there is no selection it measures the variance of the complete image).

//-----------------------
original = getTitle();
//w = getWidth();
//h = getHeight();
getStatistics(area, mean);
getSelectionBounds(x, y, width, height);

for(v=0; v<height; v++) {
for(u=0; u<width; u++) {

summedIntensitySquares = summedIntensitySquares + pow((getPixel(u,v) -
mean), 2);
}
}

variance = (1 / (width * height)) * summedIntensitySquares
RMSC = sqrt((1 / (width * height)) * summedIntensitySquares);

print("Var: " + variance);
print("SD: " + RMSC);
//----------------------------

The variance filter calculates the variance in a limited area
(neighborhood). This neighborhood will be defined by the user using the
radius since the neighborhood is created as circular form to preserve
directional isotropy.
You can convert an image under >Image >Type >...

It might be helpful for you to have a look here:
http://rsb.info.nih.gov/ij/docs/guide/146.html

Regards,
Jan

--

CEO: Dr. rer. nat. Jan Brocher
phone:  +49 (0)6234 917 03 39
mobile: +49 (0)176 705 746 81
e-mail: [hidden email]
info: [hidden email]
inquiries: [hidden email]
web: www.biovoxxel.de

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

Re: variance of pixel values

Michael Schmid
In reply to this post by rabih assaf
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_Image
and 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