Translate command in ROI Manager

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Translate command in ROI Manager

Cammer, Michael-2
We have a question regarding the Translate command within the ROI Manager.

Our goal is to select a single or group of ROIs in the manager and move them.  Is this what the translate command does?

We have tried selecting one ROI and translating it, but 1.) nothing happens and 2.) we don't see a macro command generated in the Recorder window.

Is this a bug with the command or are we using it incorrectly?  Any help appreciated.

We are using ImageJ 1.52t23, Java 1.8, Win10

Thank you!

Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory
NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY  10016
Office: 646-501-0567 Cell: 914-309-3270  [hidden email]<mailto:[hidden email]>
http://nyulmc.org/micros  http://microscopynotes.com/
Acknowledgement in your publications and presentations of work performed in the Microscopy Core plays a vital role in securing support and the funding necessary to maintain and operate this valuable research resource.   For publications that were made possible by work performed in the core, please use the acknowledgement statement "We thank the NYU Langone Microscopy Core for experimental and technical support" and include required grant numbers as listed here http://microscopynotes.com/ilabnyu/acknowledgements2017.pdf
Please also consider staff for co-authorship if they played a key role in the study.



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

Re: Translate command in ROI Manager

Michael Schmid-3
Hi Michael,

after the RoiManager's More>>translate, you have to select the roi again
(or deselect/select, if it was selected) to make it active in the image.

It seems that the macro command was forgotten in the documentation of
the macro language:

   roiManager("select",0);
   roiManager("translate",5,10); //translate the selected roi(s)
   roiManager("select",0);       //make it the roi active for the image

The Roi Manager's translate even accepts decimals (subpixel accuracy),
and interesting enough, it can even create rectangles with non-integer
positions. But they are not useful; for using as a selection their
coordinates are rounded down to an integer.

Michael
________________________________________________________________
On 09.01.20 19:41, Cammer, Michael wrote:

> We have a question regarding the Translate command within the ROI Manager.
>
> Our goal is to select a single or group of ROIs in the manager and move them.  Is this what the translate command does?
>
> We have tried selecting one ROI and translating it, but 1.) nothing happens and 2.) we don't see a macro command generated in the Recorder window.
>
> Is this a bug with the command or are we using it incorrectly?  Any help appreciated.
>
> We are using ImageJ 1.52t23, Java 1.8, Win10
>
> Thank you!
>

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

Re: Translate command in ROI Manager

Cammer, Michael-2
Thank you!

The colleague I was helping with macro programming got this to work perfectly.

Cheers-
Michael C.

-----Original Message-----
From: Michael Schmid <[hidden email]>
Sent: Thursday, January 9, 2020 2:11 PM
To: [hidden email]
Subject: Re: Translate command in ROI Manager

[EXTERNAL]

Hi Michael,

after the RoiManager's More>>translate, you have to select the roi again (or deselect/select, if it was selected) to make it active in the image.

It seems that the macro command was forgotten in the documentation of the macro language:

   roiManager("select",0);
   roiManager("translate",5,10); //translate the selected roi(s)
   roiManager("select",0);       //make it the roi active for the image

The Roi Manager's translate even accepts decimals (subpixel accuracy), and interesting enough, it can even create rectangles with non-integer positions. But they are not useful; for using as a selection their coordinates are rounded down to an integer.

Michael
________________________________________________________________
On 09.01.20 19:41, Cammer, Michael wrote:

> We have a question regarding the Translate command within the ROI Manager.
>
> Our goal is to select a single or group of ROIs in the manager and move them.  Is this what the translate command does?
>
> We have tried selecting one ROI and translating it, but 1.) nothing happens and 2.) we don't see a macro command generated in the Recorder window.
>
> Is this a bug with the command or are we using it incorrectly?  Any help appreciated.
>
> We are using ImageJ 1.52t23, Java 1.8, Win10
>
> Thank you!
>

--
ImageJ mailing list: https://urldefense.proofpoint.com/v2/url?u=http-3A__imagej.nih.gov_ij_list.html&d=DwICaQ&c=j5oPpO0eBH1iio48DtsedeElZfc04rx3ExJHeIIZuCs&r=E0xNnPAQpUbDiPlC50tp7rW2nBkvV7fujQf0RknE5bU&m=PjDxBNfIyaBr6AT6bmM63FEWuWkR2iPjN5hBWiogB9E&s=mZB5rEoLnC8Ul-O9eAXTYdQsZ2c6iDh14aDxYWxN7Go&e=

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

Re: Translate command in ROI Manager

fabrice senger-2
In reply to this post by Cammer, Michael-2
I have found that macro wich might be useful :

Dialog.create("Move Selections");
Dialog.addNumber("X Displacement:", dx);
Dialog.addNumber("Y Displacement:", dy);
Dialog.show();
dx = Dialog.getNumber();
dy = Dialog.getNumber();;
n = roiManager("count");
   if (n==0)
     exit("The ROI Manager is empty");
    for (i=0; i<n; i++) {
          roiManager('select', i);
          getSelectionBounds(x, y, w, h);
          setSelectionLocation(x+dx, y+dy);
          roiManager('Add');
     }

All the best,

Fabrice.

Le jeu. 9 janv. 2020 à 19:56, Cammer, Michael <[hidden email]>
a écrit :

> We have a question regarding the Translate command within the ROI Manager.
>
> Our goal is to select a single or group of ROIs in the manager and move
> them.  Is this what the translate command does?
>
> We have tried selecting one ROI and translating it, but 1.) nothing
> happens and 2.) we don't see a macro command generated in the Recorder
> window.
>
> Is this a bug with the command or are we using it incorrectly?  Any help
> appreciated.
>
> We are using ImageJ 1.52t23, Java 1.8, Win10
>
> Thank you!
>
> Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory
> NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY
> 10016
> Office: 646-501-0567 Cell: 914-309-3270  [hidden email]
> <mailto:[hidden email]>
> http://nyulmc.org/micros  http://microscopynotes.com/
> Acknowledgement in your publications and presentations of work performed
> in the Microscopy Core plays a vital role in securing support and the
> funding necessary to maintain and operate this valuable research resource.
>  For publications that were made possible by work performed in the core,
> please use the acknowledgement statement "We thank the NYU Langone
> Microscopy Core for experimental and technical support" and include
> required grant numbers as listed here
> http://microscopynotes.com/ilabnyu/acknowledgements2017.pdf
> Please also consider staff for co-authorship if they played a key role in
> the study.
>
>
>
> --
> 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: Translate command in ROI Manager

CARL Philippe (LBP)
Hi Fabrice,
How are you doing?
Happy New Year 2020!!!
For beginners your copied macro may be quite problematic to use since it will only work in the case a picture is open together with the roiManager containing at least an element.
On top of this it will throw and error since the parameters dx and dy used within the two Dialog.addNumber lines are undefined.
Thus prior to your copied code, you need to add something like:
dx = dy = 0;
Have a nice week-end.
My best regards,
Philippe

----- Mail original -----
De: "Fabrice Senger" <[hidden email]>
À: "imagej"
Envoyé: Vendredi 10 Janvier 2020 16:32:24
Objet: Re: Translate command in ROI Manager

I have found that macro wich might be useful :

Dialog.create("Move Selections");
Dialog.addNumber("X Displacement:", dx);
Dialog.addNumber("Y Displacement:", dy);
Dialog.show();
dx = Dialog.getNumber();
dy = Dialog.getNumber();;
n = roiManager("count");
   if (n==0)
     exit("The ROI Manager is empty");
    for (i=0; i<n; i++) {
          roiManager('select', i);
          getSelectionBounds(x, y, w, h);
          setSelectionLocation(x+dx, y+dy);
          roiManager('Add');
     }

All the best,

Fabrice.

Le jeu. 9 janv. 2020 à 19:56, Cammer, Michael <[hidden email]>
a écrit :

> We have a question regarding the Translate command within the ROI Manager.
>
> Our goal is to select a single or group of ROIs in the manager and move
> them.  Is this what the translate command does?
>
> We have tried selecting one ROI and translating it, but 1.) nothing
> happens and 2.) we don't see a macro command generated in the Recorder
> window.
>
> Is this a bug with the command or are we using it incorrectly?  Any help
> appreciated.
>
> We are using ImageJ 1.52t23, Java 1.8, Win10
>
> Thank you!
>
> Michael Cammer, Sr Research Scientist, DART Microscopy Laboratory
> NYU Langone Health, 540 First Avenue, SK2 Microscopy Suite, New York, NY
> 10016
> Office: 646-501-0567 Cell: 914-309-3270  [hidden email]
> <mailto:[hidden email]>
> http://nyulmc.org/micros  http://microscopynotes.com/
> Acknowledgement in your publications and presentations of work performed
> in the Microscopy Core plays a vital role in securing support and the
> funding necessary to maintain and operate this valuable research resource.
>  For publications that were made possible by work performed in the core,
> please use the acknowledgement statement "We thank the NYU Langone
> Microscopy Core for experimental and technical support" and include
> required grant numbers as listed here
> http://microscopynotes.com/ilabnyu/acknowledgements2017.pdf
> Please also consider staff for co-authorship if they played a key role in
> the study.

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