mitk::LevelWindowManager::Update checks if the AutoTopMost mode is enabled. If so, it continues within SetAutoTopMostImage. If not, it continues within the update-function itself.
In the update-function itself there are some checks (e.g. node visibility). The most important check is the check for the "imageForLevelWindow"-property. If this property is set, a node is set for the level window. If no such node is found, the function uses the topmost visible node as fallback.
In the SetAutoTopMostImage-function the check for the "imageForLevelWindow"-property is not done. This makes sense, as this property is not relevant (it is even removed for each node). What is important is the topmost visible node (hence, the name AutoTopMost).
However, the SetAutoTopMostImage-function additionally uses mitk::LevelWindowManager::IgnoreNode to ignore each node that has either the RenderingModeProperty::LOOKUPTABLE_COLOR or RenderingModeProperty::COLORTRANSFERFUNCTION_COLOR set.
This function is NOT used inside the update-function itself, which means that - if the AutoTopMost mode is disabled, the level window widget is visible for a node with one of those two rendering mode properties set.
To reproduce:
- start MITK workbench, load a dataset
- see the LevelWindowSlider on the right side of the Standard Display
- open the Properties Plugin view and select the loaded node
- change the property Image Rendering -> Mode to either LookupTable_Color or ColorTransferFunction_Color
- see how the LevelWindowSlider disappears
- change the property Image Rendering -> Mode back to either LookupTable_LevelWindow_Color or ColorTransferFunction_LevelWindow_Color
- see how the LevelWindowSlider appears
- open the context-menu on the LevelWindowSlider and disable Images -> Set topmost image
- change the property Image Rendering -> Mode to either LookupTable_Color or ColorTransferFunction_Color
- see how the LevelWindowSlider DOES NOT disappear
- additionally you can move / change the LevelWindowSlider and see that the rendered image does not change
My suggestion when fixing this is to also simplify the different checks by introducing a function that checks these different conditions, possibly using some node predicates or lambdas or the like. Redundancy should be removed!