How to check if the image has a selection

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

How to check if the image has a selection

Avital Steinberg
Hi,
After applying the Versatile Wand, I would like to add the selection that
was created to the ROI manager. Adding the selection to the ROI manager
only makes sense if there is a selection. What is the command in the ImageJ
macro language that checks if the image has a selection? I was searching
the ImageJ macro API, but I haven't found the answer.

Thanks,
Avital

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to check if the image has a selection

jmutterer
Hi,
getSelectionType() is what you are looking for.
Sincerely,
Jerome.
Le 7 oct. 2015 07:11, "Avital Steinberg" <[hidden email]> a
écrit :

> Hi,
> After applying the Versatile Wand, I would like to add the selection that
> was created to the ROI manager. Adding the selection to the ROI manager
> only makes sense if there is a selection. What is the command in the ImageJ
> macro language that checks if the image has a selection? I was searching
> the ImageJ macro API, but I haven't found the answer.
>
> Thanks,
> Avital
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to check if the image has a selection

Avital Steinberg
Hi Jerome,
Thanks for your help!

Here is the code, in case some else searches and finds our discussion:

run("Versatile Wand", "value=70 color=-100 gradient=10
connectedness=4-connected x=996 y=486");
type = selectionType();
print("The selection type is: " + type);

// 0=rectangle, 1=oval, 2=polygon, 3=freehand, 4=traced, 5=straight line,
6=segmented line, 7=freehand line, 8=angle, 9=composite, 10=point, -1 if //
there's no selection.

Best regards,
Avital

On Wed, Oct 7, 2015 at 8:39 AM, Jerome Mutterer <[hidden email]>
wrote:

> Hi,
> getSelectionType() is what you are looking for.
> Sincerely,
> Jerome.
> Le 7 oct. 2015 07:11, "Avital Steinberg" <[hidden email]> a
> écrit :
>
> > Hi,
> > After applying the Versatile Wand, I would like to add the selection that
> > was created to the ROI manager. Adding the selection to the ROI manager
> > only makes sense if there is a selection. What is the command in the
> ImageJ
> > macro language that checks if the image has a selection? I was searching
> > the ImageJ macro API, but I haven't found the answer.
> >
> > Thanks,
> > Avital
> >
> > --
> > ImageJ mailing list: http://imagej.nih.gov/ij/list.html
> >
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html