Page MenuHomePhabricator

Levelwindow: Image for Levelwindow seems not to be selected correctly
Closed, ResolvedPublic

Description

  1. Load two images
  2. Rightclick on level window slider->Images-> deactivate "Set Topmost Image"
  3. Rightclick on level window slider->Images-> click on image 1
  4. Rightclick on level window slider->Images-> click on image 2

check properties: both now have imageForLevelWindow set to true.

Event Timeline

wirkert added a subscriber: wirkert.

my guess for the source of this bug is the LevelWindowManager::Update
method.

It doesn't make sense: First the image for level window property is set to false, but when it is set to true. The if statement at the end of this function will never evaluate to true since m_LevelWindowProperty never is null.

The bug originates from the LevelWindowManager::SelectLevelWindowProperty method. There, for the image that is associated with the handed over levelWindowProperty, the imageForLevelWindow is correctly set. Still, the image holding the former m_LevelWindowProperty keeps it imageForLevelWindow unchanged. Issue is fixed by deactivating imageForLevelWindow for the image associated with m_LevelWindowProperty prior to setting the new levelWindowProperty.

In fact, the if-selection at the end of the LevelWindowManager::Update method seems to be senseless and has been removed without apparent effect.

User norajitr has pushed new remote branch:

bug-19150-imageForLevelWindow-shouldBeUnique

Please do not mark a bug as resolved as long as it is not merged into the master.

Thanks for taking care of this. Some remarks:

Your fix solved only a part of this issue. It can still be achieved that the property "imageForLevelWindow" is true for all data nodes:

Load two images, image A and image B, where A has a higher layer than B
-> select B als image for levelwindow
-> toggle visibility of A
-> A is selected as image for levelwindow and the related property of both images is true

The reason for this is located in the mitk::LevelWindowManager::Update() function.
There if either visibility, layer or rendering mode of an image changes, the "imageForLevelWindow" is changed as well (for all images). I think that the if statement that you removed was simply wrong but the intention was to prevent that this property is set to true for all images. Could you please fix this and adapt the test accordingly?

Another point: The test case that you added contains uncommented code. Please remove that as well.

According cases have been added to the Update-Function of the LevelWindowManager. However, another bug is preventing proper updates on visibility changes. For each node, an observer is added to the visible-property by the level window manager. This observer is removed on data manager selection changes if the property list view is opened.

The erroneous observer removal is caused by a missing deletion of the m_PropertyDeletedTags map in QmitkPropertyItemModel::SetNewPropertyList. An appropriate deletion fixed the issue. According test cases have to be added next.

Test case added to the level window manager test, where the imageForLevelWindow property is checked against random data node visibility changes.

Currently, unique imageForLevelWindow selection has been fixed for 1. manual selection via context menu of the level window slider, 2. for identical images (see T19436) and 3. for node visibility changes. Still, unique manual selection via property list is not supported yet.

Unique manual setting of the imageForLevelWindow property has been added by adding the level window manager as an observer to the property. Consequently, the creation of the property has to be made upon observer list update. In addition, data node deletion is now taken into account.

An new test case has been introduced in the level window manager test to validate random manual settings of the imageForLevelWindow property.

User norajitr has pushed new remote branch:

bug-19150-integration-0

[0dc11e]: Merge branch 'bug-19150-integration-0'

Merged commits:

2016-03-16 17:03:38 Tobias Norajitra [b16bdb]
Unnecessary code lines removed.


2016-03-16 15:53:55 Tobias Norajitra [651a47]
Merge remote-tracking branch 'origin/bug-19150-imageForLevelWindow-shouldBeUnique' into bug-19150-integration-0

Conflicts:
Modules/Core/src/DataManagement/mitkLevelWindowManager.cpp


2016-03-16 15:47:02 Tobias Norajitra [27736f]
Merge remote-tracking branch 'origin/bug-19436-AutoTopMostFailForIdenticalImages' into bug-19150-integration-0


2016-03-02 16:26:37 Tobias Norajitra [2019df]
Test case for random manual imageForLevelWindow property changes.


2016-03-02 16:26:04 Tobias Norajitra [67a536]
Take node deletion into account.


2016-03-02 15:21:50 Tobias Norajitra [5b4dee]
Add proper handling for manual changes of the imageForLevelWindow property.


2016-02-24 15:22:16 Tobias Norajitra [630861]
Sensitivity test adjustment


2016-02-17 16:30:44 Tobias Norajitra [9c2eaa]
Test case added for imageForLevelWindow property settings on random node visibility changes.


2016-02-10 15:41:41 Tobias Norajitra [848c3b]
Comments removed.


2016-02-10 15:40:45 Tobias Norajitra [e17511]
Max layer node must be given precedence instead of visibility order.


2016-02-10 14:43:54 Tobias Norajitra [80b61c]
Test case for visibility changes added.


2016-02-10 14:11:41 Tobias Norajitra [020da2]
Code clean up.


2016-02-10 14:11:00 Tobias Norajitra [225950]
Properly handle data node visibility changes.


2016-02-10 14:07:43 Tobias Norajitra [55b8b4]
Clear property deleted tags as well to prevent inadequate observer removal.


2015-12-02 15:51:07 Tobias Norajitra [7e996d]
wip


2015-12-02 13:43:23 Tobias Norajitra [eaedd8]
Comments removed from LevelWindowManagerTest


2015-11-25 17:01:36 Tobias Norajitra [41b252]
SetLevelWindowProperty test added to level window manager test.


2015-11-25 16:45:34 Tobias Norajitra [a88ea5]
Same instance search for previous node.


2015-11-25 16:29:18 Tobias Norajitra [3f435a]
Proper pointer call.


2015-11-25 16:13:31 Tobias Norajitra [b3d985]
Node selection based on instance identitiy rather than value identity.


2015-11-25 16:11:35 Tobias Norajitra [3ffea1]
Merge branch 'bug-19150-imageForLevelWindow-shouldBeUnique'


2015-11-25 16:10:23 Tobias Norajitra [e62562]
Exception removed for cases where there is no deprecated node available, e.g. after deletion.


2015-11-04 15:53:04 Tobias Norajitra [fb4b20]
Merge branch 'bug-19150-imageForLevelWindow-shouldBeUnique'


2015-11-04 15:25:22 Tobias Norajitra [e6e131]
Setting the imageForLevelWindow false for the image associated with the former m_LevelWindowProperty prior to its change. In addition, senseless if-statement removed from Update.


2015-10-21 17:02:17 Tobias Norajitra [ab64d6]
Merge branch 'bug-19013-RegionGrowingSliderAdjustment'

[9db8f0]: Merge branch 'bug-19150-integration-0'

Merged commits:

2016-06-01 16:15:33 Tobias Norajitra [e0224f]
COMP: unused variable removed to avoid warning.