Re: PointInRoi function?
Posted by
jmutterer on
Dec 13, 2007; 9:26am
URL: http://imagej.273.s1.nabble.com/PointInRoi-function-tp3697771p3697773.html
In a macro, you could use this custom function :
function pointInRoi(ax,ay) {
run("Create Mask");
v=getPixel(ax,ay);
if (v!=0) {in=true;}
else {in=false;}
close();
return in;}
On Dec 13, 2007 10:06 AM, Gabriel Landini <
[hidden email]> wrote:
> On Thursday 13 December 2007 01:58:06 Koala wrote:
> > I would like to test if a specific pixel lies within a non-regular
> shaped
> > ROI (area as defined by a freehand or wand tool).
>
> Search in the source for a ROI method called contains(x, y) which returns
> false or true depending if the pixel is in the ROI.
>
> Alternatively, in a macro, you can use morphology which is slow for 1
> pixel
> but you can process an entire image in parallel if you want to process
> many
> pixels:
>
> Set an image with the test pixel(s) to 255 (background is black)
> Set another image with your ROIs filled
> Next, do an AND operation of the 2 images. The result is the pixels that
> are
> contained in the ROI(s).
>
> Cheers,
>
> G.
>