Login  Register

pixel measurment

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

pixel measurment

Reena Prity Murmu
8 posts
Hi,
I want to compare differences in pixel proportions between 2 images.  
Can anyone tell me how to do that? how to measure pixels in a given  
image?
many thanks

Best
Reena
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: pixel measurment

ashamim
28 posts
what do need to measure about the pixels ? their intensity ?

Look the ImageProcessor Class. getPixelValue(x,y) gives the value of Pixel at any point x and y

Regards
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: pixel measurment

Reena Prity Murmu
8 posts
hi Ahsan,
I want to determine motility index for microglia imaged at 2 imaging  
sessions by determining the proportions of the pixels that differed  
between the two images. So, I guess I may have to measure pixel  
number. Is that right?
many thanks
Best
Reena



On Aug 22, 2011, at 4:12 PM, ashamim wrote:



> what do need to measure about the pixels ? their intensity ?
>
> Look the ImageProcessor Class. getPixelValue(x,y) gives the value of  
> Pixel
> at any point x and y
>
> Regards
>
>
> -----
> Ahsan
> --
> View this message in context: http://imagej.588099.n2.nabble.com/pixel-measurment-tp6711702p6711718.html
> Sent from the ImageJ mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: pixel measurment

ashamim
28 posts
Reena

I am sorry i am not familiar with the term motility index. there are many plugins for calculating the difference between two images. But incase if you need to calculate the number of pixels that differed the following lines of code would work

for example for a grayscale image

int countpixels()
        {
   int temp = 0;
   ImageProcessor ip1 = image1.getProcessor();
   ImageProcessor ip2 = image2.getProcessor();
   Rectangle r = ip1.getRoi(); // assuming that both images are of same size
   
   for(int x = r.x; x<r.x+r.width;x++)
        for(int y  = r.y ; y<r.y+r.height; y++)
          {
          if(Double.compare(ip1.getPixelValue(x,y),ip2.getPixelValue(x,y)) ! = 0)
          temp++
          }
         
          return temp;
        }

Regards


Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: pixel measurment

ashamim
28 posts
But i believe this should not be the case. as the code i just wrote would give out total number of pixels that varied if there is any misplacement in the image or something like that.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: pixel measurment

Reena Prity Murmu
8 posts
Hi Ahsan,
What u suggested could actually work for me.   I would really  
appreciate your opinion on this.  I will describe here briefly the  
motility index thing that I want to measure. I have taken Z stacks of  
microglia (immune cell) at 5, 10, 15, 20 mins. I want to determine if  
there's any difference at 5, 10, 15 or 20  minutes in the motility  
(movement) of these cells. I read in an article that microglia  
motility was determined (at 2 given time point) as the proportion of  
pixels that differed between 2 images. Could u please tell me how to  
do this? Get total pixel values, compare pixels of 2 images  etc.etc.  
Will I find this in ImageProcessor? is that a plugin?
Many thanks for ur help
Best regards
Reena



On Aug 22, 2011, at 4:49 PM, ashamim wrote:

> But i believe this should not be the case. as the code i just wrote  
> would
> give out total number of pixels that varied if there is any  
> misplacement in
> the image or something like that.
>
> -----
> Ahsan
> --
> View this message in context: http://imagej.588099.n2.nabble.com/pixel-measurment-tp6711702p6711863.html
> Sent from the ImageJ mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: pixel measurment

Olivier Burri
149 posts
> I want to compare differences in pixel proportions between 2 images.
> Can anyone tell me how to do that? how to measure pixels in a given
> image?


Dear Reena,

Depending on your image and its acquisitions, you're always going to have pretty much the whole picture changed in some minor way (Every noisy pixel will give a count or an intensity change in the background will make the whole background be counted). From what I can gather the simplest thing you can do is to subtract the two images using image calculator, making sure the result is 32-bit.

Subtracting an image at T=0 min to an image at T=20 min yields an image with the following properties:
Brighter regions represent areas where microglial processes appeared, darker regions where they disappeared and gray regions where nothing changed.

You can also threshold your images first.
That way,  when you compare pixel values you either have a pixel that belongs to the cell or one that belongs to the background. If you then perform a XOR (Exclusive OR operation) you recover only the pixels that have changed.

You then probably need to normalize those pixels with respect to the cell's areas, but I haven't got the article in front of me.

 There are other really fancy methods to do it:
http://bioinformatics.oxfordjournals.org/content/27/4/564


I left you a sample of what I'm talking about (for the thresholding here:
https://documents.epfl.ch/users/o/ob/oburri/public/XOR%20example.ijm
Just run this macro in ImageJ/Fiji and look at the results. Feel free to use it as a backbone if it's useful.

Good luck!

Oli

Olivier Burri
Engineer, Development in Image Processing
BioImaging and Optics platform (PTBIOP)