18 #include <vtkPoints.h>
19 #include <vtkThinPlateSplineTransform.h>
42 if (m_VtkTargetLandmarks !=
nullptr)
43 m_VtkTargetLandmarks->Delete();
44 if (m_VtkProjectedLandmarks !=
nullptr)
45 m_VtkProjectedLandmarks->Delete();
50 return m_TargetLandmarks.IsNotNull() && (m_TargetLandmarks->Size() >= 3) && m_LandmarkProjector.IsNotNull();
55 m_ThinPlateSplineTransform->SetSigma(sigma);
60 return m_ThinPlateSplineTransform->GetSigma();
65 Superclass::ComputeGeometry();
67 const mitk::PointSet::DataType::PointsContainer *finalTargetLandmarks, *projectedTargetLandmarks;
69 finalTargetLandmarks = m_LandmarkProjector->GetFinalTargetLandmarks();
70 projectedTargetLandmarks = m_LandmarkProjector->GetProjectedLandmarks();
72 mitk::PointSet::DataType::PointsContainer::ConstIterator targetIt, projectedIt;
74 targetIt = finalTargetLandmarks->Begin();
75 projectedIt = projectedTargetLandmarks->Begin();
78 m_VtkTargetLandmarks->Reset();
79 m_VtkProjectedLandmarks->Reset();
81 int size = finalTargetLandmarks->Size();
82 for (
id = 0;
id < size; ++id, ++targetIt, ++projectedIt)
85 m_VtkTargetLandmarks->InsertPoint(
id, target[0], target[1], target[2]);
87 m_VtkProjectedLandmarks->InsertPoint(
id, projected[0], projected[1], projected[2]);
89 m_VtkTargetLandmarks->Modified();
90 m_VtkProjectedLandmarks->Modified();
92 m_ThinPlateSplineTransform->SetSourceLandmarks(m_VtkProjectedLandmarks);
93 m_ThinPlateSplineTransform->SetTargetLandmarks(m_VtkTargetLandmarks);
99 newGeometry->UnRegister();
100 return newGeometry.GetPointer();
Thin-plate-spline-based landmark-based curved geometry.
itk::SmartPointer< Self > Pointer
virtual itk::LightObject::Pointer InternalClone() const override
clones the geometry
virtual void ComputeGeometry() override
virtual void SetSigma(double sigma)
vtkPoints * m_VtkTargetLandmarks
vtkThinPlateSplineTransform * m_ThinPlateSplineTransform
virtual bool IsValid() const override
Is this BaseGeometry in a state that is valid?
virtual double GetSigma() const
virtual ~ThinPlateSplineCurvedGeometry()
vtkAbstractTransform * m_InterpolatingAbstractTransform
vtkPoints * m_VtkProjectedLandmarks
Describes a two-dimensional, rectangular plane.
ThinPlateSplineCurvedGeometry()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.