ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkESMDemonsRegistrationFunction.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 itkESMDemonsRegistrationFunction_h
19 #define itkESMDemonsRegistrationFunction_h
20 
23 #include "itkWarpImageFilter.h"
24 
25 namespace itk
26 {
59 template< typename TFixedImage, typename TMovingImage, typename TDisplacementField >
60 class ITK_TEMPLATE_EXPORT ESMDemonsRegistrationFunction:
61  public PDEDeformableRegistrationFunction< TFixedImage,
62  TMovingImage, TDisplacementField >
63 {
64 public:
65 
69  TFixedImage, TMovingImage, TDisplacementField > Superclass;
70 
73 
75  itkNewMacro(Self);
76 
78  itkTypeMacro(ESMDemonsRegistrationFunction,
80 
83  typedef typename Superclass::MovingImagePointer MovingImagePointer;
84  typedef typename MovingImageType::PixelType MovingPixelType;
85 
88  typedef typename Superclass::FixedImagePointer FixedImagePointer;
91  typedef typename FixedImageType::SpacingType SpacingType;
93 
95  typedef typename Superclass::DisplacementFieldType DisplacementFieldType;
96  typedef typename Superclass::DisplacementFieldTypePointer
98 
100  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
101 
107  typedef typename Superclass::TimeStepType TimeStepType;
108 
110  typedef double CoordRepType;
111  typedef InterpolateImageFunction<
117 
119  typedef WarpImageFilter<
122 
124 
127 
131 
137 
140  { m_MovingImageInterpolator = ptr; m_MovingImageWarper->SetInterpolator(ptr); }
141 
144  { return m_MovingImageInterpolator; }
145 
147  virtual TimeStepType ComputeGlobalTimeStep( void *itkNotUsed(GlobalData) ) const ITK_OVERRIDE
148  { return m_TimeStep; }
149 
152  virtual void * GetGlobalDataPointer() const ITK_OVERRIDE
153  {
154  GlobalDataStruct *global = new GlobalDataStruct();
155 
156  global->m_SumOfSquaredDifference = 0.0;
157  global->m_NumberOfPixelsProcessed = 0L;
158  global->m_SumOfSquaredChange = 0;
159  return global;
160  }
161 
163  virtual void ReleaseGlobalDataPointer(void *GlobalData) const ITK_OVERRIDE;
164 
166  virtual void InitializeIteration() ITK_OVERRIDE;
167 
170  virtual PixelType ComputeUpdate( const NeighborhoodType & neighborhood,
171  void *globalData,
172  const FloatOffsetType & offset = FloatOffsetType(0.0) ) ITK_OVERRIDE;
173 
177  virtual double GetMetric() const
178  { return m_Metric; }
179 
181  virtual const double & GetRMSChange() const
182  { return m_RMSChange; }
183 
188  virtual void SetIntensityDifferenceThreshold(double);
189 
190  virtual double GetIntensityDifferenceThreshold() const;
191 
195  virtual void SetMaximumUpdateStepLength(double sm)
196  {
197  this->m_MaximumUpdateStepLength = sm;
198  }
199 
200  virtual double GetMaximumUpdateStepLength() const
201  {
202  return this->m_MaximumUpdateStepLength;
203  }
204 
207  Symmetric = 0,
208  Fixed = 1,
209  WarpedMoving = 2,
210  MappedMoving = 3
211  };
212 
214  virtual void SetUseGradientType(GradientType gtype)
215  { m_UseGradientType = gtype; }
217  { return m_UseGradientType; }
219 
220 protected:
223  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
224 
227 
234  };
235 
236 private:
237  ITK_DISALLOW_COPY_AND_ASSIGN(ESMDemonsRegistrationFunction);
238 
243  double m_Normalizer;
244 
247 
250 
252 
255 
258 
260 
263 
266 
269 
272 
276  mutable double m_Metric;
277  mutable double m_SumOfSquaredDifference;
279  mutable double m_RMSChange;
280  mutable double m_SumOfSquaredChange;
281 
284 };
285 } // end namespace itk
286 
287 #ifndef ITK_MANUAL_INSTANTIATION
288 #include "itkESMDemonsRegistrationFunction.hxx"
289 #endif
290 
291 #endif
Critical section locking class that can be allocated on the stack.
ConstNeighborhoodIterator< FixedImageType > FixedImageNeighborhoodIteratorType
Light weight base class for most itk classes.
CentralDifferenceImageFunction< FixedImageType > GradientCalculatorType
Superclass::MovingImagePointer MovingImagePointer
virtual TimeStepType ComputeGlobalTimeStep(void *) const override
LinearInterpolateImageFunction< MovingImageType, CoordRepType > DefaultInterpolatorType
ConstNeighborhoodIterator< TDisplacementField >::RadiusType RadiusType
virtual void SetUseGradientType(GradientType gtype)
Calculate the derivative by central differencing.
CentralDifferenceImageFunction< MovingImageType, CoordRepType > MovingImageGradientCalculatorType
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
unsigned long SizeValueType
Definition: itkIntTypes.h:143
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
MovingImageGradientCalculatorPointer m_MappedMovingImageGradientCalculator
Warps an image using an input displacement field.
Linearly interpolate an image at specified positions.
PDEDeformableRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField > Superclass
Base class for all image interpolaters.
InterpolateImageFunction< MovingImageType, CoordRepType > InterpolatorType
virtual void * GetGlobalDataPointer() const override
Superclass::DisplacementFieldTypePointer DisplacementFieldTypePointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
WarpImageFilter< MovingImageType, MovingImageType, DisplacementFieldType > WarperType
Superclass::DisplacementFieldType DisplacementFieldType
A templated class holding a n-Dimensional covariant vector.
MovingImageGradientCalculatorType::Pointer MovingImageGradientCalculatorPointer
Fast implementation of the symmetric demons registration force.
GradientCalculatorType::Pointer GradientCalculatorPointer
CovariantVector< double, itkGetStaticConstMacro(ImageDimension) > CovariantVectorType