Fraxinus  2023.01.05-dev+develop.0da12
An IGT application
cxCenterlineRegistration.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 #ifndef CENTERLINEREGISTRATION_H_
12 #define CENTERLINEREGISTRATION_H_
13 
14 #include <vector>
15 #include "cxVector3D.h"
16 #include "cxTransform3D.h"
17 #include "org_custusx_registration_method_centerline_Export.h"
18 #include "vtkForwardDeclarations.h"
19 #include <map>
20 #include "cxTransform3D.h"
21 #include <vtkSmartPointer.h>
22 #include <vtkPoints.h>
23 #include <vtkPolyData.h>
24 #include <vtkLandmarkTransform.h>
25 
26 #include <itkEuler3DTransform.h>
27 #include <itkEuclideanDistancePointMetric.h>
28 #include <itkLevenbergMarquardtOptimizer.h>
29 #include <itkPointSetToPointSetRegistrationMethod.h>
30 #include <itkPointSet.h>
31 
32 
33 typedef std::vector< Eigen::Matrix4d > M4Vector;
34 
35 
36 namespace cx
37 {
38 
39 typedef std::map<double, Transform3D> TimedTransformMap;
40 typedef vtkSmartPointer<vtkDoubleArray> vtkDoubleArrayPtr;
41 typedef vtkSmartPointer<vtkPoints> vtkPointsPtr;
42 typedef vtkSmartPointer<vtkPolyData> vtkPolyDataPtr;
43 
44 class org_custusx_registration_method_centerline_EXPORT CenterlineRegistration
45 {
46 
47 public:
48  typedef itk::PointSet< float, 3 > PointSetType;
49  typedef PointSetType::PointType PointType;
50  typedef PointSetType::PointsContainer PointsContainer;
51  typedef PointSetType::PointsContainerPointer PointsContainerPtr;
52  typedef PointsContainer::Iterator PointsIterator;
53 
54  typedef itk::EuclideanDistancePointMetric<
55  PointSetType,
56  PointSetType>
58  typedef itk::Euler3DTransform< double > TransformType;
59  typedef itk::LevenbergMarquardtOptimizer OptimizerType;
60 
61  typedef itk::PointSetToPointSetRegistrationMethod<
62  PointSetType,
63  PointSetType> RegistrationType;
64 
66  vtkPointsPtr smoothPositions(vtkPointsPtr centerline);
67  void UpdateScales(bool xRot, bool yRot, bool zRot, bool xTrans, bool yTrans, bool zTrans);
68  void SetFixedPoints(vtkPointsPtr points);
69  void SetMovingPoints(vtkPointsPtr points);
70  Transform3D FullRegisterMoving(Transform3D init_transform);
71  vtkPointsPtr processCenterline(vtkPolyDataPtr centerline, Transform3D rMd);
72  vtkPointsPtr ConvertTrackingDataToVTK(TimedTransformMap trackingData_prMt, Transform3D rMpr);
73  Transform3D runCenterlineRegistration(vtkPolyDataPtr centerline, Transform3D rMd, TimedTransformMap trackingData_prMt, Transform3D old_rMpr );
74  virtual ~CenterlineRegistration();
75 
76 private:
77  PointSetType::Pointer mFixedPointSet;
78  PointSetType::Pointer mMovingPointSet;
79 
80  RegistrationType::Pointer mRegistration;
81  TransformType::Pointer mTransform;
82  Transform3D mResultTransform;
83  bool mRegistrationUpdated;
84  OptimizerType::Pointer mOptimizer;
85 
86 };
87 
88 Eigen::Matrix4d registrationAlgorithm(M4Vector Tnavigation);
89 vtkPointsPtr convertTovtkPoints(Eigen::MatrixXd positions);
90 }//namespace cx
91 
92 #endif /* CENTERLINEREGISTRATION_H_ */
itk::PointSetToPointSetRegistrationMethod< PointSetType, PointSetType > RegistrationType
PointSetType::PointType PointType
PointsContainer::Iterator PointsIterator
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
vtkSmartPointer< vtkPoints > vtkPointsPtr
vtkPointsPtr convertTovtkPoints(Eigen::MatrixXd positions)
itk::LevenbergMarquardtOptimizer OptimizerType
itk::EuclideanDistancePointMetric< PointSetType, PointSetType > MetricType
std::vector< Eigen::Matrix4d > M4Vector
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
itk::Euler3DTransform< double > TransformType
itk::PointSet< float, 3 > PointSetType
vtkSmartPointer< vtkDoubleArray > vtkDoubleArrayPtr
PointSetType::PointsContainerPointer PointsContainerPtr
std::vector< Eigen::Matrix4d > M4Vector
PointSetType::PointsContainer PointsContainer
Eigen::Matrix4d registrationAlgorithm(BranchListPtr branches, M4Vector Tnavigation, Transform3D old_rMpr)
std::map< double, Transform3D > TimedTransformMap
Namespace for all CustusX production code.