Closed pllim closed 9 years ago
@pllim, could you try commit e337c16e6202f7c1d086c3f02d8caead8509d305? I've also added a method to the Contents plugin called get_contents_by_channel(chname)
which you can use in lieu of accessing the plugin object's nameDict
directly--an implementation detail that could change in the future.
Are you implementing the recreation of the mosaic via the image_future
attribute of the Contents nameDict? This is the approach I recommend. If you make something sufficiently general that could be incorporated into the Mosaic plugin let me know. Tnx.
Are you implementing the recreation of the mosaic via the image_future attribute of the Contents nameDict?
@ejeschke , I am not, but I can if you give an example on how to use it. I have seen it in your codes but I don't know how to use it.
Regarding my original issue, your commit did fix it. But I wish to keep this issue open until we have addressed the follow-up issues in the comments.
If you make something sufficiently general that could be incorporated into the Mosaic plugin let me know.
Right now, I have a Mosaic sub-class (for Qt only) that has a "Create Mosaic" button, which creates a mosaic using WCS information from all the images in Contents
(if image is no longer in buffer, the plugin loads the image directly from file). This plugin also has a list widget that highlights the footprint of the selected image on the mosaic. If you are interested, I can submit it as a PR. Let me know.
Revisiting this again -- I think the remaining question I have here is, "What is image_future
and how to use it in my plugin?"
The image_future
is a callable with no parameters that, when invoked, will reconstruct the image. It basically provides a way to recreate an image using any method (mosaic, etc.). To take advantage of it, after creating your mosaic and associated AstroImage
create the future and attach it to the image using the image metadata set
method:
future = Future.Future()
future.freeze(some_func, arg1, arg2, ... kwarg1=val1, kwarg2=val2, ...)
image.set(name=name, image_future=future)
# announce image to ginga
self.fv.add_image(name, image, chname)
Thumbs
and Contents
will then use the image_future to recreate the image if it drops out of the Datasrc
.
Thanks!
In my own plugin, the code below gives
IndexError
becauseContents
somehow stores channel name as "Image" (with capital "I") but other plugins gets channel name as "image" (with lowercase "i"), and Python is case-sensitive.Currently, my workaround is:
Granted that this is a non-standard usage of Ginga. What I am trying to do is to grab a list of open images from
Contents
for use in my plugin. This is my attempt to automatically rebuild my mosaic when it is pushed out ofDatasrc
(as mentioned in #114).