ROI Manager macro questions

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

ROI Manager macro questions

Janne Hyötylä
Hello everyone,

I have some questions about using the ROI Manager from macros.

1) Is there a way to call the More >> "Remove Slice Info" function from a  
macro? Or is there another way to reuse a ROI but on a different slice  
 from a macro?

2) I've written a macro which creates, selects, deletes a lot of ROIs  
using roiManager("") calls. I noticed that when I press Alt while the  
macro is running and ImageJ has focus, a dialog comes up asking to rename  
a ROI. This is on Linux with Fiji. Can I turn this behaviour off, i.e.  
stop the ROI Manager from receiving keyboard commands while the macro is  
running? I already have setBatchMode(true).


Thanks and cheers

Janne
Reply | Threaded
Open this post in threaded view
|

Re: ROI Manager macro questions

Rasband, Wayne (NIH/NIMH) [E]
On Sep 28, 2010, at 8:48 AM, Janne Hyötylä wrote:

> Hello everyone,
>
> I have some questions about using the ROI Manager from macros.
>
> 1) Is there a way to call the More >> "Remove Slice Info" function from a  
> macro? Or is there another way to reuse a ROI but on a different slice  
> from a macro?

Rename the ROI using roiManager("Rename", "newname") and you will then be able to use it on a different stack.

> 2) I've written a macro which creates, selects, deletes a lot of ROIs  
> using roiManager("") calls. I noticed that when I press Alt while the  
> macro is running and ImageJ has focus, a dialog comes up asking to rename  
> a ROI. This is on Linux with Fiji. Can I turn this behaviour off, i.e.  
> stop the ROI Manager from receiving keyboard commands while the macro is  
> running? I already have setBatchMode(true).

This bug is fixed in the v1.44i daily build.

-wayne
Reply | Threaded
Open this post in threaded view
|

Re: ROI Manager macro questions

Janne Hyötylä
Thanks Wayne,

both things are now working.

Janne


On Tue, 28 Sep 2010 21:17:52 +0200, Rasband, Wayne (NIH/NIMH) [E]  
<[hidden email]> wrote:

> On Sep 28, 2010, at 8:48 AM, Janne Hyötylä wrote:
>
>> 1) Is there a way to call the More >> "Remove Slice Info" function from  
>> a
>> macro? Or is there another way to reuse a ROI but on a different slice
>> from a macro?
>
> Rename the ROI using roiManager("Rename", "newname") and you will then  
> be able to use it on a different stack.
>
>> 2) I've written a macro which creates, selects, deletes a lot of ROIs
>> using roiManager("") calls. I noticed that when I press Alt while the
>> macro is running and ImageJ has focus, a dialog comes up asking to  
>> rename
>> a ROI. This is on Linux with Fiji. Can I turn this behaviour off, i.e.
>> stop the ROI Manager from receiving keyboard commands while the macro is
>> running? I already have setBatchMode(true).
>
> This bug is fixed in the v1.44i daily build.
>
> -wayne
Reply | Threaded
Open this post in threaded view
|

Re: ROI Manager macro questions

Janne Hyötylä
In reply to this post by Rasband, Wayne (NIH/NIMH) [E]
Wayne,

On Tue, 28 Sep 2010 21:17:52 +0200, Rasband, Wayne (NIH/NIMH) [E]  
<[hidden email]> wrote:

> On Sep 28, 2010, at 8:48 AM, Janne Hyötylä wrote:
>
>> 2) I've written a macro which creates, selects, deletes a lot of ROIs
>> using roiManager("") calls. I noticed that when I press Alt while the
>> macro is running and ImageJ has focus, a dialog comes up asking to  
>> rename
>> a ROI. This is on Linux with Fiji. Can I turn this behaviour off, i.e.
>> stop the ROI Manager from receiving keyboard commands while the macro is
>> running? I already have setBatchMode(true).
>
> This bug is fixed in the v1.44i daily build.

I ran again into this bug, with the 1.44i daily. It happens if I press the  
Alt key during such a for loop (simplified to illustrate the point):

for (...) {
        makeOval(..);
        roiManager("Add");
        makeOval(..);
        roiManager("Add");
       
        roiManager("Select", roiManager("count") - 2);
        roiManager("Rename", "r" + i);
        roiManager("Select", roiManager("count") - 1);
        roiManager("Rename", "b" + i);
}

Maybe some kind of race condition?

Best,

Janne