Posted by
Kenneth Sloan-2 on
Nov 27, 2019; 9:09pm
URL: http://imagej.273.s1.nabble.com/confusing-overlay-behavior-tp5022716p5022718.html
Michael-
I'll try your suggestions.
A few comments.
a) I believe all my Overlays are drawn by Java code that uses setOverlay(). The first Overlay is set (repeatedly) by an extension of ImagePlus (of perhaps StackWindow - I need to check). The second Overlay is set once by a program that has access to the ImagePlus (I think...). Up until that point, all is well - the old Overlay disappears and the new one is displayed.
If an Overlay can be associated with either an ImagePlus or a StackWindow....these are details I need to investigate. This is a fairly complicated set of objects, written over a period of several years, by several authors - not all of whom had the same understanding of how ImageJ actually works. So...there may well be inconsistencies in the user-level code.
b) If I have a StackWindow containing an ImageStack with just one slice, I expect Stack to Images to turn it into an ImagePlus containing a single image (not a Stack) and perhaps change the type of window to no longer be a StackWindow. This is all probably related to another oddity (to me) that when I create the StackWindow, using a Stack with only one slice, I don't get scrollbar controls - and later, when I add slices (which I can do, because it's still a Stack displayed in a StackWindow) I do NOT get the scrollbar added. I consider it reasonable to NOT display scrollbar controls when there is only one slice - but I consider it a bug to NOT have scrollbar controls when the Stack has more than 1 slice - even if the Stack had only 1 slice when the StackWindow was created. To me, this is basic - a Stack with 1 slice is still a Stack, just as a vector containing only one element is still a vector, and not a scalar (if that argument fails, try x vs {x})
So...as I write my "minimal program to replicate" - I will check to be sure that the setOverlay() calls reference the same object (ImagePlus vs StackWindow). I suspect that I will first write a VERY simple program that does not fail, and then see what features of the current plugin need to be added to make it fail.
Do you know if Duplicate or Save As work with a second, hidden copy of the ImagePlus? The most confusing thing to me is that the duplicated/saved image has a DIFFERENT Overlay than the one being displayed. I can think of two possibilities:
a) processing the duplicate/save causes my class which extends StackWindow or the class which extends ImagePlus to re-establish the "old" Overlay (but only on the hidden copy)
b) I somehow have one Overlay attached to the ImagePlus and another attached to the StackWindow - and the display currently shows the one attached to the ImagePlus while duplicate/save uses the one attached to the StackWindow.
The most confusing thing to me is that Duplicate produces a DIFFERENT display. The key may be "where does Duplicate find the old Overlay?" At the top level, the old Overlay should be long gone, and no longer even exist. Either ImageJ has made a safety copy somewhere and is reusing it - or there are two overlays attached to two different objects (the window and the ImagePlus).
I'll know more in a few days. Guess what I'll be doing all of Thanksgiving...
But...not today. The ice rink across the street from my apartment is open, and it's time for my first skate of the season.
--
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