Skip to content

Commit

Permalink
ENH: WIP: Issue Slicer#7179 Curved Planar Reformation
Browse files Browse the repository at this point in the history
Call vtkAddonMathUtilities::FitPlaneToPoints directly instead of via
vtkSlicerMarkupsLogic::GetBestFitPlane, which is unavailable from vtkMRMLSliceLogic.
  • Loading branch information
Leengit committed Dec 20, 2024
1 parent 2ae53fb commit 00e3964
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Libs/MRML/Logic/vtkMRMLSliceLogic.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
=========================================================================auto=*/

#if 0
// Includes that are not available
#include <vtkSlicerMarkupsLogic.h>
#endif

// MRMLLogic includes
#include <vtkMRMLApplicationLogic.h>
#include <vtkMRMLSliceLayerLogic.h>
Expand Down Expand Up @@ -1111,8 +1106,15 @@ vtkMRMLSliceLogic::CurvedPlanarReformationComputeStraighteningTransform(
resampledCurveNode->SetCurveTypeToLinear();
resampledCurveNode->SetControlPointPositionsWorld(sampledPoints);

vtkPoints * resampledCurvePointsWorld = resampledCurveNode->GetCurvePointsWorld();
if (resampledCurvePointsWorld == nullptr || resampledCurvePointsWorld->GetNumberOfPoints() < 3)
{
vtkErrorMacro("vtkMRMLSliceLogic::CurvedPlanarReformationComputeStraighteningTransform failed: "
"Not enough resampled curve points");
return false;
}
vtkSmartPointer<vtkPlane> curveNodePlane = vtkSmartPointer<vtkPlane>::New();
vtkSlicerMarkupsLogic::GetBestFitPlane(resampledCurveNode, curveNodePlane);
vtkAddonMathUtilities::FitPlaneToPoints(resampledCurvePointsWorld, curveNodePlane);

// Z axis (from first curve point to last, this will be the straightened curve long axis)
double curveStartPoint[3] = { 0.0, 0.0, 0.0 };
Expand Down

0 comments on commit 00e3964

Please sign in to comment.