IGSTK
igstkMR3DImageToUS3DImageRegistration.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Image Guided Surgery Software Toolkit
4  Module: $RCSfile: igstkMR3DImageToUS3DImageRegistration.h,v $
5  Language: C++
6  Date: $Date: 2008-02-11 01:41:50 $
7  Version: $Revision: 1.6 $
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 __igstkMR3DImageToUS3DImageRegistration_h
19 #define __igstkMR3DImageToUS3DImageRegistration_h
20 
21 #ifdef _MSC_VER
22 #pragma warning ( disable : 4018 )
23 //Warning about: identifier was truncated to '255' characters in the debug
24 //information (MVC6.0 Debug)
25 #pragma warning( disable : 4284 )
26 #endif
27 
28 #include "igstkObject.h"
29 #include "igstkStateMachine.h"
30 #include "igstkEvents.h"
31 #include "igstkMacros.h"
32 #include "igstkUSImageObject.h"
34 #include "itkImage.h"
35 #include "itkIndex.h"
36 #include "itkVectorContainer.h"
37 
38 namespace igstk
39 {
40 
59 {
60 public:
61 
64 
65 public:
66 
69 
70 public:
71 
73  igstkGetMacro( ValidMR3DImageToUS3DImageRegistration, bool );
74 
76  unsigned int GetNumberOfSamples() const;
77 
79  void RequestReset();
80 
83 
85  void RequestSetFixedUS3D(USImageObject* MRImage);
86 
89 
92 
94  igstkSetMacro( InitialTransform, TransformType );
95  igstkGetMacro( InitialTransform, TransformType );
96 
100 
101 protected:
102 
106  typedef VersorType::MatrixType MatrixType;
107  typedef itk::Index< 3 > IndexType;
108  typedef itk::Matrix< double, 4, 4 > Matrix4x4Type;
109  typedef itk::Image<double,3> ImageType;
110  typedef ImageType::SpacingType SpacingType;
111  typedef double ErrorType;
112 
113 
114  typedef vnl_matrix<double> VnlMatrixType;
115  typedef vnl_vector<double> VnlVectorType;
116  typedef vnl_svd<double> VnlSVDType;
117  typedef itk::VectorContainer<int,IndexType> InputIndexContainerType;
118  typedef InputIndexContainerType::Pointer InputIndexContainerPointerType;
119 
120  typedef itk::VectorContainer<int,PointType> InputPointContainerType;
121  typedef InputPointContainerType::Pointer InputPointContainerPointerType;
122  typedef itk::VectorContainer<int,VersorType> InputVersorContainerType;
123  typedef InputVersorContainerType::Pointer InputVersorContainerPointerType;
124 
125  typedef itk::VectorContainer<int,VectorType> InputVectorContainerType;
126  typedef InputVectorContainerType::Pointer InputVectorContainerPointerType;
127 
128 protected:
129 
132 
135 
137  virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const;
138 
139 
140 private:
141 
143  void NoProcessing();
144 
146  void ResetProcessing();
147 
149  void SetFixedUS3DProcessing();
150 
152  void SetMovingMR3DProcessing();
153 
155  void CalculateRegistrationProcessing();
156 
158  void ReportRegistrationTransformProcessing();
159 
161  typedef USImageObject::ImageType USImageType;
162  typedef USImageObject::ITKImageModifiedEvent USITKImageModifiedEvent;
163 
164  igstkObserverConstObjectMacro(ITKUSImage,
165  USITKImageModifiedEvent,USImageType)
166 
167  igstkObserverConstObjectMacro(ITKMRImage,
168  MRImageSpatialObject::ITKImageModifiedEvent,MRImageSpatialObject::ImageType)
169 
170  igstkObserverMacro(USImageTransform,CoordinateSystemTransformToEvent,
172  igstkObserverMacro(MRImageTransform,CoordinateSystemTransformToEvent,
174 
175 
176 private:
177 
179  igstkDeclareStateMacro( Idle );
180  igstkDeclareStateMacro( MRImageSet );
181  igstkDeclareStateMacro( USImageSet );
182  igstkDeclareStateMacro( ImagesSet );
183  igstkDeclareStateMacro( RegistrationCalculated );
184 
186  igstkDeclareInputMacro( ResetRegistration );
187  igstkDeclareInputMacro( ValidMovingMR3D );
188  igstkDeclareInputMacro( ValidFixedUS3D );
189  igstkDeclareInputMacro( MRImageTransform );
190  igstkDeclareInputMacro( USImageTransform );
191  igstkDeclareInputMacro( ValidRegistration );
192  igstkDeclareInputMacro( CalculateRegistration );
193  igstkDeclareInputMacro( RequestRegistrationTransform );
194 
195 
197  igstkLoadedEventTransductionMacro( CoordinateSystemTransformTo,
198  MRImageTransform );
199  igstkLoadedEventTransductionMacro( CoordinateSystemTransformTo ,
200  USImageTransform );
201 
203  TransformType m_RegistrationTransform;
204 
206  bool m_ValidMR3DImageToUS3DImageRegistration;
207 
209  ErrorType m_RootMeanSquareError;
210 
211  USImageObject* m_USFixedImageToBeSet;
212  USImageObject* m_USFixedImage;
213  MRImageSpatialObject* m_MRMovingImageToBeSet;
214  MRImageSpatialObject* m_MRMovingImage;
215  TransformType m_InitialTransform;
216 
217 };
218 
219 }
220 
221 #endif // _igstkUltrasoundCalibration_h