OTB  9.0.0
Orfeo Toolbox
otbStereoSensorModelToElevationMapFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2022 Centre National d'Etudes Spatiales (CNES)
3  *
4  * This file is part of Orfeo Toolbox
5  *
6  * https://www.orfeo-toolbox.org/
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 
21 #ifndef otbStereoSensorModelToElevationMapFilter_h
22 #define otbStereoSensorModelToElevationMapFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 #include "itkInterpolateImageFunction.h"
26 #include "otbGenericRSTransform.h"
27 #include "itkNormalizedCorrelationImageToImageMetric.h"
28 
29 namespace otb
30 {
82 template <class TInputImage, class TOutputHeight>
83 class ITK_EXPORT StereoSensorModelToElevationFilter : public itk::ImageToImageFilter<TInputImage, TOutputHeight>
84 {
85 public:
86 
89  typedef itk::ImageToImageFilter<TInputImage, TOutputHeight> Superclass;
90  typedef itk::SmartPointer<Self> Pointer;
91  typedef itk::SmartPointer<const Self> ConstPointer;
92 
94  itkNewMacro(Self);
95 
97  itkTypeMacro(StereoSensorModelToElevationFilter, ImageToImageFilter);
98 
100  typedef TInputImage InputImageType;
101  typedef typename InputImageType::PixelType InputPixelType;
102  typedef TOutputHeight OutputImageType;
103  typedef typename OutputImageType::RegionType OutputRegionType;
104  typedef typename OutputImageType::PixelType HeightType;
105  typedef typename OutputImageType::PointType OutputPointType;
106 
107  typedef itk::InterpolateImageFunction<TInputImage, double> InterpolatorType;
108  typedef typename InterpolatorType::Pointer InterpolatorPointerType;
111  typedef itk::NormalizedCorrelationImageToImageMetric<TInputImage, TInputImage> CorrelationMetricType;
112  typedef typename InputImageType::SizeType RadiusType;
113 
115  void SetMasterInput(const TInputImage* image);
116 
118  void SetSlaveInput(const TInputImage* image);
119 
121  const TInputImage* GetMasterInput() const;
122 
124  const TInputImage* GetSlaveInput() const;
125 
127  TOutputHeight* GetCorrelationOutput();
128 
132  itkSetMacro(LowerElevation, double);
133 
137  itkSetMacro(HigherElevation, double);
138 
140  itkSetMacro(ElevationStep, double);
141 
145  itkSetMacro(CorrelationThreshold, double);
146 
150  itkGetMacro(CorrelationThreshold, double);
151 
155  itkSetMacro(VarianceThreshold, double);
156 
160  itkGetMacro(VarianceThreshold, double);
161 
166  itkSetMacro(SubtractInitialElevation, bool);
167 
172  itkGetMacro(SubtractInitialElevation, bool);
173 
178  itkBooleanMacro(SubtractInitialElevation);
179 
181  void SetRadius(unsigned int radius)
182  {
183  m_Radius.Fill(radius);
184  this->Modified();
185  }
187 
188 protected:
191 
194 
196  void ThreadedGenerateData(const OutputRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
197 
199  void GenerateInputRequestedRegion(void) override;
200 
202  void BeforeThreadedGenerateData() override;
203 
209  void VerifyInputInformation() override
210  {
211  }
212 
213 
214 private:
215  StereoSensorModelToElevationFilter(const Self&) = delete;
216  void operator=(const Self&) = delete;
217 
218  inline double Correlation(const std::vector<double>& master, const std::vector<double>& slave) const;
219 
222 
225 
228 
231 
234 
237 
241 
246 
249 };
250 } // End namespace otb
251 
252 #ifndef OTB_MANUAL_INSTANTIATION
254 #endif
255 
256 #endif
otb::StereoSensorModelToElevationFilter::m_ElevationStep
double m_ElevationStep
Definition: otbStereoSensorModelToElevationMapFilter.h:233
otb::StereoSensorModelToElevationFilter::InputImageType
TInputImage InputImageType
Definition: otbStereoSensorModelToElevationMapFilter.h:97
otb::StereoSensorModelToElevationFilter::OutputRegionType
OutputImageType::RegionType OutputRegionType
Definition: otbStereoSensorModelToElevationMapFilter.h:103
otb::GenericRSTransform::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGenericRSTransform.h:66
otb::StereoSensorModelToElevationFilter::GenericRSTransformType
GenericRSTransform GenericRSTransformType
Definition: otbStereoSensorModelToElevationMapFilter.h:109
otb::StereoSensorModelToElevationFilter::m_LowerElevation
double m_LowerElevation
Definition: otbStereoSensorModelToElevationMapFilter.h:227
otb::StereoSensorModelToElevationFilter::CorrelationMetricType
itk::NormalizedCorrelationImageToImageMetric< TInputImage, TInputImage > CorrelationMetricType
Definition: otbStereoSensorModelToElevationMapFilter.h:111
otb::StereoSensorModelToElevationFilter
Using sensor models to perform correlation along epipolars.
Definition: otbStereoSensorModelToElevationMapFilter.h:83
otb::StereoSensorModelToElevationFilter::GenericRSTransform3DType
GenericRSTransform< double, 3, 3 > GenericRSTransform3DType
Definition: otbStereoSensorModelToElevationMapFilter.h:110
otb::StereoSensorModelToElevationFilter::m_HigherElevation
double m_HigherElevation
Definition: otbStereoSensorModelToElevationMapFilter.h:230
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::StereoSensorModelToElevationFilter::VerifyInputInformation
void VerifyInputInformation() override
Definition: otbStereoSensorModelToElevationMapFilter.h:209
otb::StereoSensorModelToElevationFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbStereoSensorModelToElevationMapFilter.h:90
otb::StereoSensorModelToElevationFilter::InterpolatorType
itk::InterpolateImageFunction< TInputImage, double > InterpolatorType
Definition: otbStereoSensorModelToElevationMapFilter.h:107
otb::StereoSensorModelToElevationFilter::m_Interpolator
InterpolatorPointerType m_Interpolator
Definition: otbStereoSensorModelToElevationMapFilter.h:221
otb::StereoSensorModelToElevationFilter::OutputImageType
TOutputHeight OutputImageType
Definition: otbStereoSensorModelToElevationMapFilter.h:102
otb::StereoSensorModelToElevationFilter::m_MasterToSlave
GenericRSTransform3DType::Pointer m_MasterToSlave
Definition: otbStereoSensorModelToElevationMapFilter.h:248
otb::GenericRSTransform
This is the class to handle generic remote sensing transform.
Definition: otbGenericRSTransform.h:57
otb::StereoSensorModelToElevationFilter::Self
StereoSensorModelToElevationFilter Self
Definition: otbStereoSensorModelToElevationMapFilter.h:88
otb::StereoSensorModelToElevationFilter::m_Radius
RadiusType m_Radius
Definition: otbStereoSensorModelToElevationMapFilter.h:224
otb::StereoSensorModelToElevationFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbStereoSensorModelToElevationMapFilter.h:91
otb::StereoSensorModelToElevationFilter::m_CorrelationThreshold
double m_CorrelationThreshold
Definition: otbStereoSensorModelToElevationMapFilter.h:236
otb::StereoSensorModelToElevationFilter::SetRadius
void SetRadius(unsigned int radius)
Definition: otbStereoSensorModelToElevationMapFilter.h:181
otb::StereoSensorModelToElevationFilter::m_VarianceThreshold
double m_VarianceThreshold
Definition: otbStereoSensorModelToElevationMapFilter.h:240
otbGenericRSTransform.h
otb::StereoSensorModelToElevationFilter::InputPixelType
InputImageType::PixelType InputPixelType
Definition: otbStereoSensorModelToElevationMapFilter.h:101
otb::StereoSensorModelToElevationFilter::OutputPointType
OutputImageType::PointType OutputPointType
Definition: otbStereoSensorModelToElevationMapFilter.h:105
otb::StereoSensorModelToElevationFilter::Superclass
itk::ImageToImageFilter< TInputImage, TOutputHeight > Superclass
Definition: otbStereoSensorModelToElevationMapFilter.h:89
otbStereoSensorModelToElevationMapFilter.hxx
otb::StereoSensorModelToElevationFilter::RadiusType
InputImageType::SizeType RadiusType
Definition: otbStereoSensorModelToElevationMapFilter.h:112
otb::StereoSensorModelToElevationFilter::m_SubtractInitialElevation
bool m_SubtractInitialElevation
Definition: otbStereoSensorModelToElevationMapFilter.h:245
otb::StereoSensorModelToElevationFilter::InterpolatorPointerType
InterpolatorType::Pointer InterpolatorPointerType
Definition: otbStereoSensorModelToElevationMapFilter.h:108
otb::StereoSensorModelToElevationFilter::HeightType
OutputImageType::PixelType HeightType
Definition: otbStereoSensorModelToElevationMapFilter.h:104