On Wed, February 19, 2014 20:10, Neil Fazel wrote:
> Hi Michael,
>
> Thanks so much for the response. I read it carefully but I'm still not
> clear when you say "the pixel at coordinates (0,0) is encompassed by
> the contour with the (x,y) values of (0,0), (1,0), (1,1), (0,1)." Maybe
> I don't understand the difference between pixel coordinates and
> selection coordinates. (I tried to look it up in the macro guide but it
> doesn't seem to explain this clearly.)
>
> I understand from your reply that when a contour is drawn for a given
> contour level, it (usually) passes between pixels having value above and
> below that value. Now what I would like to do is to get the value of those
> pixels; is getPixels(x,y) applied to (x,y) returned by
> getSelectionCoordinates() not the way to do it?
Hi Neil,
it is unclear to me which pixel values you want.
I'll try with ascii graphics; pixels are denoted by their x&y coordinates.
Then I can draw the top-left corner of the image like this:
00 01 02 03
10 11 12 13
20 21 22 23
Now, if you select, say, pixel '11', i.e, a rectangle around the pixel
with x=1, y=1. According to the definition of pixels in ImageJ, this
rectangle has its upper-left border at (1,1), and width=1, height=1, so
getSelectionCoordinates() will give you (1,1), (1,2), (2,2), (2,1).
The lines of this rectangle are actually *between* the pixels, because the
rectangle encompasses pixel '11'. Also the vertices (corners) that define
the rectangle are *between* the pixels.
Now, what do you define as the pixel value at a position between two pixels?
For me, the most obvious option would be interpolating between the pixels
neighboring each vertex.
So I would defint the pixel values at the vertices as getPixel(0.5, 0.5),
getPixel(0.5, 1.5), getPixel(1.5, 1.5), and getPixel(1.5, 0.5). That is,
subtract 0.5 from the x and y coodinates that you get from
getSelectionCoordinates().
Michael
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html