Ticket #1157 (closed task: fixed)

Opened 7 years ago

Last modified 7 years ago

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

Description

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

  • Milestone changed from imagej-2.0.0-beta3 to imagej-2.0.0-beta2
Note: See TracTickets for help on using tickets.