ITK  4.9.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 >
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 
84  typedef typename MovingImageType::PixelType MovingPixelType;
85 
89  typedef typename FixedImageType::IndexType IndexType;
90  typedef typename FixedImageType::SizeType SizeType;
91  typedef typename FixedImageType::SpacingType SpacingType;
92  typedef typename FixedImageType::DirectionType DirectionType;
93 
98 
100  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
101 
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 
208  Fixed = 1,
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  ESMDemonsRegistrationFunction(const Self &) ITK_DELETE_FUNCTION;
238  void operator=(const Self &) ITK_DELETE_FUNCTION;
239 
244  double m_Normalizer;
245 
248 
251 
253 
256 
259 
261 
264 
267 
270 
273 
277  mutable double m_Metric;
278  mutable double m_SumOfSquaredDifference;
280  mutable double m_RMSChange;
281  mutable double m_SumOfSquaredChange;
282 
285 };
286 } // end namespace itk
287 
288 #ifndef ITK_MANUAL_INSTANTIATION
289 #include "itkESMDemonsRegistrationFunction.hxx"
290 #endif
291 
292 #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 PixelType ComputeUpdate(const NeighborhoodType &neighborhood, void *globalData, const FloatOffsetType &offset=FloatOffsetType(0.0)) override
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
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void ReleaseGlobalDataPointer(void *GlobalData) const override
virtual double GetIntensityDifferenceThreshold() const
MovingImageGradientCalculatorPointer m_MappedMovingImageGradientCalculator
virtual void InitializeIteration() override
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
virtual void SetIntensityDifferenceThreshold(double)
CovariantVector< double, itkGetStaticConstMacro(ImageDimension) > CovariantVectorType