Login  Register

Re: PointInRoi function?

Posted by axm2 on Dec 13, 2007; 9:56pm
URL: http://imagej.273.s1.nabble.com/PointInRoi-function-tp3697771p3697774.html

Thanks Ras, Gabriel and Jerome,

the brief reply by Ras was right in the bulls-eye and it is working nicely
:)

Thanks very much to everyone - I might use the macro tips at some other
occasion in the future.

Cheers,
Art

On 13/12/2007, Jerome Mutterer <[hidden email]> wrote:

>
> 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.
> >
>