00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __freFEMRegistrationProcessor_h
00023 #define __freFEMRegistrationProcessor_h
00024
00025 #include "freImageRegistrationProcessorBase.h"
00026
00027 #include "fstream"
00028
00029 #include "freControllerCentral.h"
00030 #include "freRegistrationObserver.h"
00031
00032 #include "itkFEM.h"
00033 #include "itkFEMRegistrationFilter.h"
00034 #include "itkHistogramMatchingImageFilter.h"
00035
00036 namespace FREE
00037 {
00038
00055 template <unsigned int VImageDimension>
00056 class FEMRegistrationProcessor
00057 : public ImageRegistrationProcessorBase<VImageDimension>
00058 {
00059 public:
00061 typedef FEMRegistrationProcessor<VImageDimension> Self;
00062 typedef ImageRegistrationProcessorBase<VImageDimension> Superclass;
00063 typedef itk::SmartPointer<Self> Pointer;
00064 typedef itk::SmartPointer<const Self> ConstPointer;
00065
00066 typedef typename Superclass::ImageType ImageType;
00067 typedef typename Superclass::ImagePointer ImagePointer;
00068 typedef typename Superclass::RegionType RegionType;
00069 typedef typename Superclass::SpacingType SpacingType;
00070 typedef typename Superclass::PointType PointType;
00071 typedef typename Superclass::TransformFieldType TransformFieldType;
00072 typedef typename Superclass::TransformFieldPointer TransformFieldPointer;
00073
00075 itkTypeMacro( FEMRegistrationProcessor, ImageRegistrationProcessorBase );
00076
00078 itkNewMacro(Self);
00079
00080
00082 typedef itk::ImageToImageMetric< ImageType, ImageType > MetricType;
00084 typedef typename MetricType::Pointer MetricPointer;
00086 typedef itk::fem::FEMRegistrationFilter< ImageType, ImageType > RegistrationType;
00088 typedef typename RegistrationType::Pointer RegistrationPointer;
00090 typedef itk::HistogramMatchingImageFilter<ImageType, ImageType > HistoMatchFilterType;
00091
00093 typedef itk::fem::Element2DC0LinearQuadrilateralMembrane Element2DType;
00095 typedef itk::fem::Element2DC0LinearTriangularMembrane Element2DType2;
00096
00098 typedef itk::fem::Element3DC0LinearHexahedronMembrane Element3DType;
00100 typedef itk::fem::Element3DC0LinearTetrahedronMembrane Element3DType2;
00101
00102 typedef itk::fem::FiniteDifferenceFunctionLoad<ImageType,ImageType> ImageLoadType;
00103
00104
00106 typedef Element2DType::LoadImplementationFunctionPointer LoadImp2DFP;
00107 typedef Element2DType::LoadType Element2DLoadType;
00108
00109 typedef Element2DType2::LoadImplementationFunctionPointer LoadImp2DFP2;
00110 typedef Element2DType2::LoadType Element2DLoadType2;
00111
00112 typedef itk::fem::VisitorDispatcher<Element2DType,Element2DLoadType, LoadImp2DFP>
00113 Dispatcher2DType;
00114
00115 typedef itk::fem::VisitorDispatcher<Element2DType2,Element2DLoadType2, LoadImp2DFP2>
00116 Dispatcher2DType2;
00117
00119 typedef Element3DType::LoadImplementationFunctionPointer LoadImp3DFP;
00120 typedef Element3DType::LoadType Element3DLoadType;
00121
00122 typedef Element3DType2::LoadImplementationFunctionPointer LoadImp3DFP2;
00123 typedef Element3DType2::LoadType Element3DLoadType2;
00124
00125 typedef itk::fem::VisitorDispatcher<Element3DType,Element3DLoadType, LoadImp3DFP>
00126 Dispatcher3DType;
00127
00128 typedef itk::fem::VisitorDispatcher<Element3DType2,Element3DLoadType2, LoadImp3DFP2>
00129 Dispatcher3DType2;
00130
00134 MetricPointer smpMetric;
00135
00141 RegistrationPointer smpRegistration;
00142
00145 IterationObserver::Pointer m_IterationObserver;
00146 typename NotificationEvent<Self>::Pointer m_IterationNotificationEvent;
00147
00150 virtual const int GetResolutionLevelCount() const;
00151
00156 virtual const long GetMaxIterationCount();
00157
00158 protected:
00159 FEMRegistrationProcessor();
00160
00161 virtual ~FEMRegistrationProcessor();
00162
00171 virtual void ComputeRegistration();
00172
00175 void SetRegistrationParameters();
00176
00177 void SaveLandmarksToFile(const std::string& sFileName);
00178
00181 void SetFEMElements();
00182
00183 virtual TransformFieldPointer ComputeTransformationField(const PointType& origin,
00184 const RegionType& region,
00185 const SpacingType& spacing);
00186
00188 void OnNewIteration(void* pSender, long threadID) ;
00189 };
00190
00193 typedef FEMRegistrationProcessor<2> FEMRegistrationProcessor2D;
00195 typedef FEMRegistrationProcessor<3> FEMRegistrationProcessor3D;
00196
00197 }
00198
00199 #ifndef ITK_MANUAL_INSTANTIATION
00200 #include "freFEMRegistrationProcessor.txx"
00201 #endif
00202
00203 #endif