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

Opened 2012-05-07T15:41:38-05:00

Last modified 2012-05-15T09:39:07-05:00

Decide how to handle ImageDisplay.contains with Data object argument

Reported by: curtis Owned by: curtis
Priority: major Milestone: imagej2-b2-bugfixes
Component: Display API Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1020


At the moment, if you have a Data object "data" and an ImageDisplay "imageDisplay" and you call "imageDisplay.contains(data)" it will always return false. The reason is that ImageDisplay is a Display<DataView>, not a Display<Data>, and the contains(Object) method is very literal in its evaluation. To work around this, we provide an ImageDisplay.containsData(Data) method. However, the DefaultDisplayService.getDisplaysContaining(Object) method has no knowledge of this exception, and instead naively uses Display.contains(Object) to check.

This can result in problems; e.g., DisplayPostprocessor never detects when an ImageDisplay already exists that contains a particular Dataset output. We have not noticed the problem because our plugins that work with Dataset objects essentially always call Dataset.update() to signal that the Dataset has changed, which triggers the Display to update in any case. But for the purpose of ticket #1020 this architectural oddity may be a problem.

Change History

comment:1 Changed 2012-05-11T12:24:15-05:00 by curtis

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

(In [5456]) Add Display.isDisplaying(Object) method

This is a general method similar to contains(Object) from the
collections API, except that it is more flexible. In particular, in the
case of an ImageDisplay, it will work as expected when asking about a
particular Data object. Since ImageDisplay actually displays
DataView objects, not Data objects, ImageDisplay.contains(Object) will
always return false, and rightly so according to the collections API.

This change allows the DisplayPostprocessor to properly query whether
outputs of type Data are currently being displayed; previously, a new
display would always be created.

Fixes #1157.

comment:2 Changed 2012-05-15T09:39:07-05:00 by curtis

  • Milestone changed from imagej-2.0.0-beta3 to imagej-2.0.0-beta2