itkLevelSetMotionRegistrationFunction.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkLevelSetMotionRegistrationFunction_h
00018 #define __itkLevelSetMotionRegistrationFunction_h
00019
00020 #include "itkPDEDeformableRegistrationFunction.h"
00021 #include "itkPoint.h"
00022 #include "itkVector.h"
00023 #include "itkCovariantVector.h"
00024 #include "itkInterpolateImageFunction.h"
00025 #include "itkLinearInterpolateImageFunction.h"
00026 #include "itkSmoothingRecursiveGaussianImageFilter.h"
00027
00028 namespace itk {
00029
00053 template<class TFixedImage, class TMovingImage, class TDeformationField>
00054 class ITK_EXPORT LevelSetMotionRegistrationFunction :
00055 public PDEDeformableRegistrationFunction< TFixedImage,
00056 TMovingImage,
00057 TDeformationField>
00058 {
00059 public:
00060
00062 typedef LevelSetMotionRegistrationFunction Self;
00063 typedef PDEDeformableRegistrationFunction< TFixedImage,
00064 TMovingImage, TDeformationField
00065 >
00066 Superclass;
00067 typedef SmartPointer<Self> Pointer;
00068 typedef SmartPointer<const Self> ConstPointer;
00069
00071 itkNewMacro(Self);
00072
00074 itkTypeMacro( LevelSetMotionRegistrationFunction,
00075 PDEDeformableRegistrationFunction );
00076
00078 typedef typename Superclass::MovingImageType MovingImageType;
00079 typedef typename Superclass::MovingImagePointer MovingImagePointer;
00080 typedef typename MovingImageType::SpacingType MovingSpacingType;
00081
00083 typedef typename Superclass::FixedImageType FixedImageType;
00084 typedef typename Superclass::FixedImagePointer FixedImagePointer;
00085 typedef typename FixedImageType::IndexType IndexType;
00086 typedef typename FixedImageType::SizeType SizeType;
00087 typedef typename FixedImageType::SpacingType SpacingType;
00088
00090 typedef typename Superclass::DeformationFieldType DeformationFieldType;
00091 typedef typename Superclass::DeformationFieldTypePointer
00092 DeformationFieldTypePointer;
00093
00095 itkStaticConstMacro(ImageDimension, unsigned
00096 int,Superclass::ImageDimension);
00097
00099 typedef typename Superclass::PixelType PixelType;
00100 typedef typename Superclass::RadiusType RadiusType;
00101 typedef typename Superclass::NeighborhoodType NeighborhoodType;
00102 typedef typename Superclass::FloatOffsetType FloatOffsetType;
00103 typedef typename Superclass::TimeStepType TimeStepType;
00104
00106 typedef double CoordRepType;
00107 typedef InterpolateImageFunction<MovingImageType,CoordRepType>
00108 InterpolatorType;
00109 typedef typename InterpolatorType::Pointer InterpolatorPointer;
00110 typedef typename InterpolatorType::PointType PointType;
00111 typedef LinearInterpolateImageFunction<MovingImageType,CoordRepType>
00112 DefaultInterpolatorType;
00113
00115 typedef Vector<double,itkGetStaticConstMacro(ImageDimension)> VectorType;
00116 typedef CovariantVector<double,itkGetStaticConstMacro(ImageDimension)>
00117 CovariantVectorType;
00119
00121 typedef SmoothingRecursiveGaussianImageFilter<MovingImageType>
00122 MovingImageSmoothingFilterType;
00123 typedef typename MovingImageSmoothingFilterType::Pointer
00124 MovingImageSmoothingFilterPointer;
00125
00127 void SetMovingImageInterpolator( InterpolatorType * ptr )
00128 { m_MovingImageInterpolator = ptr; }
00129
00131 InterpolatorType * GetMovingImageInterpolator(void)
00132 { return m_MovingImageInterpolator; }
00133
00136 virtual TimeStepType ComputeGlobalTimeStep(void * GlobalData) const;
00137
00140 virtual void *GetGlobalDataPointer() const
00141 {
00142 GlobalDataStruct *global = new GlobalDataStruct();
00143 global->m_SumOfSquaredDifference = 0.0;
00144 global->m_NumberOfPixelsProcessed = 0L;
00145 global->m_SumOfSquaredChange = 0;
00146 global->m_MaxL1Norm = NumericTraits<double>::NonpositiveMin();
00147 return global;
00148 }
00150
00152 virtual void ReleaseGlobalDataPointer( void *GlobalData ) const;
00153
00155 virtual void InitializeIteration();
00156
00159 virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood,
00160 void *globalData,
00161 const FloatOffsetType &offset =
00162 FloatOffsetType(0.0));
00163
00167 virtual double GetMetric() const
00168 { return m_Metric; }
00169
00171 virtual double GetRMSChange() const
00172 { return m_RMSChange; }
00173
00180 virtual void SetAlpha(double);
00181 virtual double GetAlpha() const;
00183
00188 virtual void SetIntensityDifferenceThreshold(double);
00189 virtual double GetIntensityDifferenceThreshold() const;
00191
00194 virtual void SetGradientMagnitudeThreshold(double);
00195 virtual double GetGradientMagnitudeThreshold() const;
00197
00200 virtual void SetGradientSmoothingStandardDeviations(double);
00201 virtual double GetGradientSmoothingStandardDeviations() const;
00203
00207 void SetUseImageSpacing( bool);
00208 bool GetUseImageSpacing() const;
00210
00211
00212 protected:
00213 LevelSetMotionRegistrationFunction();
00214 ~LevelSetMotionRegistrationFunction() {}
00215 void PrintSelf(std::ostream& os, Indent indent) const;
00216
00218 typedef ConstNeighborhoodIterator<FixedImageType>
00219 FixedImageNeighborhoodIteratorType;
00220
00223 struct GlobalDataStruct
00224 {
00225 double m_SumOfSquaredDifference;
00226 unsigned long m_NumberOfPixelsProcessed;
00227 double m_SumOfSquaredChange;
00228 double m_MaxL1Norm;
00229 };
00230
00231 private:
00232 LevelSetMotionRegistrationFunction(const Self&);
00233 void operator=(const Self&);
00234
00236 SpacingType m_FixedImageSpacing;
00237 PointType m_FixedImageOrigin;
00238
00240 MovingImageSmoothingFilterPointer m_MovingImageSmoothingFilter;
00241
00243 InterpolatorPointer m_MovingImageInterpolator;
00244 InterpolatorPointer m_SmoothMovingImageInterpolator;
00245
00248 double m_Alpha;
00249
00251 double m_GradientMagnitudeThreshold;
00252
00254 double m_IntensityDifferenceThreshold;
00255
00257 double m_GradientSmoothingStandardDeviations;
00258
00262 mutable double m_Metric;
00263 mutable double m_SumOfSquaredDifference;
00264 mutable unsigned long m_NumberOfPixelsProcessed;
00265 mutable double m_RMSChange;
00266 mutable double m_SumOfSquaredChange;
00267
00269 mutable SimpleFastMutexLock m_MetricCalculationLock;
00270
00271 bool m_UseImageSpacing;
00272 };
00273
00274
00275 }
00276
00277 #ifndef ITK_MANUAL_INSTANTIATION
00278 #include "itkLevelSetMotionRegistrationFunction.txx"
00279 #endif
00280
00281 #endif
00282