IGSTK
|
00001 /*========================================================================= 00002 00003 Program: Image Guided Surgery Software Toolkit 00004 Module: $RCSfile: igstkMR3DImageToUS3DImageRegistration.h,v $ 00005 Language: C++ 00006 Date: $Date: 2008-02-11 01:41:50 $ 00007 Version: $Revision: 1.6 $ 00008 00009 Copyright (c) ISC Insight Software Consortium. All rights reserved. 00010 See IGSTKCopyright.txt or http://www.igstk.org/copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef __igstkMR3DImageToUS3DImageRegistration_h 00019 #define __igstkMR3DImageToUS3DImageRegistration_h 00020 00021 #ifdef _MSC_VER 00022 #pragma warning ( disable : 4018 ) 00023 //Warning about: identifier was truncated to '255' characters in the debug 00024 //information (MVC6.0 Debug) 00025 #pragma warning( disable : 4284 ) 00026 #endif 00027 00028 #include "igstkObject.h" 00029 #include "igstkStateMachine.h" 00030 #include "igstkEvents.h" 00031 #include "igstkMacros.h" 00032 #include "igstkUSImageObject.h" 00033 #include "igstkMRImageSpatialObject.h" 00034 #include "itkImage.h" 00035 #include "itkIndex.h" 00036 #include "itkVectorContainer.h" 00037 00038 namespace igstk 00039 { 00040 00058 class MR3DImageToUS3DImageRegistration : public Object 00059 { 00060 public: 00061 00063 igstkStandardClassTraitsMacro( MR3DImageToUS3DImageRegistration, Object ); 00064 00065 public: 00066 00068 typedef Transform TransformType; 00069 00070 public: 00071 00073 igstkGetMacro( ValidMR3DImageToUS3DImageRegistration, bool ); 00074 00076 unsigned int GetNumberOfSamples() const; 00077 00079 void RequestReset(); 00080 00082 void RequestSetMovingMR3D(MRImageSpatialObject* MRImage); 00083 00085 void RequestSetFixedUS3D(USImageObject* MRImage); 00086 00088 void RequestCalculateRegistration(); 00089 00091 void RequestGetRegistrationTransform(); 00092 00094 igstkSetMacro( InitialTransform, TransformType ); 00095 igstkGetMacro( InitialTransform, TransformType ); 00096 00099 igstkFriendClassMacro( igstk::USImageObject ); 00100 00101 protected: 00102 00103 typedef TransformType::VersorType VersorType; 00104 typedef TransformType::VectorType VectorType; 00105 typedef TransformType::PointType PointType; 00106 typedef VersorType::MatrixType MatrixType; 00107 typedef itk::Index< 3 > IndexType; 00108 typedef itk::Matrix< double, 4, 4 > Matrix4x4Type; 00109 typedef itk::Image<double,3> ImageType; 00110 typedef ImageType::SpacingType SpacingType; 00111 typedef double ErrorType; 00112 00113 00114 typedef vnl_matrix<double> VnlMatrixType; 00115 typedef vnl_vector<double> VnlVectorType; 00116 typedef vnl_svd<double> VnlSVDType; 00117 typedef itk::VectorContainer<int,IndexType> InputIndexContainerType; 00118 typedef InputIndexContainerType::Pointer InputIndexContainerPointerType; 00119 00120 typedef itk::VectorContainer<int,PointType> InputPointContainerType; 00121 typedef InputPointContainerType::Pointer InputPointContainerPointerType; 00122 typedef itk::VectorContainer<int,VersorType> InputVersorContainerType; 00123 typedef InputVersorContainerType::Pointer InputVersorContainerPointerType; 00124 00125 typedef itk::VectorContainer<int,VectorType> InputVectorContainerType; 00126 typedef InputVectorContainerType::Pointer InputVectorContainerPointerType; 00127 00128 protected: 00129 00131 MR3DImageToUS3DImageRegistration(); 00132 00134 virtual ~MR3DImageToUS3DImageRegistration(); 00135 00137 virtual void PrintSelf( std::ostream& os, itk::Indent indent ) const; 00138 00139 00140 private: 00141 00143 void NoProcessing(); 00144 00146 void ResetProcessing(); 00147 00149 void SetFixedUS3DProcessing(); 00150 00152 void SetMovingMR3DProcessing(); 00153 00155 void CalculateRegistrationProcessing(); 00156 00158 void ReportRegistrationTransformProcessing(); 00159 00161 typedef USImageObject::ImageType USImageType; 00162 typedef USImageObject::ITKImageModifiedEvent USITKImageModifiedEvent; 00163 00164 igstkObserverConstObjectMacro(ITKUSImage, 00165 USITKImageModifiedEvent,USImageType) 00166 00167 igstkObserverConstObjectMacro(ITKMRImage, 00168 MRImageSpatialObject::ITKImageModifiedEvent,MRImageSpatialObject::ImageType) 00169 00170 igstkObserverMacro(USImageTransform,CoordinateSystemTransformToEvent, 00171 CoordinateSystemTransformToResult ) 00172 igstkObserverMacro(MRImageTransform,CoordinateSystemTransformToEvent, 00173 CoordinateSystemTransformToResult ) 00174 00175 00176 private: 00177 00179 igstkDeclareStateMacro( Idle ); 00180 igstkDeclareStateMacro( MRImageSet ); 00181 igstkDeclareStateMacro( USImageSet ); 00182 igstkDeclareStateMacro( ImagesSet ); 00183 igstkDeclareStateMacro( RegistrationCalculated ); 00184 00186 igstkDeclareInputMacro( ResetRegistration ); 00187 igstkDeclareInputMacro( ValidMovingMR3D ); 00188 igstkDeclareInputMacro( ValidFixedUS3D ); 00189 igstkDeclareInputMacro( MRImageTransform ); 00190 igstkDeclareInputMacro( USImageTransform ); 00191 igstkDeclareInputMacro( ValidRegistration ); 00192 igstkDeclareInputMacro( CalculateRegistration ); 00193 igstkDeclareInputMacro( RequestRegistrationTransform ); 00194 00195 00197 igstkLoadedEventTransductionMacro( CoordinateSystemTransformTo, 00198 MRImageTransform ); 00199 igstkLoadedEventTransductionMacro( CoordinateSystemTransformTo , 00200 USImageTransform ); 00201 00203 TransformType m_RegistrationTransform; 00204 00206 bool m_ValidMR3DImageToUS3DImageRegistration; 00207 00209 ErrorType m_RootMeanSquareError; 00210 00211 USImageObject* m_USFixedImageToBeSet; 00212 USImageObject* m_USFixedImage; 00213 MRImageSpatialObject* m_MRMovingImageToBeSet; 00214 MRImageSpatialObject* m_MRMovingImage; 00215 TransformType m_InitialTransform; 00216 00217 }; 00218 00219 } 00220 00221 #endif // _igstkUltrasoundCalibration_h