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 #392 (closed task: fixed)

Opened 2011-03-23T13:20:00-05:00

Last modified 2011-05-10T15:08:36-05:00

Handle IJ1's in place manipulations of ImagePluses

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: biweekly-2011: May-09 to May-20
Component: Legacy Compatibility Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking:

Description

Our code to display Datasets will need to be smart about some of the changes IJ1 makes to data. If pixels are changed in place this is likely handled already. But imagine a IJ1 plugin that deletes a slice from an ImagePlus's stack. IJ2 will think the ImagePlus is the same and the Display code may not work right. Or a new Dataset will get hatched. Must somehow support things so the internals of the Dataset change and the Dataset is correctly displayed in IJ2.

Change History

comment:1 Changed 2011-04-01T15:32:49-05:00 by bdezonia

Did some investigation of this issue.

Defined a macro in IJ1 that deletes the last slice from a image stack. When loading T1 Head sample image and running macro in IJ1 stack is correctly changed. In IJ2 it is not. I have been able to run IJ1 macros in IJ2 with success before. Failure is also apparent via menu command Delete Slice.

We need to put a check somewhere that notices that a plugin has changed an ImagePlus in place. This is somewhat tricky because some plugins are all side effects and do not return a Dataset as an output.

Curtis thinks we can piggyback on calls to updateAndDraw() and check for changed status there. May need to use CodeHacker on more fine grained pieces of code.

Changes to ImagePluses worth noting:

  • one or more slices are added or removed to the ImagePlus' ImageStack
  • a ImagePlus' ImageStack slices are reordered
  • a whole new ImageStack replaces an existing ImageStack within an ImagePlus

If we get more fine grained we may have to create something like a map between ImagePluses and ImageStacks. Thus we can catch ImageStack.deleteLastSlice(), find which ImagePlus is affected, update it's associated Dataset, and publish a DatasetChanged event.

comment:2 Changed 2011-04-01T15:35:00-05:00 by curtis

  • Milestone changed from imagej-2.0-alpha1 to imagej-2.0-alpha2

comment:3 Changed 2011-05-09T18:04:25-05:00 by bdezonia

Debugged Delete Slice plugin to see what is happening. IJ1 calls setStack() with a new stack. We aren't catching that. Then I think it bypasses updateAndDraw() with draw() (not yet confirmed on this). We're not firing any LegacyImageChanged events. Started playing with messing with the LegacyManager via CodeHacker to handle setStack() but ran into some manager initialization issues afterwords. I'll look into this further soon.

comment:4 Changed 2011-05-10T15:08:36-05:00 by bdezonia

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from imagej-2.0-alpha3 to biweekly-2011: May-09 to May-20

Fixed delete slice.

Also fixed LegacyImageMap to correctly sync when changes to the stack happen (via setStack(), setPixels(), setProcessor(), and direct manipulation of stack order).