OTB  7.2.0
Orfeo Toolbox
otbDisparityMapToDEMFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 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
RSTransformType::Pointer m_RightToGroundTransform
RSTransformType::Pointer m_LeftToGroundTransform
itk::ImageToImageFilter< TDisparityImage, TOutputDEMImage > Superclass
itk::SmartPointer< Self > Pointer
Project an input disparity map into a regular DEM.
RSTransformType::InputPointType TDPointType
std::vector< typename DEMImageType::Pointer > m_TempDEMRegions
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
itk::ImageRegionSplitter< 2 > SplitterType
This is the class to handle generic remote sensing transform.
itk::SmartPointer< const Self > ConstPointer
itk::Point< ScalarType, NInputDimensions > InputPointType
otb::GenericRSTransform< double, 3, 3 > RSTransformType