OTB  9.0.0
Orfeo Toolbox
otbNCCRegistrationFunction.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #ifndef otbNCCRegistrationFunction_h
23 #define otbNCCRegistrationFunction_h
24 
25 #include "itkPDEDeformableRegistrationFunction.h"
26 #include "itkPoint.h"
27 #include "itkLinearInterpolateImageFunction.h"
28 #include "itkCentralDifferenceImageFunction.h"
29 
30 namespace otb
31 {
32 
48 template <class TFixedImage, class TMovingImage, class TDisplacementField>
49 class ITK_EXPORT NCCRegistrationFunction : public itk::PDEDeformableRegistrationFunction<TFixedImage, TMovingImage, TDisplacementField>
50 {
51 public:
52 
55  typedef itk::PDEDeformableRegistrationFunction<TFixedImage, TMovingImage, TDisplacementField> Superclass;
56  typedef itk::SmartPointer<Self> Pointer;
57  typedef itk::SmartPointer<const Self> ConstPointer;
58 
60  itkNewMacro(Self);
61 
63  itkTypeMacro(NCCRegistrationFunction, PDEDeformableRegistrationFunction);
64 
66  typedef typename Superclass::MovingImageType MovingImageType;
67  typedef typename Superclass::MovingImagePointer MovingImagePointer;
68 
70  typedef typename Superclass::FixedImageType FixedImageType;
71  typedef typename Superclass::FixedImagePointer FixedImagePointer;
72  typedef typename FixedImageType::IndexType IndexType;
73  typedef typename FixedImageType::SizeType SizeType;
74  typedef typename FixedImageType::SpacingType SpacingType;
75 
77  typedef typename Superclass::DisplacementFieldType DisplacementFieldType;
78  typedef typename Superclass::DisplacementFieldTypePointer DisplacementFieldTypePointer;
79 
81  itkStaticConstMacro(ImageDimension, unsigned int, Superclass::ImageDimension);
82 
84  typedef typename Superclass::PixelType PixelType;
85  typedef typename Superclass::RadiusType RadiusType;
86  typedef typename Superclass::NeighborhoodType NeighborhoodType;
87  // typedef typename Superclass::NeighborhoodType BoundaryNeighborhoodType;
88  typedef typename Superclass::FloatOffsetType FloatOffsetType;
89  typedef typename Superclass::TimeStepType TimeStepType;
90 
92  typedef double CoordRepType;
93  typedef itk::InterpolateImageFunction<MovingImageType, CoordRepType> InterpolatorType;
94  typedef typename InterpolatorType::Pointer InterpolatorPointer;
95  typedef typename InterpolatorType::PointType PointType;
96  typedef itk::LinearInterpolateImageFunction<MovingImageType, CoordRepType> DefaultInterpolatorType;
97 
99  typedef itk::CovariantVector<double, itkGetStaticConstMacro(ImageDimension)> CovariantVectorType;
100 
102  typedef itk::CentralDifferenceImageFunction<FixedImageType> GradientCalculatorType;
103  typedef typename GradientCalculatorType::Pointer GradientCalculatorPointer;
104 
107  {
108  m_MovingImageInterpolator = ptr;
109  }
110 
113  {
114  return m_MovingImageInterpolator;
115  }
116 
118  TimeStepType ComputeGlobalTimeStep(void* itkNotUsed(GlobalData)) const override
119  {
120  return m_TimeStep;
121  }
122 
125  void* GetGlobalDataPointer() const override
126  {
127  GlobalDataStruct* global = new GlobalDataStruct();
128  return global;
129  }
131 
133  void ReleaseGlobalDataPointer(void* GlobalData) const override
134  {
135  delete (GlobalDataStruct*)GlobalData;
136  }
137 
139  void InitializeIteration() override;
140 
143  PixelType ComputeUpdate(const NeighborhoodType& neighborhood, void* globalData, const FloatOffsetType& offset = FloatOffsetType(0.0)) override;
144 
145 protected:
148  {
149  }
150  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
151 
153  typedef itk::ConstNeighborhoodIterator<FixedImageType> FixedImageNeighborhoodIteratorType;
154 
158  {
160  };
161 
162 private:
163  NCCRegistrationFunction(const Self&) = delete;
164  void operator=(const Self&) = delete;
165 
169 
172 
175 
178 
181 
184 
185  mutable double m_MetricTotal;
186 };
187 
188 } // end namespace otb
189 
190 #ifndef OTB_MANUAL_INSTANTIATION
192 #endif
193 
194 #endif
otb::NCCRegistrationFunction::ReleaseGlobalDataPointer
void ReleaseGlobalDataPointer(void *GlobalData) const override
Definition: otbNCCRegistrationFunction.h:133
otb::NCCRegistrationFunction::m_DenominatorThreshold
double m_DenominatorThreshold
Definition: otbNCCRegistrationFunction.h:180
otb::NCCRegistrationFunction::Superclass
itk::PDEDeformableRegistrationFunction< TFixedImage, TMovingImage, TDisplacementField > Superclass
Definition: otbNCCRegistrationFunction.h:55
otb::NCCRegistrationFunction::Self
NCCRegistrationFunction Self
Definition: otbNCCRegistrationFunction.h:54
otb::NCCRegistrationFunction::CoordRepType
double CoordRepType
Definition: otbNCCRegistrationFunction.h:92
otb::NCCRegistrationFunction::NeighborhoodType
Superclass::NeighborhoodType NeighborhoodType
Definition: otbNCCRegistrationFunction.h:86
otb::NCCRegistrationFunction::FixedImagePointer
Superclass::FixedImagePointer FixedImagePointer
Definition: otbNCCRegistrationFunction.h:71
otb::NCCRegistrationFunction::GlobalDataStruct::m_FixedImageIterator
FixedImageNeighborhoodIteratorType m_FixedImageIterator
Definition: otbNCCRegistrationFunction.h:159
otb::NCCRegistrationFunction::m_MetricTotal
double m_MetricTotal
Definition: otbNCCRegistrationFunction.h:185
otbNCCRegistrationFunction.hxx
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::NCCRegistrationFunction::FixedImageType
Superclass::FixedImageType FixedImageType
Definition: otbNCCRegistrationFunction.h:70
otb::NCCRegistrationFunction::m_TimeStep
TimeStepType m_TimeStep
Definition: otbNCCRegistrationFunction.h:177
otb::NCCRegistrationFunction::m_MovingImageInterpolator
InterpolatorPointer m_MovingImageInterpolator
Definition: otbNCCRegistrationFunction.h:174
otb::NCCRegistrationFunction::MovingImagePointer
Superclass::MovingImagePointer MovingImagePointer
Definition: otbNCCRegistrationFunction.h:67
otb::NCCRegistrationFunction::DefaultInterpolatorType
itk::LinearInterpolateImageFunction< MovingImageType, CoordRepType > DefaultInterpolatorType
Definition: otbNCCRegistrationFunction.h:96
otb::NCCRegistrationFunction::FixedImageNeighborhoodIteratorType
itk::ConstNeighborhoodIterator< FixedImageType > FixedImageNeighborhoodIteratorType
Definition: otbNCCRegistrationFunction.h:153
otb::NCCRegistrationFunction::IndexType
FixedImageType::IndexType IndexType
Definition: otbNCCRegistrationFunction.h:72
otb::NCCRegistrationFunction::SpacingType
FixedImageType::SpacingType SpacingType
Definition: otbNCCRegistrationFunction.h:74
otb::NCCRegistrationFunction::GetGlobalDataPointer
void * GetGlobalDataPointer() const override
Definition: otbNCCRegistrationFunction.h:125
otb::NCCRegistrationFunction::TimeStepType
Superclass::TimeStepType TimeStepType
Definition: otbNCCRegistrationFunction.h:89
otb::NCCRegistrationFunction::RadiusType
Superclass::RadiusType RadiusType
Definition: otbNCCRegistrationFunction.h:85
otb::NCCRegistrationFunction::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbNCCRegistrationFunction.h:56
otb::NCCRegistrationFunction::ComputeGlobalTimeStep
TimeStepType ComputeGlobalTimeStep(void *) const override
Definition: otbNCCRegistrationFunction.h:118
otb::NCCRegistrationFunction::GetMovingImageInterpolator
InterpolatorType * GetMovingImageInterpolator(void)
Definition: otbNCCRegistrationFunction.h:112
otb::NCCRegistrationFunction::SizeType
FixedImageType::SizeType SizeType
Definition: otbNCCRegistrationFunction.h:73
otb::NCCRegistrationFunction::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbNCCRegistrationFunction.h:57
otb::NCCRegistrationFunction::DisplacementFieldTypePointer
Superclass::DisplacementFieldTypePointer DisplacementFieldTypePointer
Definition: otbNCCRegistrationFunction.h:78
otb::NCCRegistrationFunction::~NCCRegistrationFunction
~NCCRegistrationFunction() override
Definition: otbNCCRegistrationFunction.h:147
otb::NCCRegistrationFunction::GradientCalculatorPointer
GradientCalculatorType::Pointer GradientCalculatorPointer
Definition: otbNCCRegistrationFunction.h:103
otb::NCCRegistrationFunction::CovariantVectorType
itk::CovariantVector< double, itkGetStaticConstMacro(ImageDimension)> CovariantVectorType
Definition: otbNCCRegistrationFunction.h:99
otb::NCCRegistrationFunction::InterpolatorPointer
InterpolatorType::Pointer InterpolatorPointer
Definition: otbNCCRegistrationFunction.h:94
otb::NCCRegistrationFunction::GradientCalculatorType
itk::CentralDifferenceImageFunction< FixedImageType > GradientCalculatorType
Definition: otbNCCRegistrationFunction.h:102
otb::NCCRegistrationFunction::PointType
InterpolatorType::PointType PointType
Definition: otbNCCRegistrationFunction.h:95
otb::NCCRegistrationFunction::m_FixedImageGradientCalculator
GradientCalculatorPointer m_FixedImageGradientCalculator
Definition: otbNCCRegistrationFunction.h:171
otb::NCCRegistrationFunction::m_FixedImageOrigin
PointType m_FixedImageOrigin
Definition: otbNCCRegistrationFunction.h:168
otb::NCCRegistrationFunction::MovingImageType
Superclass::MovingImageType MovingImageType
Definition: otbNCCRegistrationFunction.h:63
otb::NCCRegistrationFunction::FloatOffsetType
Superclass::FloatOffsetType FloatOffsetType
Definition: otbNCCRegistrationFunction.h:88
otb::NCCRegistrationFunction::SetMovingImageInterpolator
void SetMovingImageInterpolator(InterpolatorType *ptr)
Definition: otbNCCRegistrationFunction.h:106
otb::NCCRegistrationFunction::m_FixedImageSpacing
SpacingType m_FixedImageSpacing
Definition: otbNCCRegistrationFunction.h:167
otb::NCCRegistrationFunction::PixelType
Superclass::PixelType PixelType
Definition: otbNCCRegistrationFunction.h:84
otb::NCCRegistrationFunction::m_IntensityDifferenceThreshold
double m_IntensityDifferenceThreshold
Definition: otbNCCRegistrationFunction.h:183
otb::NCCRegistrationFunction::InterpolatorType
itk::InterpolateImageFunction< MovingImageType, CoordRepType > InterpolatorType
Definition: otbNCCRegistrationFunction.h:93
otb::NCCRegistrationFunction::GlobalDataStruct
Definition: otbNCCRegistrationFunction.h:157
otb::NCCRegistrationFunction
Definition: otbNCCRegistrationFunction.h:49
otb::NCCRegistrationFunction::DisplacementFieldType
Superclass::DisplacementFieldType DisplacementFieldType
Definition: otbNCCRegistrationFunction.h:77