Re: pixel measurment
Posted by ashamim on
URL: http://imagej.273.s1.nabble.com/pixel-measurment-tp3683348p3683351.html
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