ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkFastSymmetricForcesDemonsRegistrationFunction.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 itkFastSymmetricForcesDemonsRegistrationFunction_h
19 #define itkFastSymmetricForcesDemonsRegistrationFunction_h
20 
22 #include "itkPoint.h"
25 #include "itkWarpImageFilter.h"
26 #include <mutex>
27 
28 namespace itk
29 {
46 template< typename TFixedImage, typename TMovingImage, typename TDisplacementField >
48  public PDEDeformableRegistrationFunction< TFixedImage,
49  TMovingImage, TDisplacementField >
50 {
51 public:
52  ITK_DISALLOW_COPY_AND_ASSIGN(FastSymmetricForcesDemonsRegistrationFunction);
53 
56  using Superclass = PDEDeformableRegistrationFunction< TFixedImage,
57  TMovingImage, TDisplacementField >;
60 
62  itkNewMacro(Self);
63 
67 
69  using MovingImageType = typename Superclass::MovingImageType;
70  using MovingImagePointer = typename Superclass::MovingImagePointer;
71 
73  using FixedImageType = typename Superclass::FixedImageType;
74  using FixedImagePointer = typename Superclass::FixedImagePointer;
77  using SpacingType = typename FixedImageType::SpacingType;
78 
80  using DisplacementFieldType = typename Superclass::DisplacementFieldType;
81  using DisplacementFieldTypePointer = typename Superclass::DisplacementFieldTypePointer;
82 
84  static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
85 
87  using PixelType = typename Superclass::PixelType;
91  using TimeStepType = typename Superclass::TimeStepType;
92 
94  using CoordRepType = double;
99 
103 
106 
110 
113 
116  {
117  m_MovingImageInterpolator = ptr; m_MovingImageWarper->SetInterpolator(ptr);
118  }
119 
122  {
123  return m_MovingImageInterpolator;
124  }
125 
127  TimeStepType ComputeGlobalTimeStep( void *itkNotUsed(GlobalData) ) const override
128  {
129  return m_TimeStep;
130  }
131 
134  void * GetGlobalDataPointer() const override
135  {
136  auto * global = new GlobalDataStruct();
137 
138  global->m_SumOfSquaredDifference = 0.0;
139  global->m_NumberOfPixelsProcessed = 0L;
140  global->m_SumOfSquaredChange = 0;
141  return global;
142  }
143 
145  void ReleaseGlobalDataPointer(void *GlobalData) const override;
146 
148  void InitializeIteration() override;
149 
152  PixelType ComputeUpdate( const NeighborhoodType & neighborhood,
153  void *globalData,
154  const FloatOffsetType & offset = FloatOffsetType(0.0) ) override;
155 
159  virtual double GetMetric() const
160  {
161  return m_Metric;
162  }
163 
165  virtual const double & GetRMSChange() const
166  {
167  return m_RMSChange;
168  }
169 
174  virtual void SetIntensityDifferenceThreshold(double);
175 
176  virtual double GetIntensityDifferenceThreshold() const;
177 
178 protected:
180  ~FastSymmetricForcesDemonsRegistrationFunction() override = default;
181  void PrintSelf(std::ostream & os, Indent indent) const override;
182 
185 
192  };
193 
194 private:
196  double m_Normalizer;
197 
200 
203 
206 
209 
212 
215 
218 
222  mutable double m_Metric;
223  mutable double m_SumOfSquaredDifference;
225  mutable double m_RMSChange;
226  mutable double m_SumOfSquaredChange;
227 
229  mutable std::mutex m_MetricCalculationLock;
230 };
231 } // end namespace itk
232 
233 #ifndef ITK_MANUAL_INSTANTIATION
234 #include "itkFastSymmetricForcesDemonsRegistrationFunction.hxx"
235 #endif
236 
237 #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
Warps an image using an input displacement field.
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.