Fraxinus  17.12
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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 #ifndef CENTERLINEREGISTRATION_H_
33 #define CENTERLINEREGISTRATION_H_
34 
35 #include <vector>
36 #include "cxVector3D.h"
37 #include "cxTransform3D.h"
38 #include "org_custusx_registration_method_centerline_Export.h"
39 #include "vtkForwardDeclarations.h"
40 #include <map>
41 #include "cxTransform3D.h"
42 #include <vtkSmartPointer.h>
43 #include <vtkPoints.h>
44 #include <vtkPolyData.h>
45 #include <vtkLandmarkTransform.h>
46 
47 #include <itkEuler3DTransform.h>
48 #include <itkEuclideanDistancePointMetric.h>
49 #include <itkLevenbergMarquardtOptimizer.h>
50 #include <itkPointSetToPointSetRegistrationMethod.h>
51 #include <itkPointSet.h>
52 
53 
54 typedef std::vector< Eigen::Matrix4d > M4Vector;
55 
56 
57 namespace cx
58 {
59 
60 typedef std::map<double, Transform3D> TimedTransformMap;
61 typedef vtkSmartPointer<vtkDoubleArray> vtkDoubleArrayPtr;
62 typedef vtkSmartPointer<vtkPoints> vtkPointsPtr;
63 typedef vtkSmartPointer<vtkPolyData> vtkPolyDataPtr;
64 
65 class org_custusx_registration_method_centerline_EXPORT CenterlineRegistration
66 {
67 
68 public:
69  typedef itk::PointSet< float, 3 > PointSetType;
70  typedef PointSetType::PointType PointType;
71  typedef PointSetType::PointsContainer PointsContainer;
72  typedef PointSetType::PointsContainerPointer PointsContainerPtr;
73  typedef PointsContainer::Iterator PointsIterator;
74 
75  typedef itk::EuclideanDistancePointMetric<
76  PointSetType,
77  PointSetType>
79  typedef itk::Euler3DTransform< double > TransformType;
80  typedef itk::LevenbergMarquardtOptimizer OptimizerType;
81 
82  typedef itk::PointSetToPointSetRegistrationMethod<
83  PointSetType,
84  PointSetType> RegistrationType;
85 
87  vtkPointsPtr smoothPositions(vtkPointsPtr centerline);
88  void UpdateScales(bool xRot, bool yRot, bool zRot, bool xTrans, bool yTrans, bool zTrans);
89  void SetFixedPoints(vtkPointsPtr points);
90  void SetMovingPoints(vtkPointsPtr points);
91  Transform3D FullRegisterMoving(Transform3D init_transform);
92  vtkPointsPtr processCenterline(vtkPolyDataPtr centerline, Transform3D rMd);
93  vtkPointsPtr ConvertTrackingDataToVTK(TimedTransformMap trackingData_prMt, Transform3D rMpr);
94  Transform3D runCenterlineRegistration(vtkPolyDataPtr centerline, Transform3D rMd, TimedTransformMap trackingData_prMt, Transform3D old_rMpr );
95  virtual ~CenterlineRegistration();
96 
97 private:
98  PointSetType::Pointer mFixedPointSet;
99  PointSetType::Pointer mMovingPointSet;
100 
101  RegistrationType::Pointer mRegistration;
102  TransformType::Pointer mTransform;
103  Transform3D mResultTransform;
104  bool mRegistrationUpdated;
105  OptimizerType::Pointer mOptimizer;
106 
107 };
108 
109 Eigen::Matrix4d registrationAlgorithm(M4Vector Tnavigation);
110 vtkPointsPtr convertTovtkPoints(Eigen::MatrixXd positions);
111 }//namespace cx
112 
113 #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.