OTB  9.0.0
Orfeo Toolbox
otbMultiDisparityMapTo3DFilter.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 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 ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
164 
165 private:
166  MultiDisparityMapTo3DFilter(const Self&) = delete;
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
otb::LineOfSightOptimizer
Compute the position of a 3D point from a set of N lines of sight.
Definition: otbLineOfSightOptimizer.h:42
otb::MultiDisparityMapTo3DFilter::m_MovingImageMetadatas
std::vector< const ImageMetadata * > m_MovingImageMetadatas
Definition: otbMultiDisparityMapTo3DFilter.h:173
otbVectorImage.h
otbImage.h
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::MultiDisparityMapTo3DFilter::DispMapIteratorList
std::map< unsigned int, itk::ImageRegionConstIterator< DisparityMapType > > DispMapIteratorList
Definition: otbMultiDisparityMapTo3DFilter.h:97
otb::MultiDisparityMapTo3DFilter::DEMPixelType
OutputImageType::PixelType DEMPixelType
Definition: otbMultiDisparityMapTo3DFilter.h:82
otb::MultiDisparityMapTo3DFilter::GetReferenceImageMetadata
const ImageMetadata * GetReferenceImageMetadata() const
Definition: otbMultiDisparityMapTo3DFilter.h:138
otb::MultiDisparityMapTo3DFilter::OptimizerType
otb::LineOfSightOptimizer< PrecisionType > OptimizerType
Definition: otbMultiDisparityMapTo3DFilter.h:92
otb::MultiDisparityMapTo3DFilter::MaskIteratorList
std::map< unsigned int, itk::ImageRegionConstIterator< MaskImageType > > MaskIteratorList
Definition: otbMultiDisparityMapTo3DFilter.h:99
otb::MultiDisparityMapTo3DFilter::PrecisionType
double PrecisionType
Definition: otbMultiDisparityMapTo3DFilter.h:86
otb::MultiDisparityMapTo3DFilter::SetReferenceImageMetadata
void SetReferenceImageMetadata(const ImageMetadata *imd)
Definition: otbMultiDisparityMapTo3DFilter.h:130
otb::MultiDisparityMapTo3DFilter::Superclass
itk::ImageToImageFilter< TDisparityImage, TOutputImage > Superclass
Definition: otbMultiDisparityMapTo3DFilter.h:65
otb::MultiDisparityMapTo3DFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbMultiDisparityMapTo3DFilter.h:67
otb::MultiDisparityMapTo3DFilter::Self
MultiDisparityMapTo3DFilter Self
Definition: otbMultiDisparityMapTo3DFilter.h:64
otb::GenericRSTransform
This is the class to handle generic remote sensing transform.
Definition: otbGenericRSTransform.h:57
otb::MultiDisparityMapTo3DFilter::RSTransformType
otb::GenericRSTransform< PrecisionType, 3, 3 > RSTransformType
Definition: otbMultiDisparityMapTo3DFilter.h:87
otb::MultiDisparityMapTo3DFilter::MaskImageType
TMaskImage MaskImageType
Definition: otbMultiDisparityMapTo3DFilter.h:78
otbLineOfSightOptimizer.h
otb::GenericRSTransform::InputPointType
itk::Point< ScalarType, NInputDimensions > InputPointType
Definition: otbGenericRSTransform.h:72
otb::MultiDisparityMapTo3DFilter::PointSetType
OptimizerType::PointSetType PointSetType
Definition: otbMultiDisparityMapTo3DFilter.h:93
otb::LineOfSightOptimizer::PointSetType
itk::PointSet< TLabel, 3, MeshType > PointSetType
Definition: otbLineOfSightOptimizer.h:61
otb::MultiDisparityMapTo3DFilter::RegionType
OutputImageType::RegionType RegionType
Definition: otbMultiDisparityMapTo3DFilter.h:81
otbGenericRSTransform.h
otb::MultiDisparityMapTo3DFilter::PointsContainer
PointSetType::PointsContainer PointsContainer
Definition: otbMultiDisparityMapTo3DFilter.h:94
otb::MultiDisparityMapTo3DFilter::ResidueImageType
TResidueImage ResidueImageType
Definition: otbMultiDisparityMapTo3DFilter.h:79
otbMultiDisparityMapTo3DFilter.hxx
otb::MultiDisparityMapTo3DFilter::DisparityMapType
TDisparityImage DisparityMapType
Definition: otbMultiDisparityMapTo3DFilter.h:73
otb::ImageMetadata
Generic class containing image metadata used in OTB.
Definition: otbImageMetadata.h:270
otb::MultiDisparityMapTo3DFilter
Project a group of disparity map into 3D points.
Definition: otbMultiDisparityMapTo3DFilter.h:60
otb::MultiDisparityMapTo3DFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbMultiDisparityMapTo3DFilter.h:77
otb::MultiDisparityMapTo3DFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbMultiDisparityMapTo3DFilter.h:66
otb::MultiDisparityMapTo3DFilter::LabelContainer
PointSetType::PointDataContainer LabelContainer
Definition: otbMultiDisparityMapTo3DFilter.h:95
otb::MultiDisparityMapTo3DFilter::TDPointType
RSTransformType::InputPointType TDPointType
Definition: otbMultiDisparityMapTo3DFilter.h:90