Login  Register

Re: RoiManager?

Posted by Kenneth Sloan-2 on Jul 27, 2020; 6:25pm
URL: http://imagej.273.s1.nabble.com/RoiManager-tp5023762p5023772.html

Thanks for the reply.

Ordinarily, I would use the Overlay (and have done that it in similar plugins - but it this case I am trapped by my own ineptitude.  The StackWindow involved is part of a code base that supports many plugins (briefly, two StackWindows which are different extensions of StackWindow and which talk to each other and separately manage their own Overlays).  It uses the Overlay for different purposes, and when I originally wrote it I had some confusion about how to handle Overlays.  As a result, I am loathe to go back to that code to modify it.  If memory serves, I first tried to implement the Overlay processing to allow for sharing of the Overlay (using names) - but during debugging I gave up and made that code "greedy" so that it has total control over the Overlay - which it re-establishes on every interaction with the StackWindow.  That's on my list of things to fix the next time I do a major re-structuring (which I need to do soon...just not this week!)

I may, indeed, use a KeyListener to add a new Roi - I'm still at the "on paper design stage".  The simplest scheme is to have the user click on "OK" (in a wfud box) and then fetch the current Roi.  But, I will experiment with using roi.setPosition().  I assume that if I do this for every Roi, then *only* the Roi attached to a particular slice will be displayed?  That's what I want, but I was prepared to use an ImageListener to notice when the slice changes, and change the current Roi on the fly.

I already need to keep a separate stack of Roi's (one per slice) for later processing - so this is not all that much extra work.  But, if roi.setPositition() works as advertised, perhaps I can eliminate this stack and simply process the Rois at the end by fetching them from the StackWindow.

Using KeyListener would allow multiple Roi editing functions (add, delete, clear all, ...) and I just finished debugging a KeyListener for another plugin.  There, I had trouble maintaining "focus".  Perhaps this new plugin is a chance to see if I have internalized the lessons learned there.

If it matters, the immediate application is to compute the volume of an object from cross-sections traced by the user, using the Calalieri principle with care taken to handle the "lost cap" issues on either end.

Now...for extra credit...using roi.setPosition(), can I have multiple Roi's in each slice?  I don't really need this (now...) and can't quite see how to control which Roi is the "current" Roi while allowing multiple Roi's to be displayed (I just haven't tried this before).  But - if this is possible, it makes it more likely that I would use a KeyListener to control this feature.

--
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