ITK  4.2.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< class TFixedImage, class TMovingImage, class TDisplacementField >
53 class ITK_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;
82  typedef typename FixedImageType::IndexType IndexType;
83  typedef typename FixedImageType::SizeType SizeType;
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 
127  void SetMovingImageInterpolator(InterpolatorType *ptr)
128  { m_MovingImageInterpolator = ptr; }
129 
131  InterpolatorType * GetMovingImageInterpolator(void)
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 private:
208  DemonsRegistrationFunction(const Self &); //purposely not implemented
209  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
256