ejeschke / ginga

The Ginga astronomical FITS file viewer
BSD 3-Clause "New" or "Revised" License
121 stars 77 forks source link

Add precise image warping to Mosaic plugin #1004

Open ejeschke opened 2 years ago

ejeschke commented 2 years ago

This adds an option to the Mosaic plugin to warp images precisely according to the WCS of the reference image. This option is slower than the standard rotate/flip mosaicing, but can produce more accurate mosaics, especially when there is some distortion near the edge of the field.

The same functionality was previously added to the Collage plugin.

ejeschke commented 2 years ago

Left todo: tile labelling

ejeschke commented 2 years ago

labeling fixed

ejeschke commented 2 years ago

@pllim, it should be in good enough shape for you to test now. I think your org has a plugin that is a subclass of this, right?

Probably there are some more things to fix or work out for backward compatibility. For example, it now creates an alpha mask in the mosaic image so that the empty space between the tiles does not show. But we might need to strip it off for saving the result mosaic? Let me know how it breaks things for you! :smile_cat:

ejeschke commented 2 years ago

Rebased

pllim commented 2 years ago

Thanks, I'll put this in my queue to review. 😸

ejeschke commented 2 years ago

Thanks, I'll put this in my queue to review. smile_cat

Take your time. I propose to bump this forward for release 4.0 in the fall.

pllim commented 2 years ago

@ejeschke , sorry this slipped through. Are you still waiting for my review? Would you mind rebasing? Thanks!

ejeschke commented 2 years ago

Rebased. No hurry on this one, @pllim!

ejeschke commented 2 years ago

This should still be considered a draft PR.

pllim commented 2 years ago

I checked out this branch, using dev version of stginga, and dev version of wss_tools. I loaded over 300 small images. Then I used MosaicAuto plugin for this workflow: https://wss-tools.readthedocs.io/en/latest/wss_tools/quip/usage_thumbs.html

https://wss-tools.readthedocs.io/en/latest/wss_tools/quip/mosaicauto.html

I get this error:

AssertionError
Non-GUI thread (...) is executing GUI (...) code!  File ".../ginga/ginga/rv/Control.py", line 424, in error_wrap
    return method(*args, **kwargs)

  File ".../ginga/rv/plugins/Mosaic.py", line 484, in mosaic
    self.fv.assert_gui_thread()

  File ".../ginga/ginga/gw/GwMain.py", line 224, in assert_gui_thread
    assert my_id == self.gui_thread_id, \

There is no error with the same images using dev version of Ginga instead of this branch.

ejeschke commented 2 years ago

Kicked down the road to release 4.1

ejeschke commented 7 months ago

Rebased