ITK  4.8.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 >
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 
78 
82  typedef typename FixedImageType::IndexType IndexType;
83  typedef typename FixedImageType::SizeType SizeType;
84  typedef typename FixedImageType::SpacingType SpacingType;
85 
89 
90 #ifdef ITKV3_COMPATIBILITY
91  typedef typename Superclass::DeformationFieldType DeformationFieldType;
92  typedef typename Superclass::DeformationFieldTypePointer DeformationFieldTypePointer;
93 #endif
94 
96  itkStaticConstMacro(ImageDimension, unsigned
98 
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:
193  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
194 
198 
205  };
206 
207 private:
208  DemonsRegistrationFunction(const Self &); //purposely not implemented
209  void operator=(const Self &); //purposely not implemented
210 
212  //SpacingType m_FixedImageSpacing;
213  //PointType m_FixedImageOrigin;
215  double m_Normalizer;
216 
219 
223 
226 
229 
232 
235 
239  mutable double m_Metric;
240  mutable double m_SumOfSquaredDifference;
242  mutable double m_RMSChange;
243  mutable double m_SumOfSquaredChange;
244 
247 };
248 } // end namespace itk
249 
250 #ifndef ITK_MANUAL_INSTANTIATION
251 #include "itkDemonsRegistrationFunction.hxx"
252 #endif
253 
254 #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
virtual void SetIntensityDifferenceThreshold(double)
virtual double GetIntensityDifferenceThreshold() const
Superclass::MovingImageType MovingImageType
Superclass::FixedImagePointer FixedImagePointer
MovingImageGradientCalculatorPointer m_MovingImageGradientCalculator
Superclass::MovingImagePointer MovingImagePointer
ConstNeighborhoodIterator< TDisplacementField >::RadiusType RadiusType
void PrintSelf(std::ostream &os, Indent indent) const override
Calculate the derivative by central differencing.
virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood, void *globalData, const FloatOffsetType &offset=FloatOffsetType(0.0)) override
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
unsigned long SizeValueType
Definition: itkIntTypes.h:143
virtual void InitializeIteration() override
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.
void operator=(const Self &)
virtual void ReleaseGlobalDataPointer(void *GlobalData) const override
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 geometric point in n-Dimensional space.
Definition: itkPoint.h:51
A templated class holding a n-Dimensional covariant vector.
ConstNeighborhoodIterator< FixedImageType > FixedImageNeighborhoodIteratorType