ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkFastSymmetricForcesDemonsRegistrationFilter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkFastSymmetricForcesDemonsRegistrationFilter_h
00019 #define __itkFastSymmetricForcesDemonsRegistrationFilter_h
00020 
00021 #include "itkPDEDeformableRegistrationFilter.h"
00022 #include "itkESMDemonsRegistrationFunction.h"
00023 
00024 #include "itkMultiplyImageFilter.h"
00025 #include "itkExponentialDisplacementFieldImageFilter.h"
00026 
00027 namespace itk
00028 {
00072 template< class TFixedImage, class TMovingImage, class TDisplacementField >
00073 class ITK_EXPORT FastSymmetricForcesDemonsRegistrationFilter:
00074   public PDEDeformableRegistrationFilter< TFixedImage, TMovingImage,
00075                                           TDisplacementField >
00076 {
00077 public:
00079   typedef FastSymmetricForcesDemonsRegistrationFilter                                     Self;
00080   typedef PDEDeformableRegistrationFilter< TFixedImage, TMovingImage, TDisplacementField > Superclass;
00081   typedef SmartPointer< Self >                                                            Pointer;
00082   typedef SmartPointer< const Self >                                                      ConstPointer;
00083 
00085   itkNewMacro(Self);
00086 
00088   itkTypeMacro(FastSymmetricForcesDemonsRegistrationFilter,
00089                PDEDeformableRegistrationFilter);
00090 
00092   typedef typename Superclass::FixedImageType    FixedImageType;
00093   typedef typename Superclass::FixedImagePointer FixedImagePointer;
00094 
00096   typedef typename Superclass::MovingImageType    MovingImageType;
00097   typedef typename Superclass::MovingImagePointer MovingImagePointer;
00098 
00100   typedef typename Superclass::DisplacementFieldType    DisplacementFieldType;
00101   typedef typename Superclass::DisplacementFieldPointer DisplacementFieldPointer;
00102 
00103   itkStaticConstMacro(
00104     ImageDimension, unsigned int, FixedImageType::ImageDimension);
00105 
00110   virtual double GetMetric() const;
00111 
00112   virtual const double & GetRMSChange() const;
00113 
00119   typedef ESMDemonsRegistrationFunction<
00120     FixedImageType,
00121     MovingImageType, DisplacementFieldType >                DemonsRegistrationFunctionType;
00122 
00123   typedef typename DemonsRegistrationFunctionType::GradientType GradientType;
00124   virtual void SetUseGradientType(GradientType gtype);
00125 
00126   virtual GradientType GetUseGradientType() const;
00127 
00132   virtual void SetIntensityDifferenceThreshold(double);
00133 
00134   virtual double GetIntensityDifferenceThreshold() const;
00135 
00136   virtual void SetMaximumUpdateStepLength(double);
00137 
00138   virtual double GetMaximumUpdateStepLength() const;
00139 
00140 protected:
00141   FastSymmetricForcesDemonsRegistrationFilter();
00142   ~FastSymmetricForcesDemonsRegistrationFilter() {}
00143   void PrintSelf(std::ostream & os, Indent indent) const;
00144 
00146   virtual void InitializeIteration();
00147 
00150   virtual void AllocateUpdateBuffer();
00151 
00153   typedef typename
00154   Superclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType;
00155 
00157   typedef typename
00158   FiniteDifferenceFunctionType::TimeStepType TimeStepType;
00159 
00161   virtual void ApplyUpdate(const TimeStepType& dt);
00162 
00164   typedef MultiplyImageFilter<
00165     DisplacementFieldType,
00166     itk::Image<TimeStepType, ImageDimension>,
00167     DisplacementFieldType >                                MultiplyByConstantType;
00168 
00169   typedef AddImageFilter<
00170     DisplacementFieldType,
00171     DisplacementFieldType, DisplacementFieldType >          AdderType;
00172 
00173   typedef typename MultiplyByConstantType::Pointer MultiplyByConstantPointer;
00174   typedef typename AdderType::Pointer              AdderPointer;
00175 private:
00176   FastSymmetricForcesDemonsRegistrationFilter(const Self &); //purposely not
00177                                                              // implemented
00178   void operator=(const Self &);                              //purposely not
00179 
00180   // implemented
00181 
00184   DemonsRegistrationFunctionType *  DownCastDifferenceFunctionType();
00185 
00186   const DemonsRegistrationFunctionType *  DownCastDifferenceFunctionType() const;
00187 
00188   MultiplyByConstantPointer m_Multiplier;
00189   AdderPointer              m_Adder;
00190 };
00191 } // end namespace itk
00192 
00193 #ifndef ITK_MANUAL_INSTANTIATION
00194 #include "itkFastSymmetricForcesDemonsRegistrationFilter.hxx"
00195 #endif
00196 
00197 #endif
00198