Ticket #575 (closed task: invalid)

Opened 8 years ago

Last modified 8 years ago

IJ1 can kill stack

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

Description

There is code in IJ1::ImagePlus::setProcessor2() which can delete an ImageStack if it contains a single plane. Not sure whether it arises in practice.

To be safe make sure various places (such as the legacy layer) check for this condition and act appropriately.

Note I tried doing this quickly in the legacy layer and did not get good results. Must come up with test case where the stack does go away and show we can support it.

Change History

comment:1 Changed 8 years ago by bdezonia

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

Further debugging shows this to not be something to worry about. In ImagePlus::setProcessor() the stack is killed if the current stack size <= 1. But then calling ImagePlus::getStack() hatches a new stack of one slice.

It is possible that before a call to getStack() the internal stack is null as the result of a setProcessor(ip) call. This could only affect the legacy layer if one creates an ImagePlus with a one slice stack. Then call setProcessor() on the ImagePlus passing an ImageProcessor with a different data array backing it. Then manipulate the original stack and expect our changes have been propagated to the ImagePlus. The legacy layer avoids this by calling getStack() frequently and never calling setProcessor().

Hatched a case in LegacyUtilsTest class that shows IJ1's behavior.

comment:2 Changed 8 years ago by bdezonia

  • Milestone changed from imagej-2.0-final to biweekly-2011: Jun-20 to Jul-01
Note: See TracTickets for help on using tickets.