|
Slicer 4.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: BSplineRegistrator.h,v $ 00005 Language: C++ 00006 Date: $Date: 2006/11/06 14:39:34 $ 00007 Version: $Revision: 1.15 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/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 __BSplineImageToImageRegistrationMethod_h 00019 #define __BSplineImageToImageRegistrationMethod_h 00020 00021 #include "itkImage.h" 00022 #include "itkBSplineDeformableTransform.h" 00023 00024 #include "itkOptimizedImageToImageRegistrationMethod.h" 00025 00026 namespace itk 00027 { 00028 00029 template <class TImage> 00030 class BSplineImageToImageRegistrationMethod 00031 : public OptimizedImageToImageRegistrationMethod<TImage> 00032 { 00033 00034 public: 00035 00036 typedef BSplineImageToImageRegistrationMethod Self; 00037 typedef OptimizedImageToImageRegistrationMethod<TImage> Superclass; 00038 typedef SmartPointer<Self> Pointer; 00039 typedef SmartPointer<const Self> ConstPointer; 00040 00041 itkTypeMacro( BSplineImageToImageRegistrationMethod, 00042 OptimizedImageToImageRegistrationMethod ); 00043 00044 itkNewMacro( Self ); 00045 00046 // 00047 // Typedefs from Superclass 00048 // 00049 typedef TImage ImageType; 00050 itkStaticConstMacro( ImageDimension, unsigned int, 00051 TImage::ImageDimension ); 00052 00053 // Overrides the superclass' TransformType typedef 00054 typedef BSplineDeformableTransform<double, 00055 itkGetStaticConstMacro( ImageDimension ), 00056 itkGetStaticConstMacro( ImageDimension )> 00057 BSplineTransformType; 00058 00059 typedef typename BSplineTransformType::Pointer BSplineTransformPointer; 00060 00061 typedef BSplineTransformType TransformType; 00062 00063 typedef typename BSplineTransformType::ParametersType ParametersType; 00064 00065 // 00066 // Methods from Superclass 00067 // 00068 00069 virtual void GenerateData( void ); 00070 00071 // 00072 // Custom Methods 00073 // 00074 00081 virtual TransformType * GetTypedTransform( void ); 00082 00083 virtual const TransformType * GetTypedTransform( void ) const; 00084 00085 itkSetMacro( ExpectedDeformationMagnitude, double ); 00086 itkGetConstMacro( ExpectedDeformationMagnitude, double ); 00087 00088 itkSetClampMacro( NumberOfControlPoints, unsigned int, 3, 2000 ); 00089 itkGetConstMacro( NumberOfControlPoints, unsigned int ); 00090 00091 itkSetClampMacro( NumberOfLevels, unsigned int, 1, 5 ); 00092 itkGetConstMacro( NumberOfLevels, unsigned int ); 00093 00094 BSplineTransformPointer GetBSplineTransform( void ) const; 00095 00096 void ComputeGridRegion( int numberOfControlPoints, 00097 typename TransformType::RegionType::SizeType & regionSize, 00098 typename TransformType::SpacingType & regionSpacing, 00099 typename TransformType::OriginType & regionOrigin, 00100 typename TransformType::DirectionType & regionDirection); 00101 00102 void ResampleControlGrid( int newNumberOfControlPoints, ParametersType & newParameters ); 00103 00104 itkSetMacro( GradientOptimizeOnly, bool ); 00105 itkGetMacro( GradientOptimizeOnly, bool ); 00106 protected: 00107 00108 BSplineImageToImageRegistrationMethod( void ); 00109 virtual ~BSplineImageToImageRegistrationMethod( void ); 00110 00111 typedef InterpolateImageFunction<TImage, double> InterpolatorType; 00112 typedef ImageToImageMetric<TImage, TImage> MetricType; 00113 00114 virtual void Optimize( MetricType * metric, InterpolatorType * interpolator ); 00115 00116 virtual void GradientOptimize( MetricType * metric, InterpolatorType * interpolator ); 00117 00118 virtual void MultiResolutionOptimize( MetricType * metric, InterpolatorType * interpolator ); 00119 00120 virtual void PrintSelf( std::ostream & os, Indent indent ) const; 00121 00122 private: 00123 00124 BSplineImageToImageRegistrationMethod( const Self & ); // Purposely not implemented 00125 void operator =( const Self & ); // Purposely not implemented 00126 00127 double m_ExpectedDeformationMagnitude; 00128 00129 unsigned int m_NumberOfControlPoints; 00130 00131 unsigned int m_NumberOfLevels; 00132 00133 bool m_GradientOptimizeOnly; 00134 00135 }; 00136 00137 } // end namespace itk 00138 00139 #ifndef ITK_MANUAL_INSTANTIATION 00140 #include "itkBSplineImageToImageRegistrationMethod.txx" 00141 #endif 00142 00143 #endif // __ImageToImageRegistrationMethod_h
1.7.4