Adding to the Roi Manager with a name

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

Adding to the Roi Manager with a name

Stein Rørvik
A suggestion for an improvement to the macro language:

roiManager("Add") adds the current ROI. To set a name for that, you need to retrieve the index and use the rename command.
It would be a lot simpler if the "Add" command just could have a second otional parameter "Name".

The code could then be

roiManager("Add", "MyRoiName");

instead of the current equivalent

roiManager("Add");
i = roiManager("count");
roiManager("select", i);
roiManager("rename", "MyRoiName");


Stein

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

Re: Adding to the Roi Manager with a name

Rasband, Wayne (NIH/NIMH) [E]
> On Mar 18, 2016, at 11:24 PM, Stein Rørvik <[hidden email]> wrote:
>
> A suggestion for an improvement to the macro language:
>
> roiManager("Add") adds the current ROI. To set a name for that, you need to retrieve the index and use the rename command.
> It would be a lot simpler if the "Add" command just could have a second otional parameter "Name".
>
> The code could then be
>
> roiManager("Add", "MyRoiName");
>
> instead of the current equivalent
>
> roiManager("Add");
> i = roiManager("count");
> roiManager("select", i);
> roiManager("rename", "MyRoiName”);

You can set the name of an ROI and add it to the ROI Manager with two lines of code:

  Roi.setName("MyRoiName");
  roiManager("Add");

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

Re: Adding to the Roi Manager with a name

Stein Rørvik
Ok, thanks!
This is short enough.

Stein

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Rasband, Wayne (NIH/NIMH) [E]
Sent: 19. mars 2016 05:21
To: [hidden email]
Subject: Re: Adding to the Roi Manager with a name

> On Mar 18, 2016, at 11:24 PM, Stein Rørvik <[hidden email]> wrote:
>
> A suggestion for an improvement to the macro language:
>
> roiManager("Add") adds the current ROI. To set a name for that, you need to retrieve the index and use the rename command.
> It would be a lot simpler if the "Add" command just could have a second otional parameter "Name".
>
> The code could then be
>
> roiManager("Add", "MyRoiName");
>
> instead of the current equivalent
>
> roiManager("Add");
> i = roiManager("count");
> roiManager("select", i);
> roiManager("rename", "MyRoiName");

You can set the name of an ROI and add it to the ROI Manager with two lines of code:

  Roi.setName("MyRoiName");
  roiManager("Add");

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

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