Commit 724ed0fb authored by jcfr's avatar jcfr

BUG: Fix errors for model slice display manager when not in slice plane

- If there is no input or if the input has no points, the vtkTransformPolyDataFilter
  will display an error message on every update: "No input data".

- To prevent the error, if the input is empty then the actor should not be visible
  since there is nothing to display.

This is a good workaround for these unnecessary VTK messages. A discussion was
also started on the VTK forum to remove these messages.
See https://discourse.vtk.org/t/logging-error-messages-for-empty-input-data/453

From: Kyle Sunderland <sunderlandkyl@gmail.com>

git-svn-id: http://svn.slicer.org/Slicer4/trunk@28018 3bd1e089-480b-0410-8dfb-8563597acbee
parent f2340754
......@@ -488,6 +488,18 @@ void vtkMRMLModelSliceDisplayableManager::vtkInternal
#endif
pipeline->Cutter->SetInputConnection(pipeline->ModelWarper->GetOutputPort());
#if VTK_MAJOR_VERSION >= 9 || (VTK_MAJOR_VERSION >= 8 && VTK_MINOR_VERSION >= 2)
// If there is no input or if the input has no points, the vtkTransformPolyDataFilter will display an error message
// on every update: "No input data".
// To prevent the error, if the input is empty then the actor should not be visible since there is nothing to display.
pipeline->GeometryFilter->Update();
if (!pipeline->GeometryFilter->GetOutput() || pipeline->GeometryFilter->GetOutput()->GetNumberOfPoints() < 1)
{
pipeline->Actor->SetVisibility(false);
return;
}
#endif
// Set Poly Data Transform
vtkNew<vtkMatrix4x4> rasToSliceXY;
vtkMatrix4x4::Invert(this->SliceXYToRAS, rasToSliceXY.GetPointer());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment