ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkDiffeomorphicDemonsRegistrationFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkDiffeomorphicDemonsRegistrationFilter_h
19 #define itkDiffeomorphicDemonsRegistrationFilter_h
20 
23 
24 #include "itkMultiplyImageFilter.h"
26 
27 namespace itk
28 {
77 template< typename TFixedImage, typename TMovingImage, typename TDisplacementField >
78 class ITK_TEMPLATE_EXPORT DiffeomorphicDemonsRegistrationFilter:
79  public PDEDeformableRegistrationFilter< TFixedImage, TMovingImage,
80  TDisplacementField >
81 {
82 public:
88 
90  itkNewMacro(Self);
91 
94 
96  typedef typename Superclass::FixedImageType FixedImageType;
97  typedef typename Superclass::FixedImagePointer FixedImagePointer;
98 
100  typedef typename Superclass::MovingImageType MovingImageType;
101  typedef typename Superclass::MovingImagePointer MovingImagePointer;
102 
104  typedef typename Superclass::DisplacementFieldType DisplacementFieldType;
105  typedef typename Superclass::DisplacementFieldPointer DisplacementFieldPointer;
106 #ifdef ITKV3_COMPATIBILITY
107  typedef typename Superclass::DeformationFieldType DeformationFieldType;
108  typedef typename Superclass::DeformationFieldPointer DeformationFieldPointer;
109 #endif
110 
112  typedef typename Superclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType;
113 
115  typedef typename FiniteDifferenceFunctionType::TimeStepType TimeStepType;
116 
121 
122  itkStaticConstMacro(
123  ImageDimension, unsigned int, FixedImageType::ImageDimension);
124 
129  virtual double GetMetric() const;
130 
131  virtual const double & GetRMSChange() const ITK_OVERRIDE;
132 
133  virtual void SetUseGradientType(GradientType gtype);
134 
135  virtual GradientType GetUseGradientType() const;
136 
140  itkSetMacro(UseFirstOrderExp, bool);
141  itkGetConstMacro(UseFirstOrderExp, bool);
142  itkBooleanMacro(UseFirstOrderExp);
144 
149  virtual void SetIntensityDifferenceThreshold(double);
150 
151  virtual double GetIntensityDifferenceThreshold() const;
152 
155  virtual void SetMaximumUpdateStepLength(double);
156 
157  virtual double GetMaximumUpdateStepLength() const;
158 
159 protected:
161  ~DiffeomorphicDemonsRegistrationFilter() ITK_OVERRIDE {}
162  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
163 
165  virtual void InitializeIteration() ITK_OVERRIDE;
166 
169  virtual void AllocateUpdateBuffer() ITK_OVERRIDE;
170 
172  virtual void ApplyUpdate(const TimeStepType& dt) ITK_OVERRIDE;
173 
174 private:
175  ITK_DISALLOW_COPY_AND_ASSIGN(DiffeomorphicDemonsRegistrationFilter);
176 
179  DemonsRegistrationFunctionType * DownCastDifferenceFunctionType();
180 
181  const DemonsRegistrationFunctionType * DownCastDifferenceFunctionType() const;
182 
184  typedef MultiplyImageFilter< DisplacementFieldType,
185  itk::Image<TimeStepType, ImageDimension>,
186  DisplacementFieldType > MultiplyByConstantType;
187 
189  DisplacementFieldType, DisplacementFieldType > FieldExponentiatorType;
190 
191  typedef WarpVectorImageFilter<
192  DisplacementFieldType,
193  DisplacementFieldType, DisplacementFieldType > VectorWarperType;
194 
196  DisplacementFieldType, double > FieldInterpolatorType;
197 
198  typedef AddImageFilter<
199  DisplacementFieldType,
200  DisplacementFieldType, DisplacementFieldType > AdderType;
201 
202  typedef typename MultiplyByConstantType::Pointer MultiplyByConstantPointer;
203  typedef typename FieldExponentiatorType::Pointer FieldExponentiatorPointer;
204  typedef typename VectorWarperType::Pointer VectorWarperPointer;
205  typedef typename FieldInterpolatorType::Pointer FieldInterpolatorPointer;
206  typedef typename FieldInterpolatorType::OutputType FieldInterpolatorOutputType;
207  typedef typename AdderType::Pointer AdderPointer;
208 
209  MultiplyByConstantPointer m_Multiplier;
210  FieldExponentiatorPointer m_Exponentiator;
211  VectorWarperPointer m_Warper;
212  AdderPointer m_Adder;
213  bool m_UseFirstOrderExp;
214 };
215 } // end namespace itk
216 
217 #ifndef ITK_MANUAL_INSTANTIATION
218 #include "itkDiffeomorphicDemonsRegistrationFilter.hxx"
219 #endif
220 
221 #endif
DemonsRegistrationFunctionType::GradientType GradientType
Pixel-wise addition of two images.
Light weight base class for most itk classes.
Superclass::FiniteDifferenceFunctionType FiniteDifferenceFunctionType
Warps an image using an input displacement field.
Computes a diffeomorphic displacement field as the Lie group exponential of a vector field...
Deformably register two images using a diffeomorphic demons algorithm.
Deformably register two images using a PDE algorithm.
PDEDeformableRegistrationFilter< TFixedImage, TMovingImage, TDisplacementField > Superclass
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Pixel-wise multiplication of two images.
ESMDemonsRegistrationFunction< FixedImageType, MovingImageType, DisplacementFieldType > DemonsRegistrationFunctionType
Templated n-dimensional image class.
Definition: itkImage.h:75
Fast implementation of the symmetric demons registration force.