OTB  6.7.0
Orfeo Toolbox
otbDisparityMapTo3DFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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>,
52  class TEpipolarGridImage = otb::VectorImage<float,2> , class TMaskImage = otb::Image<unsigned char> >
53 class ITK_EXPORT DisparityMapTo3DFilter :
54  public itk::ImageToImageFilter<TDisparityImage,TOutputImage>
55 {
56 public:
59  typedef itk::ImageToImageFilter<TDisparityImage,
60  TOutputImage> Superclass;
63 
65  itkNewMacro(Self);
66 
68  itkTypeMacro(DisparityMapTo3DFilter, ImageToImageFilter);
69 
71  typedef TDisparityImage DisparityMapType;
72  typedef TOutputImage OutputImageType;
73  typedef TEpipolarGridImage GridImageType;
74  typedef TMaskImage MaskImageType;
75 
76  typedef typename OutputImageType::RegionType RegionType;
77  typedef typename OutputImageType::PixelType DEMPixelType;
78 
79  // 3D RS transform
80  // TODO: Allow tuning precision (i.e. double or float)
81  typedef double PrecisionType;
83 
84  // 3D points
86 
91 
93 
95  void SetHorizontalDisparityMapInput( const TDisparityImage * hmap);
96 
98  void SetVerticalDisparityMapInput( const TDisparityImage * vmap);
99 
101  void SetLeftEpipolarGridInput( const TEpipolarGridImage * grid);
102 
104  void SetRightEpipolarGridInput( const TEpipolarGridImage * grid);
105 
107  void SetDisparityMaskInput( const TMaskImage * mask);
108 
110  const TDisparityImage * GetHorizontalDisparityMapInput() const;
111  const TDisparityImage * GetVerticalDisparityMapInput() const;
112  const TEpipolarGridImage * GetLeftEpipolarGridInput() const;
113  const TEpipolarGridImage * GetRightEpipolarGridInput() const;
114  const TMaskImage * GetDisparityMaskInput() const;
116 
119  {
120  this->m_LeftKeywordList = kwl;
121  this->Modified();
122  }
124 
127  {
128  return this->m_LeftKeywordList;
129  }
130 
133  {
134  this->m_RightKeywordList = kwl;
135  this->Modified();
136  }
138 
141  {
142  return this->m_RightKeywordList;
143  }
144 
145 protected:
148 
150  ~DisparityMapTo3DFilter() override;
151 
153  void GenerateOutputInformation() override;
154 
156  void GenerateInputRequestedRegion() override;
157 
159  void BeforeThreadedGenerateData() override;
160 
162  void ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) override;
163 
169  void VerifyInputInformation() override {}
170 
171 
172 private:
173  DisparityMapTo3DFilter(const Self&) = delete;
174  void operator=(const Self&) = delete;
175 
178 
181 
184 
187 };
188 } // end namespace otb
189 
190 #ifndef OTB_MANUAL_INSTANTIATION
192 #endif
193 
194 #endif
const ImageKeywordListType & GetLeftKeywordList() const
Storage and conversion for OSSIM metadata.
RSTransformType::Pointer m_LeftToGroundTransform
RSTransformType::Pointer m_RightToGroundTransform
otb::ImageKeywordlist ImageKeywordListType
RSTransformType::InputPointType TDPointType
PointSetType::PointDataContainer LabelContainer
PointSetType::PointsContainer PointsContainer
const ImageKeywordListType & GetRightKeywordList() const
OutputImageType::PixelType DEMPixelType
itk::ImageToImageFilter< TDisparityImage, TOutputImage > Superclass
MeshTraits::PointsContainer PointsContainer
itk::SmartPointer< const Self > ConstPointer
unsigned int ThreadIdType
void SetRightKeywordList(const ImageKeywordListType kwl)
This is the class to handle generic remote sensing transform.
itk::SmartPointer< Self > Pointer
otb::GenericRSTransform< PrecisionType, 3, 3 > RSTransformType
otb::LineOfSightOptimizer< PrecisionType > OptimizerType
OutputImageType::RegionType RegionType
MeshTraits::PointDataContainer PointDataContainer
Compute the position of a 3D point from a set of N lines of sight.
OptimizerType::PointSetType PointSetType
Project an input disparity map into a 3D points.
void SetLeftKeywordList(const ImageKeywordListType kwl)