Ticket #392 (closed task: fixed)

Opened 8 years ago

Last modified 8 years ago

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 8 years ago 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 8 years ago by curtis

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

comment:3 Changed 8 years ago 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 8 years ago 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).

Note: See TracTickets for help on using tickets.