NOTICE! This is a static HTML version of a legacy ImageJ Trac ticket.

The ImageJ project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Ticket #546 (closed task: moved)

Opened 2011-05-26T15:39:16-05:00

Last modified 2012-08-14T12:16:57-05:00

Minimize time spent harmonizing Datasets/ImagePluses

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: imagej-2.0.0
Component: Legacy Compatibility Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1011, #1170

Description

Right now, in LegacyPlugin, prePluginHarmonization() code is run that makes sure all Datasets that have associated ImagePluses refresh the ImagePlus data before the legacy plugin is run.

We could improve the performance of this process by making LegacyImageMap track which Datasets have changed. It could track that via listening to Dataset events. New Dataset/ImagePlus mappings would be marked as "same". On event firings specifc Datasets would get marked "different".

In LegacyPlugin we'd only harmonize those ImagePluses whose Dataset has been recorded as "different" by the LegacyMap. And in postPluginHarmonization() the LegacyImageMap could be informed that the the Dataset is "same".

Change History

comment:1 Changed 2011-05-26T15:40:23-05:00 by bdezonia

  • Priority changed from minor to major

comment:2 Changed 2011-05-26T15:43:56-05:00 by bdezonia

trick question: when are Dataset events processed? The legacy layer can generate them during harmonization. Are they handled immediately or are they handled after return from running the LegacyPlugin itself? If the latter then marking as "same" would be immediately undone by the old events sitting around from harmonization. Thus all the tracking/updating optimizations could be fruitless. Investigate.

comment:3 Changed 2011-06-08T11:27:57-05:00 by bdezonia

Another thought: can we set ImagePlus.changes to false before plugin call and check it afterwards to decide whether to do harmonization? Need to see how good IJ! is about maintaining the changes flag.

comment:4 Changed 2011-06-09T09:53:08-05:00 by bdezonia

There are other ways to minimize harmonization and keep ImagePluses fresh:

  • have the legacy layer track a dirty bit for Datasets. In prepluginHarmonization() only update ImagePluses whose associated Dataset is dirty.
  • have the legacy layer track Dataset events and make some immediate changes (such as setPosition() with regard to slider changes) or record other changes that can be run later (such as DatasetChangedEvent). Then during prepluginHarmonization() update ImagePluses that have recorded events. The legacy layer could define its own internal update needs (via bitmask or enum).
  • in prePluginHarmonization mark each ImagePlus changes field to false. On postPluginHarmonization() only update Datasets whose associated ImagePlus has the changes flag set to true. The changes flag might not catch everything and so maybe we always need to do some updating (metadata perhaps).
  • hook more IJ1 methods via CodeHacker and update or event record changes in that direction also.

comment:5 Changed 2011-11-09T11:45:29-06:00 by bdezonia

  • Milestone changed from imagej-2.0-beta1 to imagej-2.0-beta2

comment:6 Changed 2012-02-26T20:46:09-06:00 by curtis

  • Blocking 1011 added

comment:7 Changed 2012-05-14T10:50:42-05:00 by bdezonia

  • Blocking 1070 added

comment:8 Changed 2012-05-14T10:55:36-05:00 by bdezonia

  • Milestone changed from imagej-2.0.0-beta3 to imagej-2.0.0-beta4

comment:9 Changed 2012-06-08T10:45:09-05:00 by bdezonia

  • Blocking 1170 added; 1070 removed

comment:10 Changed 2012-08-14T12:16:57-05:00 by bdezonia

  • Milestone changed from imagej-2.0.0-beta4 to imagej-2.0.0

comment:10 Changed 2014-08-20T12:08:15-05:00 by curtis

  • Status changed from new to closed
  • Resolution set to moved