OTB  10.0.0
Orfeo Toolbox
otbMultiDisparityMapTo3DFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 otbMultiDisparityMapTo3DFilter_h
22 #define otbMultiDisparityMapTo3DFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 #include "otbGenericRSTransform.h"
27 #include "itkImageRegionIteratorWithIndex.h"
28 #include "itkImageRegionConstIterator.h"
29 #include "otbVectorImage.h"
30 #include "otbImage.h"
31 
32 namespace otb
33 {
34 
58 template <class TDisparityImage, class TOutputImage = otb::VectorImage<float, 2>, class TMaskImage = otb::Image<unsigned char>,
59  class TResidueImage = otb::Image<float>>
60 class ITK_EXPORT MultiDisparityMapTo3DFilter : public itk::ImageToImageFilter<TDisparityImage, TOutputImage>
61 {
62 public:
65  typedef itk::ImageToImageFilter<TDisparityImage, TOutputImage> Superclass;
66  typedef itk::SmartPointer<Self> Pointer;
67  typedef itk::SmartPointer<const Self> ConstPointer;
68 
70  itkNewMacro(Self);
71 
73  itkTypeMacro(MultiDisparityMapTo3DFilter, ImageToImageFilter);
74 
76  typedef TDisparityImage DisparityMapType;
77  typedef TOutputImage OutputImageType;
78  typedef TMaskImage MaskImageType;
79  typedef TResidueImage ResidueImageType;
80 
81  typedef typename OutputImageType::RegionType RegionType;
82  typedef typename OutputImageType::PixelType DEMPixelType;
83 
84  // 3D RS transform
85  // TODO: Allow tuning precision (i.e. double or float)
86  typedef double PrecisionType;
88 
89  // 3D points
91 
94  typedef typename PointSetType::PointsContainer PointsContainer;
95  typedef typename PointSetType::PointDataContainer LabelContainer;
96 
97  typedef std::map<unsigned int, itk::ImageRegionConstIterator<DisparityMapType>> DispMapIteratorList;
98 
99  typedef std::map<unsigned int, itk::ImageRegionConstIterator<MaskImageType>> MaskIteratorList;
100 
102  void SetNumberOfMovingImages(unsigned int nb);
103 
105  unsigned int GetNumberOfMovingImages();
106 
108  void SetHorizontalDisparityMapInput(unsigned int index, const TDisparityImage* hmap);
109 
111  void SetVerticalDisparityMapInput(unsigned int index, const TDisparityImage* vmap);
112 
116  void SetDisparityMaskInput(unsigned int index, const TMaskImage* mask);
117 
119  const TDisparityImage* GetHorizontalDisparityMapInput(unsigned int index) const;
120  const TDisparityImage* GetVerticalDisparityMapInput(unsigned int index) const;
121  const TMaskImage* GetDisparityMaskInput(unsigned int index) const;
123 
125  const TResidueImage* GetResidueOutput() const;
126  TResidueImage* GetResidueOutput();
128 
131  {
132  this->m_ReferenceImageMetadata = imd;
133  this->Modified();
134  }
136 
139  {
140  return this->m_ReferenceImageMetadata;
141  }
142 
144  void SetMovingImageMetadata(unsigned int index, const ImageMetadata* imd);
145 
147  const ImageMetadata* GetMovingImageMetadata(unsigned int index) const;
148 
149 protected:
152 
154  ~MultiDisparityMapTo3DFilter() override;
155 
157  void GenerateOutputInformation() override;
158 
160  void GenerateInputRequestedRegion() override;
161 
163  void DynamicThreadedGenerateData(const RegionType& outputRegionForThread) override;
164 
165 private:
167  void operator=(const Self&) = delete;
168 
170  const ImageMetadata* m_ReferenceImageMetadata = nullptr;
171 
173  std::vector<const ImageMetadata*> m_MovingImageMetadatas;
174 
175 
176 };
177 } // end namespace otb
178 
179 #ifndef OTB_MANUAL_INSTANTIATION
181 #endif
182 
183 #endif
This is the class to handle generic remote sensing transform.
itk::Point< ScalarType, NInputDimensions > InputPointType
Generic class containing image metadata used in OTB.
Compute the position of a 3D point from a set of N lines of sight.
itk::PointSet< TLabel, 3, MeshType > PointSetType
Project a group of disparity map into 3D points.
otb::GenericRSTransform< PrecisionType, 3, 3 > RSTransformType
std::vector< const ImageMetadata * > m_MovingImageMetadatas
void operator=(const Self &)=delete
void SetReferenceImageMetadata(const ImageMetadata *imd)
std::map< unsigned int, itk::ImageRegionConstIterator< DisparityMapType > > DispMapIteratorList
MultiDisparityMapTo3DFilter(const Self &)=delete
itk::SmartPointer< const Self > ConstPointer
PointSetType::PointsContainer PointsContainer
otb::LineOfSightOptimizer< PrecisionType > OptimizerType
const ImageMetadata * GetReferenceImageMetadata() const
itk::ImageToImageFilter< TDisparityImage, TOutputImage > Superclass
std::map< unsigned int, itk::ImageRegionConstIterator< MaskImageType > > MaskIteratorList
PointSetType::PointDataContainer LabelContainer
RSTransformType::InputPointType TDPointType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.