Explorar o código

ENH: Preserve actor order in vtkLightBoxRendererManager

The order of how 2D actors are added to the renderer greatly influences the rendering result. Therefore, for consistent rendering results actor ordering in slice viewer has to be preserved when just changing the input image data.

Old behavior: When input to slice viewer was set to NULL (no image is selected for display), the image actor was removed from the renderer. When an image was selected again, the image actor was added again. This changed the actor order.

Implemented fix: Modified the behavior to only hide the image actor when input is set to NULL. This way when image input is later set to non-NULL, the image actor does not get promoted to the top of the actor list (but keeps its original position).
Andras Lasso %!s(int64=8) %!d(string=hai) anos
pai
achega
6b40e56856
Modificáronse 1 ficheiros con 4 adicións e 6 borrados
  1. 4 6
      Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.cpp

+ 4 - 6
Libs/Visualization/VTK/Core/vtkLightBoxRendererManager.cpp

@@ -415,16 +415,14 @@ void vtkLightBoxRendererManager::vtkInternal
 #else
   item->ImageMapper->SetInputConnection(this->ImageDataConnection);
   bool hasViewProp = item->Renderer->HasViewProp(item->ImageActor);
-  if (!this->ImageDataConnection && hasViewProp)
-    {
-    item->Renderer->RemoveViewProp(item->ImageActor);
-    item->Renderer->RemoveViewProp(item->HighlightedBoxActor);
-    }
-  else if (this->ImageDataConnection && !hasViewProp)
+  if (!hasViewProp)
     {
+    item->ImageActor->SetVisibility(false);
+    item->HighlightedBoxActor->SetVisibility(false);
     item->Renderer->AddActor2D(item->ImageActor);
     item->Renderer->AddActor2D(item->HighlightedBoxActor);
     }
+  item->ImageActor->SetVisibility(this->ImageDataConnection != NULL);
 #endif
 }