Re: measuring intensities
Posted by Parker Seidel on Aug 09, 2005; 9:58pm
URL: http://imagej.273.s1.nabble.com/measuring-intensities-tp3705064p3705066.html
Richard,
What you want to do is pretty straight forward. I assume you want to
get the pixel value (intensity) at some x, y. I'm not sure if you're
more familiar with the Macro language or the Java API, but in either
case the solution is simple. To me, these are the simplest
demonstrations on how to do this.
Macro
for (x=0;x<getWidth(); x++)
{
for(y=0;y<getHeight(); y++)
{
Intensity = getPixel(x,y);
print(Intensity);
}
}
In Java as a plugin: (getPixelValue could also be used, but I don't
know how it differs from getPixel)
public void run(String arg) {
ImagePlus imp = WindowManager.getCurrentImage();
ImageProcessor ip = imp.getProcessor();
for (int x = 0; x < ip.getWidth(); x++)
{
for(int y = 0;y < ip.getHeight(); y++)
{
int Intensity = ip.getPixel(x,y);
IJ.log("" +Intensity); /* without the "", IJ.log doesn't convert
ints to Strings */
}
}
}
Parker Seidel