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 #554 (closed defect: fixed)

Opened 2011-06-01T14:57:39-05:00

Last modified 2011-10-19T11:12:36-05:00

File::New::Hyperstack results in duplicate images being created/displayed

Reported by: bdezonia Owned by: curtis
Priority: major Milestone: imagej2-b1-initial
Component: Legacy Compatibility Version:
Severity: serious Keywords:
Cc: Blocked By:


Run File::New::Hyperstack. Choose c = 3, z = 1, t = 1. Choose Composite. Say OK. Two multichannel images are displayed. They have the same data displayed. One Dataset looks correct. The other one has funky luts and some of the drawn text is garbled.

Change History

comment:1 Changed 2011-06-13T11:58:22-05:00 by bdezonia

  • Owner changed from bdezonia to curtis
  • Status changed from new to assigned

I think we need to make a pure IJ2 version of File :: New :: Hyperstack. For now assigning to Curtis as he may have a similar ticket about fixing File :: New to be multidimensional. If I should do this instead please assign this back to me.

comment:2 Changed 2011-06-13T12:02:34-05:00 by bdezonia

Note: other ticket is #593

comment:3 Changed 2011-06-13T12:03:51-05:00 by curtis

The plan is for the IJ2 NewImage plugin to be able to create N-dimensional images. The "File::New::Hyperstack" command is redundant and can go away.

However, we still need to fix the issue of redundant images. I noticed a few places where this happens now, and I believe it is a larger bug in the legacy layer. We will have to fix it for IJ1 code to continue functioning.

comment:4 Changed 2011-06-13T12:12:21-05:00 by bdezonia

  • Owner changed from curtis to bdezonia

I will take this issue to try and find the duplicate image issue in the legacy layer.

I've left #593 to encompass the other changes mentioned in this ticket. I've tagged it with a little additional info.

comment:5 Changed 2011-06-13T14:29:09-05:00 by bdezonia

Some quick investigation shows that the IJ1 plugin is registering two images. These registrations happen via updateAndDraw() and show() (calling legacyImageChanged()). It turns out the plugin creates an ImagePlus and then makes a CompositeImage from that. The legacy hooks see them as different things and registers both of them. Not sure about the best way to address this. This needs further investigation to nail down the exact issue and whats needs to be changed.

comment:6 Changed 2011-06-13T14:30:58-05:00 by bdezonia

Note the show() and updateAndDraw() calls are happening many many times. The creation of a HyperStack works via a macro and perhaps the macro is repeatedly calling these methods which in this case might be unnecessary but which we have to work with.

comment:7 Changed 2011-06-13T16:12:53-05:00 by bdezonia

  • Owner changed from bdezonia to curtis

Bug addressed as of 907c0d6e7bd76e08b77aed317f53b15142aa1b62.

Fix - avoid calling legacyImageChanged() during batch mode drawing.

Curtis can you review my code? I want to make sure my fix is legitimate. Let me know if there are any issues.

comment:8 Changed 2011-07-27T15:01:50-05:00 by curtis

  • Milestone changed from biweekly-2011: Jul-18 to Jul-29 to biweekly-2011: Aug-01 to Aug-12

comment:9 Changed 2011-08-01T12:10:32-05:00 by curtis

  • Milestone changed from biweekly-2011: Aug-01 to Aug-12 to imagej-2.0-alpha5

Milestone biweekly-2011: Aug-01 to Aug-12 deleted

comment:10 Changed 2011-10-18T15:42:56-05:00 by curtis

  • Status changed from assigned to closed
  • Resolution set to fixed

I do not know if this fix is "legitimate" or not, in that the check "FunctionsMethods.InsideBatchDrawing > 0" seems very scary to me. But I do not know enough to judge at the moment. I am closing this ticket, since the problem is fixed. We can reopen or create new tickets for any other problems related to this change.

comment:11 Changed 2011-10-19T11:11:47-05:00 by bdezonia

Fix undone in 889f659ad129af101686052ec4150648302ed54e. Removing old fix doesn't seem to cause any problems. This original bug is no longer apparent. I have left the original bug fix code in place in comments and also documented another approach to a fix if needed.

comment:12 Changed 2011-10-19T11:12:36-05:00 by bdezonia

Fix actually undone in ed6a130dd55d12161fdc33ba703cacdc87eec8b5