ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkDemonsRegistrationFunction.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 itkDemonsRegistrationFunction_h
19 #define itkDemonsRegistrationFunction_h
20 
22 #include "itkPoint.h"
25 
26 namespace itk
27 {
52 template< typename TFixedImage, typename TMovingImage, typename TDisplacementField >
53 class ITK_TEMPLATE_EXPORT DemonsRegistrationFunction:
54  public PDEDeformableRegistrationFunction< TFixedImage,
55  TMovingImage,
56  TDisplacementField >
57 {
58 public:
59 
62  typedef PDEDeformableRegistrationFunction< TFixedImage,
63  TMovingImage, TDisplacementField
67 
69  itkNewMacro(Self);
70 
72  itkTypeMacro(DemonsRegistrationFunction,
74 
76  typedef typename Superclass::MovingImageType MovingImageType;
77  typedef typename Superclass::MovingImagePointer MovingImagePointer;
78 
80  typedef typename Superclass::FixedImageType FixedImageType;
81  typedef typename Superclass::FixedImagePointer FixedImagePointer;
84  typedef typename FixedImageType::SpacingType SpacingType;
85 
87  typedef typename Superclass::DisplacementFieldType DisplacementFieldType;
88  typedef typename Superclass::DisplacementFieldTypePointer DisplacementFieldTypePointer;
89 
90 #ifdef ITKV3_COMPATIBILITY
91  typedef typename Superclass::DeformationFieldType DeformationFieldType;
92  typedef typename Superclass::DeformationFieldTypePointer DeformationFieldTypePointer;
93 #endif
94 
96  itkStaticConstMacro(ImageDimension, unsigned
97  int, Superclass::ImageDimension);
98 
104  typedef typename Superclass::TimeStepType TimeStepType;
105 
107  typedef double CoordRepType;
112 
115 
119 
125 
128  { m_MovingImageInterpolator = ptr; }
129 
132  { return m_MovingImageInterpolator; }
133 
135  virtual TimeStepType ComputeGlobalTimeStep( void *itkNotUsed(GlobalData) ) const ITK_OVERRIDE
136  { return m_TimeStep; }
137 
140  virtual void * GetGlobalDataPointer() const ITK_OVERRIDE
141  {
142  GlobalDataStruct *global = new GlobalDataStruct();
143 
144  global->m_SumOfSquaredDifference = 0.0;
145  global->m_NumberOfPixelsProcessed = 0L;
146  global->m_SumOfSquaredChange = 0;
147  return global;
148  }
149 
151  virtual void ReleaseGlobalDataPointer(void *GlobalData) const ITK_OVERRIDE;
152 
154  virtual void InitializeIteration() ITK_OVERRIDE;
155 
158  virtual PixelType ComputeUpdate( const NeighborhoodType & neighborhood,
159  void *globalData,
160  const FloatOffsetType & offset =
161  FloatOffsetType(0.0) ) ITK_OVERRIDE;
162 
166  virtual double GetMetric() const
167  { return m_Metric; }
168 
170  virtual double GetRMSChange() const
171  { return m_RMSChange; }
172 
176  virtual void SetUseMovingImageGradient(bool flag)
177  { m_UseMovingImageGradient = flag; }
178  virtual bool GetUseMovingImageGradient() const
179  { return m_UseMovingImageGradient; }
181 
186  virtual void SetIntensityDifferenceThreshold(double);
187 
188  virtual double GetIntensityDifferenceThreshold() const;
189 
190 protected:
192  ~DemonsRegistrationFunction() ITK_OVERRIDE {}
193  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
194 
198 
205  };
206 
207 private:
208  ITK_DISALLOW_COPY_AND_ASSIGN(DemonsRegistrationFunction);
209 
211  //SpacingType m_FixedImageSpacing;
212  //PointType m_FixedImageOrigin;
214  double m_Normalizer;
215 
218 
222 
225 
228 
231 
234 
238  mutable double m_Metric;
239  mutable double m_SumOfSquaredDifference;
241  mutable double m_RMSChange;
242  mutable double m_SumOfSquaredChange;
243 
246 };
247 } // end namespace itk
248 
249 #ifndef ITK_MANUAL_INSTANTIATION
250 #include "itkDemonsRegistrationFunction.hxx"
251 #endif
252 
253 #endif
void SetMovingImageInterpolator(InterpolatorType *ptr)
MovingImageGradientCalculatorType::Pointer MovingImageGradientCalculatorPointer
Critical section locking class that can be allocated on the stack.
Light weight base class for most itk classes.
CentralDifferenceImageFunction< MovingImageType, CoordRepType > MovingImageGradientCalculatorType
Superclass::MovingImageType MovingImageType
Superclass::FixedImagePointer FixedImagePointer
MovingImageGradientCalculatorPointer m_MovingImageGradientCalculator
Superclass::MovingImagePointer MovingImagePointer
ConstNeighborhoodIterator< TDisplacementField >::RadiusType RadiusType
Calculate the derivative by central differencing.
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
CovariantVector< double, itkGetStaticConstMacro(ImageDimension) > CovariantVectorType
Superclass::DisplacementFieldType DisplacementFieldType
InterpolatorType * GetMovingImageInterpolator(void)
GradientCalculatorPointer m_FixedImageGradientCalculator
Linearly interpolate an image at specified positions.
virtual void * GetGlobalDataPointer() const override
PDEDeformableRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField > Superclass
Base class for all image interpolaters.
GradientCalculatorType::Pointer GradientCalculatorPointer
LinearInterpolateImageFunction< MovingImageType, CoordRepType > DefaultInterpolatorType
InterpolateImageFunction< MovingImageType, CoordRepType > InterpolatorType
virtual TimeStepType ComputeGlobalTimeStep(void *) const override
Superclass::DisplacementFieldTypePointer DisplacementFieldTypePointer
Superclass::NeighborhoodType NeighborhoodType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
CentralDifferenceImageFunction< FixedImageType > GradientCalculatorType
A templated class holding a n-Dimensional covariant vector.
ConstNeighborhoodIterator< FixedImageType > FixedImageNeighborhoodIteratorType