ITK  4.2.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< class TFixedImage, class TMovingImage, class 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 
82  typedef typename Superclass::MovingImageType MovingImageType;
83  typedef typename Superclass::MovingImagePointer MovingImagePointer;
84  typedef typename MovingImageType::PixelType MovingPixelType;
85 
88  typedef typename Superclass::FixedImagePointer FixedImagePointer;
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 
95  typedef typename Superclass::DisplacementFieldType DisplacementFieldType;
96  typedef typename Superclass::DisplacementFieldTypePointer
98 
100  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
101 
107  typedef typename Superclass::TimeStepType TimeStepType;
108 
110  typedef double CoordRepType;
111  typedef InterpolateImageFunction<
117 
119  typedef WarpImageFilter<
122 
124 
127 
131 
137 
139  void SetMovingImageInterpolator(InterpolatorType *ptr)
140  { m_MovingImageInterpolator = ptr; m_MovingImageWarper->SetInterpolator(ptr); }
141 
143  InterpolatorType * GetMovingImageInterpolator(void)
144  { return m_MovingImageInterpolator; }
145 
147  virtual TimeStepType ComputeGlobalTimeStep( void *itkNotUsed(GlobalData) ) const
148  { return m_TimeStep; }
149 
152  virtual void * GetGlobalDataPointer() const
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;
164 
166  virtual void InitializeIteration();
167 
170  virtual PixelType ComputeUpdate( const NeighborhoodType & neighborhood,
171  void *globalData,
172  const FloatOffsetType & offset = FloatOffsetType(0.0) );
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 
207  Symmetric = 0,
208  Fixed = 1,
209  WarpedMoving = 2,
210  MappedMoving = 3
211  };
212 
214  virtual void SetUseGradientType(GradientType gtype)
215  { m_UseGradientType = gtype; }
216  virtual GradientType GetUseGradientType() const
217  { return m_UseGradientType; }
218 protected:
221  void PrintSelf(std::ostream & os, Indent indent) const;
223 
226 
233  };
234 private:
235  ESMDemonsRegistrationFunction(const Self &); //purposely not implemented
236  void operator=(const Self &); //purposely not implemented
238 
243  double m_Normalizer;
244 
247 
250 
252 
255 
258 
261 
264 
267 
270 
274  mutable double m_Metric;
275  mutable double m_SumOfSquaredDifference;
277  mutable double m_RMSChange;
278  mutable double m_SumOfSquaredChange;
279 
282 };
283 } // end namespace itk
284 
285 #ifndef ITK_MANUAL_INSTANTIATION
286 #include "itkESMDemonsRegistrationFunction.hxx"
287 #endif
288 
289 #endif
290