Assigning handles to and modifying ROIs

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

Assigning handles to and modifying ROIs

Markus Nenniger
Hey,

it seems my question last time was not specific enough.

I am trying to have the user create a region of interest.
This region will then be copied to the next slice, where it can be
moved again by the user. However, i want to retain the position
information of all the earlier ROIs in the previous slices.
Since i come from Matlab i was thinking about some kind of handle, so
i can easily access the ROI object (if that even exists)...

So my specific questions are:

a) how can i assign a handle to my ROIs?
b) how can i automatically run the "update" command in the region
manager after the user has moved the ROI?

regards, and thanks a lot.

Markus
Reply | Threaded
Open this post in threaded view
|

Re: Assigning handles to and modifying ROIs

Bill Mohler
Select your ROI.
Move to the new slice, then slide the ROI to the desired shape and position.
Click Add.
Repeat.

I think this can all be done programmatically with the macro commands below.


roiManager(cmd)
Runs an ROI Manager command, where cmd must be "Add", "Add & Draw",
"Update", "Delete", "Deselect", "Measure", "Draw", "Fill", "Label",
"Combine", "Split", "Sort", "Reset", "Multi Measure", "AND", "OR",
"Multi Plot", "Show All", "Show None", "Show all with labels", "Show all
without labels" or "Remove Slice Info". The ROI Manager is opened if it
is not already open. Use roiManager("reset") to delete all items on the
list. Use setOption("Show All", boolean) to enable/disable "Show All"
mode. For examples, refer to the RoiManagerMacros, ROI Manager Stack
Demo and RoiManagerSpeedTest macros.

roiManager(cmd, name)
Runs an ROI Manager I/O command, where cmd is "Open", "Save or "Rename",
and name is a file path or name. The "Save" option ignores selections
and saves all the ROIs as a ZIP archive. It displays a file save dialog
if name is "". You can get the selection name using
call("ij.plugin.frame.RoiManager.getName", index). The ROI Manager is
opened if it is not already open.

roiManager("count")
Returns the number of items in the ROI Manager list.

roiManager("index")
Returns the index of the currently selected item on the ROI Manager
list, or -1 if the list is empty, no items are selected, or more than
one item is selected.

roiManager("select", index)
Selects an item in the ROI Manager list, where index must be greater
than or equal zero and less than the value returned by
roiManager("count"). Note that macros that use this function sometimes
run orders of magnitude faster in batch mode. Use roiManager("deselect")
to deselect all items on the list. For an example, refer to the ROI
Manager Stack Demo macro.



On 1/20/12 3:31 a.m., Markus Nenniger wrote:

> Hey,
>
> it seems my question last time was not specific enough.
>
> I am trying to have the user create a region of interest.
> This region will then be copied to the next slice, where it can be
> moved again by the user. However, i want to retain the position
> information of all the earlier ROIs in the previous slices.
> Since i come from Matlab i was thinking about some kind of handle, so
> i can easily access the ROI object (if that even exists)...
>
> So my specific questions are:
>
> a) how can i assign a handle to my ROIs?
> b) how can i automatically run the "update" command in the region
> manager after the user has moved the ROI?
>
> regards, and thanks a lot.
>
> Markus
>