Login  Register

Re: confusing overlay behavior

Posted by Stein Rørvik on Nov 28, 2019; 11:53am
URL: http://imagej.273.s1.nabble.com/confusing-overlay-behavior-tp5022716p5022721.html

Image → Overlay → Flatten also does what you want, and works better than Capture Image, as it will retain the image resolution and spatial scaling. Capture Image will distort the image if it is not shown on screen with a 1:1 zoom.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of CARL Philippe (LBP)
Sent: 28. november 2019 11:19
To: [hidden email]
Subject: Re: confusing overlay behavior

Dear Kenneth,

On your question:
> So...I'm back to: how can I save an RGB version of an ImageJ window *as currently displayed on the screen*.
Did you try: Plugins> Utilities>Capture_Image ?
I successfully used this feature ages ago when I wanted as well to export (and save) RGB pictures together with their overlays.

Concerning your found issues with a stack (creation) of size 1, I agree on your comments that this should be interpreted as a bug.

Happy Thanksgivings!

My best regards,

Philippe

Philippe CARL
Laboratoire de Bioimagerie et Pathologies UMR 7021 CNRS - Université de Strasbourg Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 41 84

----- Mail original -----
De: "Kenneth Sloan" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Mercredi 27 Novembre 2019 22:09:01
Objet: Re: confusing overlay behavior

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: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7Cd2fd8cbb374f40569dc208d773ecac0e%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637105332653839452&amp;sdata=8XeAm25%2FezRtVB4zU7ynS5oeleecUP7wQ0wisoRAjsQ%3D&amp;reserved=0

--
ImageJ mailing list: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fimagej.nih.gov%2Fij%2Flist.html&amp;data=02%7C01%7Cstein.rorvik%40sintef.no%7Cd2fd8cbb374f40569dc208d773ecac0e%7Ce1f00f39604145b0b309e0210d8b32af%7C1%7C0%7C637105332653839452&amp;sdata=8XeAm25%2FezRtVB4zU7ynS5oeleecUP7wQ0wisoRAjsQ%3D&amp;reserved=0

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