Posted by
Harry Parker on
Sep 05, 2006; 8:19pm
URL: http://imagej.273.s1.nabble.com/ip-getPixel-returns-index-not-value-tp3701630p3701633.html
Hi Tony,
Your results indicate you are looking at an 8-bit Color, a.k.a. "pseudocolor" image. The pixel value IS 8, and the associated LUT value for 8 is (R,G,B) = (192, 192, 192). You can confirm this by selecting the menu Image->Type, and notice what type is checked.
Try this:
(1) Convert the image to "RGB Color" format. (Menu: Image->Type->RGB Color). This will convert all the 8 valued pixels into actual R,G & B values of 192, for example. The image will also be 3 times larger.
(2) Optionally, to save memory space and simplify the measurements, then convert the image to grey scale (Menu: Image->Type->8-bit).
NOW you have a real grayscale image, and the getPixelValue function works as you expect.
--
Harry Parker
Senior Systems Engineer
Dialog Imaging Systems, Inc.
----- Original Message ----
From: Tony Shepherd <
[hidden email]>
To:
[hidden email]
Sent: Monday, September 4, 2006 1:41:08 PM
Subject: ip.getPixel returns 'index' not 'value'
I'm using a greyscale image. When I place the mouse pointer over a
homogenous part of the image, the ImageJ toolbar tells me the following:
x=99, y=130, index=8, value=192,192,192.
In my program I use int greyvalue = ip.getPixelValue(x,y);
where x and y are defined inside the same algorithm.
For the same homogenous region as above (eg x=99, y=130) I expect to get
greyvalue = 192.
I get greyvalue = 8.
I suspect that I'm using a LUT without knowing it (or wanting it).
Is there a function that returns 'value' instead of 'index' (eg the value in
the red channel, since this is the same as the value in the green and blue
channels)