Posted by
Kenneth Sloan-2 on
Nov 16, 2018; 2:53pm
URL: http://imagej.273.s1.nabble.com/Overlay-question-tp5021465p5021467.html
Please allow me to hijack this thread to thank Wayne (and others) for help on my Overlay questions.
As it turned out, I could not use the standard BrushTool - but their help made it easier for
me to implement my own code to annotate a stack (create an Overlay from an image, edit the Overlay
and finally extract the edited image).
What I learned: the Overlay feature is very useful, and *can* be used by several different non-cooperating
processes simultaneously, but this requires great care in writing each individual piece of code. It is
all too easy to assume (and I am guilty of this, as well) that your code is the only game in town.
As I say - the necessary mechanisms for sharing Overlays all seem to be in place; the problem is in
making sure that user-level plugins/macros don't step on each other's toes.
In my case, I originally thought that I wanted two distinct Objects to manipulate an Overlay on a stack. When this
proved difficult, I took the easy way out and duplicated the stack. As it happens, this actually lead to an improvement
in the interface I was building. I eventually saw a way to make it happen on one stack - but by that time I
had realized that the two-stack solution was preferable. So...lazy me...I filed this away in my "lessons learned"
folder. I'll try realHard to write cleaner code...next time.
In particular:
a) don't blindly use setOverlay() without first checking to see if an Overlay already exists - either
manipulate an existing Overlay or save it and restore it when you are done.
b) attach NAMES to Rois that you create/manipulate
c) use the NAMES to identify the Roi you want to manipulate - do not depend on TYPE or POSITION
in the list of Rois in an Overlay
d) document the NAMES to facilitate interactions between plugins/macros that you did not initially expect.
e) which leads to...worry about namespace problems
Again, thanks to Wayne (and others who responded) for showing me the way forward.
--
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