IGSTK
igstkLandmark3DRegistration.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkLandmark3DRegistration.h,v $
5  Language: C++
6  Date: $Date: 2008-11-17 20:12:25 $
7  Version: $Revision: 1.23 $
8 
9  Copyright (c) ISC Insight Software Consortium. All rights reserved.
10  See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 #ifndef __igstkLandmark3DRegistration_h
19 #define __igstkLandmark3DRegistration_h
20 
21 #include "igstkStateMachine.h"
22 #include "igstkEvents.h"
23 #include "igstkMacros.h"
24 #include "igstkObject.h"
25 #include "igstkTransform.h"
26 #include "igstkCoordinateSystem.h"
27 
28 #include "itkImage.h"
29 #include "itkLandmarkBasedTransformInitializer.h"
30 
31 
32 namespace igstk
33 {
63 {
64 
65 public:
66 
69 
70 public:
71 
73  itkStaticConstMacro(Dimension,unsigned int,3);
74 
76  typedef unsigned char PixelType;
77  typedef itk::Image< PixelType, Dimension > ImageType;
78 
80  typedef itk::VersorRigid3DTransform< double > TransformType;
81  typedef TransformType::Pointer TransformPointerType;
82 
83  typedef itk::LandmarkBasedTransformInitializer< TransformType,
84  ImageType, ImageType > TransformInitializerType;
85 
86  typedef TransformInitializerType::LandmarkPointContainer
88 
89  typedef TransformInitializerType::LandmarkPointType LandmarkImagePointType;
90 
91  typedef TransformInitializerType::LandmarkPointType LandmarkTrackerPointType;
92 
93  typedef TransformInitializerType::Pointer TransformInitializerPointerType;
94 
95  typedef LandmarkPointContainerType::const_iterator
97 
100  void RequestAddImageLandmarkPoint( const LandmarkImagePointType & pt );
101 
104  void RequestAddTrackerLandmarkPoint( const LandmarkImagePointType & pt );
105 
111 
115 
119 
123 
126  void RequestGetRMSError();
127 
130  void RequestSetCollinearityTolerance( const double & tolerance );
131 
133  igstkEventMacro( TransformInitializerEvent, IGSTKEvent );
134  igstkEventMacro( TransformInitializerErrorEvent, IGSTKErrorEvent );
135 
138  igstkEventMacro( TransformComputationFailureEvent,
139  TransformInitializerErrorEvent );
140 
143  igstkEventMacro( TransformComputationSuccessEvent,TransformInitializerEvent);
144 
145 protected:
146 
147  Landmark3DRegistration ( void );
148  ~Landmark3DRegistration ( void );
149 
151  void ComputeRMSError();
152 
154  void PrintSelf( std::ostream& os, itk::Indent indent ) const;
155 
156 private:
157 
160  Landmark3DRegistration(const Self&); //purposely not implemented
161  void operator=(const Self&); //purposely not implemented
162 
163 
164  TransformPointerType m_Transform;
165  TransformInitializerPointerType m_TransformInitializer;
166  LandmarkPointContainerType m_TrackerLandmarks;
167  LandmarkPointContainerType m_ImageLandmarks;
168  LandmarkImagePointType m_ImageLandmarkPoint;
169  LandmarkTrackerPointType m_TrackerLandmarkPoint;
170 
171  Transform::ErrorType m_RMSError;
172 
174  double m_CollinearityTolerance;
175 
177  igstkDeclareStateMacro( Idle );
178  igstkDeclareStateMacro( ImageLandmark1Added );
179  igstkDeclareStateMacro( TrackerLandmark1Added );
180  igstkDeclareStateMacro( ImageLandmark2Added );
181  igstkDeclareStateMacro( TrackerLandmark2Added );
182  igstkDeclareStateMacro( ImageLandmark3Added );
183  igstkDeclareStateMacro( TrackerLandmark3Added );
184  igstkDeclareStateMacro( AttemptingToComputeTransform );
185  igstkDeclareStateMacro( TransformComputed );
186 
187 
189  igstkDeclareInputMacro( ImageLandmark );
190  igstkDeclareInputMacro( TrackerLandmark );
191  igstkDeclareInputMacro( ComputeTransform );
192  igstkDeclareInputMacro( GetTransformFromTrackerToImage );
193  igstkDeclareInputMacro( GetTransformFromImageToTracker );
194  igstkDeclareInputMacro( GetRMSError );
195  igstkDeclareInputMacro( ResetRegistration );
196  igstkDeclareInputMacro( TransformComputationFailure );
197  igstkDeclareInputMacro( TransformComputationSuccess );
198 
201  bool CheckCollinearity();
202 
206  void AddImageLandmarkPointProcessing();
207 
210  void AddTrackerLandmarkPointProcessing();
211 
214  void ResetRegistrationProcessing();
215 
218  void ComputeTransformProcessing();
219 
223  void GetTransformFromTrackerToImageProcessing();
224 
228  void GetTransformFromImageToTrackerProcessing();
229 
232  void GetRMSErrorProcessing();
233 
236  void ReportInvalidRequestProcessing();
237 
240  void ReportSuccessInTransformComputationProcessing();
241 
244  void ReportFailureInTransformComputationProcessing();
245 
247  CoordinateSystem::Pointer m_TrackerCoordinateSystem;
248  CoordinateSystem::Pointer m_ImageCoordinateSystem;
249 };
250 
251 } // end namespace igstk
252 
253 #endif // __igstkLandmark3DRegistration_h
void RequestAddImageLandmarkPoint(const LandmarkImagePointType &pt)
The "RequestAddImageLandmarkPoint" will be used to add point to the image landmark point container...
itk::VersorRigid3DTransform< double > TransformType
typedefs for the transform types
void RequestGetTransformFromImageToTracker()
The "RequesteGetTransformFromImageToTracker" method will be used to request to get the transform from...
void RequestGetTransformFromTrackerToImage()
The "RequesteGetTransformFromTrackerToImage" method will be used to request to get the transform from...
Base class for all the IGSTK classes.
Definition: igstkObject.h:40
TransformInitializerType::LandmarkPointType LandmarkTrackerPointType
#define igstkStandardClassTraitsMacro(classname, superclassname)
Convenience macro for traits of a non-templated class.
Definition: igstkMacros.h:275
TransformInitializerType::Pointer TransformInitializerPointerType
igstkStandardClassTraitsMacro(Landmark3DRegistration, Object) public typedef unsigned char PixelType
Macro with standard traits declarations.
defines standard system-wide macros, constants, and other common parameters in the IGSTK Library...
void ComputeRMSError()
The "ComputeRMSError" method calculates and returns RMS error.
void RequestGetRMSError()
The "RequestGetRMSError" method will be used to get the RMS error value.
This class computes rigid body transformation parameters between two 3D coordinate systems...
::itk::SmartPointer< Self > Pointer
Definition: igstkObject.h:50
igstkEventMacro(TransformInitializerEvent, IGSTKEvent)
Landmark registration events.
void RequestSetCollinearityTolerance(const double &tolerance)
RequestSetCollinearityTolerance method will be used to set collinearity tolerance.
LandmarkPointContainerType::const_iterator PointsContainerConstIterator
void RequestResetRegistration()
The "RequestResetRegistration" function will be used to start the registration process from the scrat...
A class representing a 3D Rigid transform.
void RequestAddTrackerLandmarkPoint(const LandmarkImagePointType &pt)
The "RequestAddTrackerLandmarkPoint" will be used to add a point to the tracker landmark point contai...
TransformInitializerType::LandmarkPointContainer LandmarkPointContainerType
itk::LandmarkBasedTransformInitializer< TransformType, ImageType, ImageType > TransformInitializerType
void RequestComputeTransform()
The "RequestComputeTransform" method will be used to request transform parameter calculation.
TransformInitializerType::LandmarkPointType LandmarkImagePointType
This class represents the frame of a coordinate reference system.
itk::Image< PixelType, Dimension > ImageType
void PrintSelf(std::ostream &os, itk::Indent indent) const
Print the object information in a stream.