Browse Source

BUG: Fixed warped widgets in ctkVTKSliceView overlay

Default camera for overlay layer in ctkVTKSliceView was a default VTK camera with perspective projection.
This caused widgets appear tilted/warped when displayed near the edge of the render window.
This was particularly visible in vector text rendered by VTK seed widget (markup fiducials in 3D Slicer).
Andras Lasso 8 years ago
parent
commit
b9b3f6ec07
1 changed files with 7 additions and 0 deletions
  1. 7 0
      Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp

+ 7 - 0
Libs/Visualization/VTK/Widgets/ctkVTKSliceView.cpp

@@ -70,6 +70,13 @@ void ctkVTKSliceViewPrivate::setupRendering()
   // Setup overlay renderer
   this->OverlayRenderer->SetLayer(1);
   this->RenderWindow->AddRenderer(this->OverlayRenderer);
+  // Parallel projection is needed to prevent actors from warping/tilting
+  // when they are near the edge of the window.
+  vtkCamera* camera = this->OverlayRenderer->GetActiveCamera();
+  if (camera)
+    {
+    camera->ParallelProjectionOn();
+    }
 
   // Create cornerAnnotation and set its default property
   this->OverlayCornerAnnotation = vtkSmartPointer<vtkCornerAnnotation>::New();