OTB  9.0.0
Orfeo Toolbox
otbDisparityMapTo3DFilter.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 otbDisparityMapTo3DFilter_h
22 #define otbDisparityMapTo3DFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 #include "otbGenericRSTransform.h"
27 #include "otbVectorImage.h"
28 #include "otbImage.h"
29 
30 namespace otb
31 {
32 
51 template <class TDisparityImage, class TOutputImage = otb::VectorImage<float, 2>, class TEpipolarGridImage = otb::VectorImage<float, 2>,
52  class TMaskImage = otb::Image<unsigned char>>
53 class ITK_EXPORT DisparityMapTo3DFilter : public itk::ImageToImageFilter<TDisparityImage, TOutputImage>
54 {
55 public:
58  typedef itk::ImageToImageFilter<TDisparityImage, TOutputImage> Superclass;
59  typedef itk::SmartPointer<Self> Pointer;
60  typedef itk::SmartPointer<const Self> ConstPointer;
61 
63  itkNewMacro(Self);
64 
66  itkTypeMacro(DisparityMapTo3DFilter, ImageToImageFilter);
67 
69  typedef TDisparityImage DisparityMapType;
70  typedef TOutputImage OutputImageType;
71  typedef TEpipolarGridImage GridImageType;
72  typedef TMaskImage MaskImageType;
73 
74  typedef typename OutputImageType::RegionType RegionType;
75  typedef typename OutputImageType::PixelType DEMPixelType;
76 
77  // 3D RS transform
78  // TODO: Allow tuning precision (i.e. double or float)
79  typedef double PrecisionType;
81 
82  // 3D points
84 
87  typedef typename PointSetType::PointsContainer PointsContainer;
88  typedef typename PointSetType::PointDataContainer LabelContainer;
89 
91  void SetHorizontalDisparityMapInput(const TDisparityImage* hmap);
92 
94  void SetVerticalDisparityMapInput(const TDisparityImage* vmap);
95 
97  void SetLeftEpipolarGridInput(const TEpipolarGridImage* grid);
98 
100  void SetRightEpipolarGridInput(const TEpipolarGridImage* grid);
101 
103  void SetDisparityMaskInput(const TMaskImage* mask);
104 
106  const TDisparityImage* GetHorizontalDisparityMapInput() const;
107  const TDisparityImage* GetVerticalDisparityMapInput() const;
108  const TEpipolarGridImage* GetLeftEpipolarGridInput() const;
109  const TEpipolarGridImage* GetRightEpipolarGridInput() const;
110  const TMaskImage* GetDisparityMaskInput() const;
112 
115  {
116  this->m_LeftImageMetadata = imd;
117  this->Modified();
118  }
120 
123  {
124  return this->m_LeftImageMetadata;
125  }
126 
129  {
130  this->m_RightImageMetadata = imd;
131  this->Modified();
132  }
134 
137  {
138  return this->m_RightImageMetadata;
139  }
140 
141 protected:
144 
146  ~DisparityMapTo3DFilter() override = default;
147 
149  void GenerateOutputInformation() override;
150 
152  void GenerateInputRequestedRegion() override;
153 
155  void BeforeThreadedGenerateData() override;
156 
158  void ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
159 
165  void VerifyInputInformation() override
166  {
167  }
168 
169 
170 private:
171  DisparityMapTo3DFilter(const Self&) = delete;
172  void operator=(const Self&) = delete;
173 
175  const ImageMetadata* m_LeftImageMetadata = nullptr;
176 
178  const ImageMetadata* m_RightImageMetadata = nullptr;
179 
182 
185 };
186 } // end namespace otb
187 
188 #ifndef OTB_MANUAL_INSTANTIATION
190 #endif
191 
192 #endif
otb::LineOfSightOptimizer
Compute the position of a 3D point from a set of N lines of sight.
Definition: otbLineOfSightOptimizer.h:42
otb::GenericRSTransform::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbGenericRSTransform.h:66
otb::DisparityMapTo3DFilter::Superclass
itk::ImageToImageFilter< TDisparityImage, TOutputImage > Superclass
Definition: otbDisparityMapTo3DFilter.h:58
otb::DisparityMapTo3DFilter::LabelContainer
PointSetType::PointDataContainer LabelContainer
Definition: otbDisparityMapTo3DFilter.h:88
otb::DisparityMapTo3DFilter::TDPointType
RSTransformType::InputPointType TDPointType
Definition: otbDisparityMapTo3DFilter.h:83
otbVectorImage.h
otbImage.h
otb::DisparityMapTo3DFilter::MaskImageType
TMaskImage MaskImageType
Definition: otbDisparityMapTo3DFilter.h:72
otb::DisparityMapTo3DFilter::DisparityMapType
TDisparityImage DisparityMapType
Definition: otbDisparityMapTo3DFilter.h:66
otb::DisparityMapTo3DFilter::PrecisionType
double PrecisionType
Definition: otbDisparityMapTo3DFilter.h:79
otb::DisparityMapTo3DFilter::PointsContainer
PointSetType::PointsContainer PointsContainer
Definition: otbDisparityMapTo3DFilter.h:87
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::DisparityMapTo3DFilter::OptimizerType
otb::LineOfSightOptimizer< PrecisionType > OptimizerType
Definition: otbDisparityMapTo3DFilter.h:85
otb::DisparityMapTo3DFilter::VerifyInputInformation
void VerifyInputInformation() override
Definition: otbDisparityMapTo3DFilter.h:165
otbDisparityMapTo3DFilter.hxx
otb::DisparityMapTo3DFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbDisparityMapTo3DFilter.h:60
otb::DisparityMapTo3DFilter::SetLeftImageMetadata
void SetLeftImageMetadata(const ImageMetadata *imd)
Definition: otbDisparityMapTo3DFilter.h:114
otb::DisparityMapTo3DFilter::m_LeftToGroundTransform
RSTransformType::Pointer m_LeftToGroundTransform
Definition: otbDisparityMapTo3DFilter.h:181
otb::GenericRSTransform
This is the class to handle generic remote sensing transform.
Definition: otbGenericRSTransform.h:57
otb::DisparityMapTo3DFilter::m_RightToGroundTransform
RSTransformType::Pointer m_RightToGroundTransform
Definition: otbDisparityMapTo3DFilter.h:184
otb::DisparityMapTo3DFilter::GetLeftImageMetadata
const ImageMetadata * GetLeftImageMetadata() const
Definition: otbDisparityMapTo3DFilter.h:122
otb::DisparityMapTo3DFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbDisparityMapTo3DFilter.h:70
otb::DisparityMapTo3DFilter::RegionType
OutputImageType::RegionType RegionType
Definition: otbDisparityMapTo3DFilter.h:74
otbLineOfSightOptimizer.h
otb::GenericRSTransform::InputPointType
itk::Point< ScalarType, NInputDimensions > InputPointType
Definition: otbGenericRSTransform.h:72
otb::DisparityMapTo3DFilter::SetRightImageMetadata
void SetRightImageMetadata(const ImageMetadata *imd)
Definition: otbDisparityMapTo3DFilter.h:128
otb::DisparityMapTo3DFilter::DEMPixelType
OutputImageType::PixelType DEMPixelType
Definition: otbDisparityMapTo3DFilter.h:75
otb::DisparityMapTo3DFilter::PointSetType
OptimizerType::PointSetType PointSetType
Definition: otbDisparityMapTo3DFilter.h:86
otb::DisparityMapTo3DFilter::GetRightImageMetadata
const ImageMetadata * GetRightImageMetadata() const
Definition: otbDisparityMapTo3DFilter.h:136
otb::LineOfSightOptimizer::PointSetType
itk::PointSet< TLabel, 3, MeshType > PointSetType
Definition: otbLineOfSightOptimizer.h:61
otbGenericRSTransform.h
otb::DisparityMapTo3DFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbDisparityMapTo3DFilter.h:59
otb::ImageMetadata
Generic class containing image metadata used in OTB.
Definition: otbImageMetadata.h:270
otb::DisparityMapTo3DFilter
Project an input disparity map into a 3D points.
Definition: otbDisparityMapTo3DFilter.h:53
otb::DisparityMapTo3DFilter::GridImageType
TEpipolarGridImage GridImageType
Definition: otbDisparityMapTo3DFilter.h:71
otb::DisparityMapTo3DFilter::Self
DisparityMapTo3DFilter Self
Definition: otbDisparityMapTo3DFilter.h:57
otb::DisparityMapTo3DFilter::RSTransformType
otb::GenericRSTransform< PrecisionType, 3, 3 > RSTransformType
Definition: otbDisparityMapTo3DFilter.h:80