Ticket #528 (closed defect: fixed)
Opened 2011-05-20T13:52:42-05:00
Last modified 2012-02-24T16:51:10-06:00
Have LegacyImageMap track Dataset events
Reported by: | bdezonia | Owned by: | bdezonia |
---|---|---|---|
Priority: | major | Milestone: |
|
Component: | Legacy Compatibility | Version: | |
Severity: | serious | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #1011 |
Description
The LegacyImageMap needs to track at least some of the Dataset events (type change, restructure, others?) and forget the existing mapping.
Imagine you open an 8 bit Dataset and have a 8 bit ImagePlus associated with it in the LegacyImageMap. Now change the type in IJ2 to 12-bit. The LegacyMap has an 8-bit ImagePlus associated with a 12-bit Dataset. If the map forgot the current mapping then the next time a mapping was needed it would get created when asked and it would get a 16-bit copy of the data.
I have put code in place to unregister Datasets and ImagePluses but have not put in the event listening code.
Change History
comment:1 Changed 2011-05-20T17:42:23-05:00 by bdezonia
- Status changed from new to accepted
comment:2 Changed 2011-05-24T13:09:42-05:00 by bdezonia
This approach is not totally correct. LegacyImageMap should only unregister Dataset deletions. The problems related to type changes should be caught in LegacyPlugin::prePluginHarmonization() once transparent type mapping handled correctly.
For now removing type change as a reason for LegacyImageMap to unregiister a Dataset.
This means this bug is going away but an awareness of the issues still required.
Right now what happens when you do the command sequence given is that the reverted file is still a 12-bit Dataset although pixel values are correct. This is because the harmonizer sets the pixel data by value upon return from plugin run and it does not know to change the type back. Will have to think what the best behavior is.
Now code in place to track dataset deleted and dataset type change events which forget old mappings. One can now open an 8-bit sample image, change to 12-bit, and revert back to 8-bit. Unfirtunately right now it also hatches a new viewable Dataset and leaves the old one in its window on the screen.