Login  Register

Re: HowTo check if pixel is into a ROI

Posted by Gabriel Landini on May 31, 2007; 11:53am
URL: http://imagej.273.s1.nabble.com/HowTo-check-if-pixel-is-into-a-ROI-tp3699268p3699269.html

On Thursday 31 May 2007 10:30:48 Andrea Tombesi wrote:
> I have written a short macro to calculate the surface of a solid in a stack
> of images (ad example acquired with confocal)
>
> I need to work also with ROI and i am looking (before write it
> myself) for a function that check (eg return true) if a pixel (x,y) is
> inside the ROI (also freehand roi)

You can test this in a plugin (there is a method contains(x,y) that you can
use with a ROI).

The slow, and lazy way to do it with a macro is to:
duplicate the image
threshold it (ie create a mask)
test the colour of the pixel of interest, if background it is outside,
otherwise it is inside.

Cheers,

G.