ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkSymmetricForcesDemonsRegistrationFunction.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 itkSymmetricForcesDemonsRegistrationFunction_h
19 #define itkSymmetricForcesDemonsRegistrationFunction_h
20 
22 #include "itkPoint.h"
25 #include <mutex>
26 
27 namespace itk
28 {
61 template< typename TFixedImage, typename TMovingImage, typename TDisplacementField >
63  public PDEDeformableRegistrationFunction< TFixedImage,
64  TMovingImage, TDisplacementField >
65 {
66 public:
67  ITK_DISALLOW_COPY_AND_ASSIGN(SymmetricForcesDemonsRegistrationFunction);
68 
71  using Superclass = PDEDeformableRegistrationFunction< TFixedImage,
72  TMovingImage, TDisplacementField >;
75 
77  itkNewMacro(Self);
78 
82 
84  using MovingImageType = typename Superclass::MovingImageType;
85  using MovingImagePointer = typename Superclass::MovingImagePointer;
86 
88  using FixedImageType = typename Superclass::FixedImageType;
89  using FixedImagePointer = typename Superclass::FixedImagePointer;
92  using SpacingType = typename FixedImageType::SpacingType;
93 
95  using DisplacementFieldType = typename Superclass::DisplacementFieldType;
96  using DisplacementFieldTypePointer = typename Superclass::DisplacementFieldTypePointer;
97 
99  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
100 
106  using TimeStepType = typename Superclass::TimeStepType;
107 
109  using CoordRepType = double;
114 
117 
121 
124  { m_MovingImageInterpolator = ptr; }
125 
128  { return m_MovingImageInterpolator; }
129 
131  TimeStepType ComputeGlobalTimeStep( void *itkNotUsed(GlobalData) ) const override
132  { return m_TimeStep; }
133 
136  void * GetGlobalDataPointer() const override
137  {
138  auto * global = new GlobalDataStruct();
139 
140  global->m_SumOfSquaredDifference = 0.0;
141  global->m_NumberOfPixelsProcessed = 0L;
142  global->m_SumOfSquaredChange = 0;
143  return global;
144  }
145 
147  void ReleaseGlobalDataPointer(void *GlobalData) const override;
148 
150  void InitializeIteration() override;
151 
154  PixelType ComputeUpdate( const NeighborhoodType & neighborhood,
155  void *globalData,
156  const FloatOffsetType & offset = FloatOffsetType(0.0) ) override;
157 
161  virtual double GetMetric() const
162  { return m_Metric; }
163 
165  virtual const double & GetRMSChange() const
166  { return m_RMSChange; }
167 
172  virtual void SetIntensityDifferenceThreshold(double);
173 
174  virtual double GetIntensityDifferenceThreshold() const;
175 
176 protected:
178  ~SymmetricForcesDemonsRegistrationFunction() override = default;
179  void PrintSelf(std::ostream & os, Indent indent) const override;
180 
183 
190  };
191 
192 private:
196  double m_Normalizer;
197 
200 
203 
206 
209 
212 
216  mutable double m_Metric;
217  mutable double m_SumOfSquaredDifference;
219  mutable double m_RMSChange;
220  mutable double m_SumOfSquaredChange;
221 
223  mutable std::mutex m_MetricCalculationLock;
224 };
225 } // end namespace itk
226 
227 #ifndef ITK_MANUAL_INSTANTIATION
228 #include "itkSymmetricForcesDemonsRegistrationFunction.hxx"
229 #endif
230 
231 #endif
Light weight base class for most itk classes.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
typename DisplacementFieldType::Pointer DisplacementFieldTypePointer
Calculate the derivative by central differencing.
Const version of NeighborhoodIterator, defining iteration of a local N-dimensional neighborhood of pi...
typename ConstNeighborhoodIterator< TDisplacementField >::RadiusType RadiusType
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
typename MovingImageType::ConstPointer MovingImagePointer
Linearly interpolate an image at specified positions.
Base class for all image interpolaters.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
typename FixedImageType::ConstPointer FixedImagePointer
A templated class holding a n-Dimensional covariant vector.