PointInRoi function?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

PointInRoi function?

axm2
Hi there,

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

I found this message which makes reference to a PointInRoi function, but I
could not find that function anywhere (not in the imageJ source code and not
in Google...)

https://list.nih.gov/cgi-bin/wa?A2=ind0102&L=IMAGEJ&P=R2832&I=-3

I followed some leads from the people appearing in that thread, but the
pages refering to Object-Image in Amsterdam are no longer active....

Where can I get that function
or does someone know an easy way to achieve this test?

Thanks a lot,
Art
Reply | Threaded
Open this post in threaded view
|

Re: PointInRoi function?

Gabriel Landini
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.
Reply | Threaded
Open this post in threaded view
|

Re: PointInRoi function?

jmutterer
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.
>
Reply | Threaded
Open this post in threaded view
|

Re: PointInRoi function?

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