Login  Register

Re: RoiManager?

Posted by Michael Schmid on Jul 27, 2020; 12:29pm
URL: http://imagej.273.s1.nabble.com/RoiManager-tp5023762p5023771.html

Hi Kenneth,

sounds to me like this could be best done with adding the rois to the
overlay.
You can have a special name for the rois added, to later remove them all
from the overlay and leave the rest of the overlay untouched:

overlay.add(Roi roi, String name)
   https://github.com/imagej/imagej1/blob/master/ij/gui/Overlay.java#L42
overlay.remove(String name)
   https://github.com/imagej/imagej1/blob/master/ij/gui/Overlay.java#L73

Before adding the roi, set the stack position:

roi.setPosition(int n)
   https://github.com/imagej/imagej1/blob/master/ij/gui/Roi.java#L2092

or if it is a multi-dimentional stack
roi.setPosition(int channel, int slice, int frame)
   https://github.com/imagej/imagej1/blob/master/ij/gui/Roi.java#L2112

For the gui part, the easiest would probably be a WaitForUserDialog
telling the user what to do and pressing 'ok' when done. For adding
single Rois, I'd add a KeyListener for the image canvas, and ask the
user to press some otherwise unused key for adding the ROIs.

 
https://github.com/imagej/imagej1/blob/master/ij/gui/WaitForUserDialog.java

Michael
________________________________________________________________
On 24.07.20 20:36, Kenneth Sloan wrote:

> I write Java plugins - mostly interactive data gathering applications.  My Java skills are good, but my knowledge of ImageJ utilities is weak.  I now have an application which looks like it is a direct application of ImageJ utilities about which I know nothing - in particular, the RoiManager.
>
> Given an (extension of a) StackWindow displaying an ImageStack (plus overlays which I prefer to not disturb), I would like to allow the observer to:
>
> a) draw Polygon ROIs (0, 1, or (if easy) many) in each slice
> b) freely browse through the stack, using the normal stack controls (plus other
>              controls implemented in my extension) - with ONLY the Roi(s) associated with a
>              particular slice displayed at each step
>
> So...can some kind soul please point me at the appropriate documentation, or sample Java code, that does something similar?
>
> The only user interaction with the top level program will be to say "done", or possibly to say "add this Roi".
>
> I was about to implement all of this "from scratch", but it occurs to me that (in the abstract) this is a common process.
>
> It *may* be desirable to compute (and display in another window) some information on the current slice (for example, the area of the Rois in that slice) - but this is optional.
>
> At the end, the plugin will analyze the collection of Rois and write a report file - which is why I need the "done" indication.  If the "add/edit Rois while browsing the stack" can be isolated in a separate thread - a WaitForUserDialog() may be all I need at the top level.
>
> All clues gratefully rented.
>  
> --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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