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

Opened 2012-08-03T14:10:11-05:00

Last modified 2012-08-14T10:53:23-05:00

Minimize the number of images that get opened by the legacy layer

Reported by: bdezonia Owned by: bdezonia
Priority: major Milestone: imagej2-b4-plugins
Component: Legacy Compatibility Version:
Severity: serious Keywords:
Cc: G.Landini@… Blocked By:
Blocking: #1170, #1331


Between beta 3 and beta 4 in the ij2 developer mailing list Gabriel Landini reported:

Not sure if this has been flagged before.
When running an IJ1 plugin that creates an ImagePlus but it is not shown, the
same plugin in IJ2 shows the image.

Is this something that can be resolved? If not, it might be impossible or
painfully slow to run IJ1 plugins that create a large number of temporary
ImagePlus but are not shown to be processed and then closed. In IJ2 they are
all shown making the whole process very slow.

Attachments (7.4 KB) - added by bdezonia 2012-08-13T16:54:28-05:00.
First of two plugins needed to recreate issue (6.6 KB) - added by bdezonia 2012-08-13T16:54:53-05:00.
Second of two plugins needed to recreate problem

Change History

comment:1 Changed 2012-08-07T10:27:51-05:00 by bdezonia

  • Blocking 1170 added

comment:2 Changed 2012-08-08T11:41:38-05:00 by curtis

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

This ticket must target beta4 as long as it blocks #1170.

comment:3 Changed 2012-08-13T12:42:43-05:00 by bdezonia

With commit 2ebd06347ff4412d8274b0fbf52b778d2e598f09 I have optimized ImagePlus tracking to skip those ImagePluses that do not have windows or ImageProcessors associated with them.

Gabriel, please test and let me know if its fixed. Thanks.

comment:4 Changed 2012-08-13T12:46:46-05:00 by bdezonia

Note that the change was to more closely mirror IJ1's behavior in regards to updateAndDraw() and repaintWindow() methods. When ImagePluses have no ImageProcessor set or have no associated window IJ1 does not do anything.

comment:5 Changed 2012-08-13T13:14:56-05:00 by bdezonia

With commit 095765ebb7d5dbc1006d42616c3b8ec0402071fb further optimization in place.

comment:6 Changed 2012-08-13T13:55:26-05:00 by bdezonia

Finalized closing behavior with commit 6244fc0da522e30f82b40a2e7b3a6959546c61d2

comment:7 Changed 2012-08-13T15:54:38-05:00 by bdezonia

Gabriel, I've figured out how to replicate your issue with those plugins. My previous fix was insufficient. I'll debug further.

comment:8 Changed 2012-08-13T16:52:34-05:00 by bdezonia

With commit ddb0441c65f7366e0288f472528e42cd4d3c73e3 the repeated creation of windows has been dispatched. Additional testing required but looks good so far.

Gabriel, I think it is now fixed.

Changed 2012-08-13T16:54:28-05:00 by bdezonia

First of two plugins needed to recreate issue

Changed 2012-08-13T16:54:53-05:00 by bdezonia

Second of two plugins needed to recreate problem

comment:9 Changed 2012-08-13T16:57:12-05:00 by bdezonia

To duplicate issue run GreyscaleReconstruct which itself calls BinaryReconstruct. First create a binary mask and open particles for binary test image. Run the plugin. On IJ1 it works and only ever opens one image. On IJ2 prefix it opened images until memory exhausted. With fix this is no longer the case.

comment:10 follow-up: ↓ 11 Changed 2012-08-13T16:57:19-05:00 by bdezonia

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

comment:11 in reply to: ↑ 10 Changed 2012-08-14T04:45:27-05:00 by landinig

  • Status changed from closed to reopened
  • Resolution fixed deleted

Replying to bdezonia:

Yes, this seems to be resolved. Thank you, Barry.

There is another perhaps associated issue.
If an ImagePlus is asked to be hidden, it does not get hidden.

For example, from a plugin I call the BinaryLabel plugin which creates a new image
called "Labelled" and I try to hide it. In IJ2 it remains open.

This works in IJ1:,"BinaryLabel ", "white");
imp5 = IJ.getImage();

comment:12 Changed 2012-08-14T09:46:43-05:00 by bdezonia

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

Gabriel, that issue is indeed different. I'll open a new ticket and CC you. Closing this ticket.

comment:13 Changed 2012-08-14T10:53:23-05:00 by bdezonia

  • Blocking 1331 added