-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Reproject
plugin for reference viewer
#813
base: main
Are you sure you want to change the base?
Conversation
ejeschke
commented
Dec 19, 2019
- This is a plugin that basically provides a GUI for doing WCS reprojections using the AstroPy "reproject" module.
- Provided mostly as a basis for further discussion on How does Ginga handle image distortion? #328
This is mostly just to advance the discussion in #328. I think probably the support needs to be baked in a little deeper than just in a plugin, but this is a strawman to get ideas flowing. To test this you need to have the AstroPy To use: start the Caveats:
|
ping @pllim, @eteq, @hcferguson, @larrybradley |
Added a WCS to the reprojected image. |
@ejeschke , two things:
I also encountered segfault at some point but I don't know how to reproduce it. |
2eb1c97
to
85d444e
Compare
Rebased. |
Well, that's what I mean when I said (above):
Ideally, the distortion should be corrected at image load time. That way, you only pay for it once, especially if it is compute intensive. But, no, this plugin does not do just the displayed portion. We might be able to refactor it to work on only the displayed area, I would think. |
I thought that too, but I'm not sure offhand how to monitor the |
We could run the reproject call in another thread--that would be easy. The viewer would still be responsive. I'll see if I can push up a fix for that. |
@pllim, if you try the plugin now you will see that it remains responsive during the reprojection. I also added a little status message in the plugin. |
@pllim, does drizzle do what you want for STScI images? Has any put together a drizzle plugin for ginga? |
Also, can I get a copy of your large image and also your "corrected one", to test with this? You could put them in the Box drive, if you folks are still using that... |
TBH, I still think it is a bad idea to have a GUI do the drizzling/reprojection on-the-fly for the whole image. It is computationally intensive and the image can be pre-processed outside the GUI anyway. I just don't see the point. I think @hcferguson said one thing that can be useful is to use this as a way to explore which are the optimal parameters to use for the algorithm, but then the parameters that are exposed depend on the use case. So, I don't see much value in that either but maybe Harry can clarify if I misunderstood. |
The main use case is for viewing multiple images with the same pixel scale and rotation in different windows. Generally one can ignore higher-order distortions for doing that. And for speed, one could do these all on just the portion viewed. Also one could in principle do this only for the bit depth viewed (i.e. on 16 or 32 bit integer data rather than floats). And there are in principle methods to use GPUs for such transformations, although I don't know how portable they are. I suppose one relatively common use-case that stresses doing the whole image would be to overlay a mask (e.g. cosmic rays) from an unrectified image onto the rectified image. There it's necessary to do the full reprojection, and one generally wants a method that does some nearest-neighbor interpolation so the reprojected mask is still binary. That is to say ... I can see the benefit of having lightning fast reprojections that take shortcuts, as well as a full reprojection... |
Thanks for the clarification, @hcferguson . Can you please upload some test images (maybe 3 would be sufficient?) to https://stsci.app.box.com/folder/3381606676 for @ejeschke ? |
7e48cc6
to
245ce8d
Compare
Rebased. |
I fthink I've figured this out. With the latest commit and example images it now can get the fully rotated result. |
There is another candidate PR (#816) that I think works a little more closely to the workflow @pllim was describing. You don't need two WCSes and it doesn't use I'm still a little unclear if this is the kind of "undistortion" being described in this issue, but it seems to do something akin to barrel distortion type adjustment to a couple of the HST images I tried. |
p.s. This needs a rebase to fix the |
For my own future reference, this is the one at |
Using the three files that @hcferguson provded in #813 (comment) ...
|
8acef2d
to
d4adb5f
Compare
Rebased. |
7447f29
to
0291a8f
Compare
0291a8f
to
4ac5aed
Compare
Rebased |
959af26
to
6f9c52b
Compare
- This is a plugin that basically provides a GUI for doing WCS reprojections using the AstroPy "reproject" module. - Provided mostly as a basis for further discussion on ejeschke#328
- added an undistort button, which creates a reprojection based on the current WCS with SIP information removed - added enable/disable code to grey out buttons that can't be used
- added a readable error message when trying to start the plugin without having the astropy reproject module installed
6f9c52b
to
e75d6d4
Compare