ITK  4.6.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) )
136  const
137  { return m_TimeStep; }
138 
141  virtual void * GetGlobalDataPointer() const
142  {
143  GlobalDataStruct *global = new GlobalDataStruct();
144 
145  global->m_SumOfSquaredDifference = 0.0;
146  global->m_NumberOfPixelsProcessed = 0L;
147  global->m_SumOfSquaredChange = 0;
148  return global;
149  }
150 
152  virtual void ReleaseGlobalDataPointer(void *GlobalData) const;
153 
155  virtual void InitializeIteration();
156 
159  virtual PixelType ComputeUpdate( const NeighborhoodType & neighborhood,
160  void *globalData,
161  const FloatOffsetType & offset =
162  FloatOffsetType(0.0) );
163 
167  virtual double GetMetric() const
168  { return m_Metric; }
169 
171  virtual double GetRMSChange() const
172  { return m_RMSChange; }
173 
177  virtual void SetUseMovingImageGradient(bool flag)
178  { m_UseMovingImageGradient = flag; }
179  virtual bool GetUseMovingImageGradient() const
180  { return m_UseMovingImageGradient; }
182 
187  virtual void SetIntensityDifferenceThreshold(double);
188 
189  virtual double GetIntensityDifferenceThreshold() const;
190 
191 protected:
194  void PrintSelf(std::ostream & os, Indent indent) const;
195 
199 
206  };
207 
208 private:
209  DemonsRegistrationFunction(const Self &); //purposely not implemented
210  void operator=(const Self &); //purposely not implemented
211 
213  //SpacingType m_FixedImageSpacing;
214  //PointType m_FixedImageOrigin;
216  double m_Normalizer;
217 
220 
224 
227 
230 
233 
236 
240  mutable double m_Metric;
241  mutable double m_SumOfSquaredDifference;
243  mutable double m_RMSChange;
244  mutable double m_SumOfSquaredChange;
245 
248 };
249 } // end namespace itk
250 
251 #ifndef ITK_MANUAL_INSTANTIATION
252 #include "itkDemonsRegistrationFunction.hxx"
253 #endif
254 
255 #endif
virtual TimeStepType ComputeGlobalTimeStep(void *) const
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
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
void PrintSelf(std::ostream &os, Indent indent) const
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 &)
PDEDeformableRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField > Superclass
Base class for all image interpolaters.
GradientCalculatorType::Pointer GradientCalculatorPointer
LinearInterpolateImageFunction< MovingImageType, CoordRepType > DefaultInterpolatorType
InterpolateImageFunction< MovingImageType, CoordRepType > InterpolatorType
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
virtual PixelType ComputeUpdate(const NeighborhoodType &neighborhood, void *globalData, const FloatOffsetType &offset=FloatOffsetType(0.0))
virtual void ReleaseGlobalDataPointer(void *GlobalData) const