OTB  9.0.0
Orfeo Toolbox
otbDisparityMapToDEMFilter.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 otbDisparityMapToDEMFilter_h
22 #define otbDisparityMapToDEMFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 #include "otbGenericRSTransform.h"
26 #include "itkImageRegionSplitter.h"
27 #include "otbVectorImage.h"
28 #include "otbImage.h"
29 
30 namespace otb
31 {
32 
62 template <class TDisparityImage, class TInputImage, class TOutputDEMImage = TDisparityImage, class TEpipolarGridImage = otb::VectorImage<float, 2>,
63  class TMaskImage = otb::Image<unsigned char>>
64 class ITK_EXPORT DisparityMapToDEMFilter : public itk::ImageToImageFilter<TDisparityImage, TOutputDEMImage>
65 {
66 public:
69  typedef itk::ImageToImageFilter<TDisparityImage, TOutputDEMImage> Superclass;
70  typedef itk::SmartPointer<Self> Pointer;
71  typedef itk::SmartPointer<const Self> ConstPointer;
72 
74  itkNewMacro(Self);
75 
77  itkTypeMacro(DisparityMapToDEMFilter, ImageToImageFilter);
78 
80  typedef TDisparityImage DisparityMapType;
81  typedef TInputImage SensorImageType;
82  typedef TOutputDEMImage DEMImageType;
83  typedef TEpipolarGridImage GridImageType;
84  typedef TMaskImage MaskImageType;
85 
86  typedef typename DEMImageType::RegionType RegionType;
87  typedef typename DEMImageType::PixelType DEMPixelType;
88 
89  typedef itk::ImageRegionSplitter<2> SplitterType;
90 
91  // 3D RS transform
92  // TODO: Allow tuning precision (i.e. double or float)
94  // typedef typename RSTransformType::Pointer RSTransformPointerType;
95 
96  // 3D points
98 
100  void SetHorizontalDisparityMapInput(const TDisparityImage* hmap);
101 
103  void SetVerticalDisparityMapInput(const TDisparityImage* vmap);
104 
106  void SetLeftInput(const TInputImage* image);
107 
109  void SetRightInput(const TInputImage* image);
110 
112  void SetLeftEpipolarGridInput(const TEpipolarGridImage* grid);
113 
115  void SetRightEpipolarGridInput(const TEpipolarGridImage* grid);
116 
118  void SetDisparityMaskInput(const TMaskImage* mask);
119 
121  const TDisparityImage* GetHorizontalDisparityMapInput() const;
122  const TDisparityImage* GetVerticalDisparityMapInput() const;
123  const TInputImage* GetLeftInput() const;
124  const TInputImage* GetRightInput() const;
125  const TEpipolarGridImage* GetLeftEpipolarGridInput() const;
126  const TEpipolarGridImage* GetRightEpipolarGridInput() const;
127  const TMaskImage* GetDisparityMaskInput() const;
129 
131  const TOutputDEMImage* GetDEMOutput() const;
132  TOutputDEMImage* GetDEMOutput();
134 
136  itkSetMacro(ElevationMin, double);
137  itkGetConstReferenceMacro(ElevationMin, double);
139 
141  itkSetMacro(ElevationMax, double);
142  itkGetConstReferenceMacro(ElevationMax, double);
144 
146  itkSetMacro(DEMGridStep, double);
147  itkGetConstReferenceMacro(DEMGridStep, double);
149 
150 protected:
153 
155  ~DisparityMapToDEMFilter() override;
156 
158  void GenerateOutputInformation() override;
159 
161  void GenerateInputRequestedRegion() override;
162 
164  void BeforeThreadedGenerateData() override;
165 
167  void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
168 
170  void AfterThreadedGenerateData() override;
171 
177  void VerifyInputInformation() override
178  {
179  }
180 
181 
182 private:
183  DisparityMapToDEMFilter(const Self&) = delete;
184  void operator=(const Self&) = delete;
185 
188 
191 
194 
196  SplitterType::Pointer m_InputSplitter;
197 
199  unsigned int m_UsedInputSplits;
200 
202  std::vector<typename DEMImageType::Pointer> m_TempDEMRegions;
203 
206 
209 };
210 } // end namespace otb
211 
212 #ifndef OTB_MANUAL_INSTANTIATION
214 #endif
215 
216 #endif
otb::GenericRSTransform::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGenericRSTransform.h:66
otb::DisparityMapToDEMFilter::MaskImageType
TMaskImage MaskImageType
Definition: otbDisparityMapToDEMFilter.h:84
otb::DisparityMapToDEMFilter::m_UsedInputSplits
unsigned int m_UsedInputSplits
Definition: otbDisparityMapToDEMFilter.h:199
otb::DisparityMapToDEMFilter::SensorImageType
TInputImage SensorImageType
Definition: otbDisparityMapToDEMFilter.h:81
otb::DisparityMapToDEMFilter::RSTransformType
otb::GenericRSTransform< double, 3, 3 > RSTransformType
Definition: otbDisparityMapToDEMFilter.h:93
otbVectorImage.h
otb::DisparityMapToDEMFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbDisparityMapToDEMFilter.h:71
otbImage.h
otb::DisparityMapToDEMFilter::m_ElevationMin
double m_ElevationMin
Definition: otbDisparityMapToDEMFilter.h:187
otb::DisparityMapToDEMFilter::DisparityMapType
TDisparityImage DisparityMapType
Definition: otbDisparityMapToDEMFilter.h:77
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::DisparityMapToDEMFilter
Project an input disparity map into a regular DEM.
Definition: otbDisparityMapToDEMFilter.h:64
otb::DisparityMapToDEMFilter::DEMPixelType
DEMImageType::PixelType DEMPixelType
Definition: otbDisparityMapToDEMFilter.h:87
otb::DisparityMapToDEMFilter::Superclass
itk::ImageToImageFilter< TDisparityImage, TOutputDEMImage > Superclass
Definition: otbDisparityMapToDEMFilter.h:69
otb::DisparityMapToDEMFilter::m_TempDEMRegions
std::vector< typename DEMImageType::Pointer > m_TempDEMRegions
Definition: otbDisparityMapToDEMFilter.h:202
otb::DisparityMapToDEMFilter::m_DEMGridStep
double m_DEMGridStep
Definition: otbDisparityMapToDEMFilter.h:193
otb::DisparityMapToDEMFilter::TDPointType
RSTransformType::InputPointType TDPointType
Definition: otbDisparityMapToDEMFilter.h:97
otb::DisparityMapToDEMFilter::m_InputSplitter
SplitterType::Pointer m_InputSplitter
Definition: otbDisparityMapToDEMFilter.h:196
otb::DisparityMapToDEMFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbDisparityMapToDEMFilter.h:70
otb::GenericRSTransform
This is the class to handle generic remote sensing transform.
Definition: otbGenericRSTransform.h:57
otb::DisparityMapToDEMFilter::Self
DisparityMapToDEMFilter Self
Definition: otbDisparityMapToDEMFilter.h:68
otb::GenericRSTransform::InputPointType
itk::Point< ScalarType, NInputDimensions > InputPointType
Definition: otbGenericRSTransform.h:72
otb::DisparityMapToDEMFilter::DEMImageType
TOutputDEMImage DEMImageType
Definition: otbDisparityMapToDEMFilter.h:82
otb::DisparityMapToDEMFilter::SplitterType
itk::ImageRegionSplitter< 2 > SplitterType
Definition: otbDisparityMapToDEMFilter.h:89
otbGenericRSTransform.h
otb::DisparityMapToDEMFilter::VerifyInputInformation
void VerifyInputInformation() override
Definition: otbDisparityMapToDEMFilter.h:177
otb::DisparityMapToDEMFilter::GridImageType
TEpipolarGridImage GridImageType
Definition: otbDisparityMapToDEMFilter.h:83
otb::DisparityMapToDEMFilter::m_ElevationMax
double m_ElevationMax
Definition: otbDisparityMapToDEMFilter.h:190
otb::DisparityMapToDEMFilter::m_LeftToGroundTransform
RSTransformType::Pointer m_LeftToGroundTransform
Definition: otbDisparityMapToDEMFilter.h:205
otb::DisparityMapToDEMFilter::RegionType
DEMImageType::RegionType RegionType
Definition: otbDisparityMapToDEMFilter.h:86
otb::DisparityMapToDEMFilter::m_RightToGroundTransform
RSTransformType::Pointer m_RightToGroundTransform
Definition: otbDisparityMapToDEMFilter.h:208
otbDisparityMapToDEMFilter.hxx