ginga
ginga copied to clipboard
Compose instructions can be improved
I tried to follow instructions at http://ginga.readthedocs.io/en/latest/manual/plugins_local/compose.html but I couldn't create a RGB successfully. I clicked "New Image", then I dragged a 2D FITS image file from FBrowser
to main display, and the image opened like a regular image. Then I clicked "Insert Layer" and I see a slider for "Red" and a bunch of traceback messages on the terminal. And I couldn't figure out how to insert G and B, as additional dragging of file from FBrowser
did not make extra sliders appear.
There is a bug in the RGB compose in addition to the poor documentation. I can reproduce this bug. And the fix is simple. I'll submit a fix, probably after merging #589
BTW, for an RGB compose, the instructions should be:
- select RGB as the compose type
- press New Image
- drag three monochrome images, in the order of R, G and B components, into the window.
- adjust sliders as desired to get the mix of color components
- click "Save As" to save the image as a new RGB type file.
I have to look up "Insert Layer", but normally you would not use this if you have your 3 files already.
So, "Insert Layer" is used when you already have the R, G, B images loaded into Ginga and you want to use those instead of dragging and dropping. You force the viewer to show the file you want to insert (using, say, Thumbs
) and then press "Insert Layer". So the workflow would go:
- select RGB as the compose type
- press New Image
- use e.g. Thumbs to select the red image
- press "Insert Layer"
- use e.g. Thumbs to select the green image
- press "Insert Layer"
- use e.g. Thumbs to select the blue image
- press "Insert Layer"
- adjust sliders as desired to get the mix of color components
- click "Save As" to save the image as a new RGB type file.
The bug should be fixed in commit 05f753ba86bfdc6a9fcee65dd2c238a254ac078c.
I will leave this issue open until the documentation can be improved.
@pllim, let me know what you think of the updated instructions.
Note that the "Save as" functionality is not working for "alpha" type compose images--need to debug why, but will leave this issue open until everything is working as documented.
updated instructions
In RGB section, "Drag your three constituent image" is still confusing to me; i.e., drag them from where to where? When I open FBrowser
, it seems impossible to drag anything from FBrowser
to Compose
preview (assuming that is what I am supposed to do).
As a result, I tried "Insert from Channel", assume it inserts the currently active image in the currently active channel. The preview looked weird (see screenshot below) and there is no new buffer listed in Thumbs
nor Contents
(of the new RGB image). Then I opened a second image for the next layer and clicked "Insert from Channel" again but this time I got a traceback (preview did not change):
Error making callback 'activated': could not broadcast input array from shape (120,111) into shape (240,222)
Traceback:
File ".../ginga-2.7.0.dev1779-py3.6.egg/ginga/misc/Callback.py", line 128, in make_callback
res = method(*cb_args, **cb_kwdargs)
File ".../ginga-2.7.0.dev1779-py3.6.egg/ginga/rv/plugins/Compose.py", line 158, in <lambda>
b.insert_from_channel.add_callback('activated', lambda w: self.insert_cb())
File ".../ginga-2.7.0.dev1779-py3.6.egg/ginga/rv/plugins/Compose.py", line 323, in insert_cb
self.insert_image(image)
File ".../ginga-2.7.0.dev1779-py3.6.egg/ginga/rv/plugins/Compose.py", line 314, in insert_image
alpha=attrs.alpha)
File ".../ginga-2.7.0.dev1779-py3.6.egg/ginga/LayerImage.py", line 39, in insert_layer
self.compose_layers()
File ".../ginga-2.7.0.dev1779-py3.6.egg/ginga/LayerImage.py", line 206, in compose_layers
self.rgb_compose()
File ".../ginga-2.7.0.dev1779-py3.6.egg/ginga/LayerImage.py", line 151, in rgb_compose
result[:, :, i] = data[:, :]
I am using the latest dev of Ginga (2.7.0dev) with Qt5 backend on RHEL7.
For RGB composition, you will need 3 identically-sized monochannel images. Load them into Ginga and make sure that the one that will become the red channel is showing. Press "Insert from Channel". The preview may indeed look wierd, as there is only one channel present in an RGB image (usually it just looks red). Now use "Thumbs" or "Contents" to make the green image showing in the channel viewer. Again, press "Insert from Channel". Finally, repeat with the blue image. Now the preview image should look "ok". Try moving the sliders to change the different amounts of R, G, and B being combined. Does this work for you?
Does this work for you?
Doing it this way, I see the 3 sliders, but the preview either looks weird (noisy, no data) or all black. I used three 2k by 2k FITS images of the same pointing but different background and/or exposure levels.
So, when you download "s1_mips_v0.30_sci.fits" from https://stsci.app.box.com/folder/3381606676 and use it to create R layer on your machine, do you see the same weird stuff as I did above?
I also don't see the resultant RGB image as a separate entry in Thumbs
or Contents
as I would when I create a mosaic.
@pllim, I tried "s1_mips_v0.30_sci.fits" and I see the very dark image also. I think this has to do with the fact that the LayerImage
mixin does not work correctly with the auto cuts that is happening in the preview, and there is no easy way to set the cuts manually for the preview. I think the auto cuts can be fixed for that, so let's leave this issue open until some progress can be made. I'm swamped for the rest of the week, so it may be a while before I can get to it.
The Compose documentation seems to be out of date. It is no longer under the Operations -> Dialogue menu, but now it is the Plugins->RGB menu.