OTB  10.0.0
Orfeo Toolbox
otbDisparityMapMedianFilter.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 otbDisparityMapMedianFilter_h
22 #define otbDisparityMapMedianFilter_h
23 
24 #ifdef ITK_USE_CONSOLIDATED_MORPHOLOGY
25 #include "itkOptMedianImageFilter.h"
26 #else
27 
28 #include "itkImageToImageFilter.h"
29 #include "otbImage.h"
30 
31 namespace otb
32 {
73 template <class TInputImage, class TOutputImage, class TMask>
74 class ITK_EXPORT DisparityMapMedianFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
75 {
76 public:
78  itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
79  itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension);
81 
83  typedef TInputImage InputImageType;
84  typedef TOutputImage OutputImageType;
85  typedef TMask MaskImageType;
86 
87 
90  typedef itk::ImageToImageFilter<InputImageType, OutputImageType> Superclass;
91  typedef itk::SmartPointer<Self> Pointer;
92  typedef itk::SmartPointer<const Self> ConstPointer;
93 
95  itkNewMacro(Self);
96 
98  itkTypeMacro(DisparityMapMedianFilter, ImageToImageFilter);
99 
101  typedef typename InputImageType::PixelType InputPixelType;
102  typedef typename OutputImageType::PixelType OutputPixelType;
103  typedef typename MaskImageType::PixelType MaskImagePixelType;
104  typedef typename MaskImageType::Pointer MaskImagePointerType;
105 
106  typedef typename InputImageType::RegionType InputImageRegionType;
107  typedef typename OutputImageType::RegionType OutputImageRegionType;
108  typedef typename InputImageType::SizeType SizeType;
109  typedef typename OutputImageType::IndexValueType IndexValueType;
110 
112  void SetMaskInput(const TMask* inputmask); // mask corresponding to the subpixel disparity map
113 
115  const TMask* GetMaskInput();
116 
118  TMask* GetOutputMask(); // mask corresponding to the median disparity map
119 
121  TOutputImage* GetOutputDisparityMap(); // input disparity map updated (incoherences between median and input disparity map are removed)
122 
124  TMask* GetOutputDisparityMask();
125 
127  itkSetMacro(Radius, SizeType);
128  itkGetMacro(Radius, SizeType);
130 
132  void SetRadius(unsigned int radius)
133  {
134  m_Radius.Fill(radius);
135  }
136 
138  itkSetMacro(IncoherenceThreshold, double);
139  itkGetMacro(IncoherenceThreshold, double);
141 
142 #ifdef ITK_USE_CONCEPT_CHECKING
144  itkConceptMacro(SameDimensionCheck, (itk::Concept::SameDimension<InputImageDimension, OutputImageDimension>));
145  itkConceptMacro(InputConvertibleToOutputCheck, (itk::Concept::Convertible<InputPixelType, OutputPixelType>));
146  itkConceptMacro(InputLessThanComparableCheck, (itk::Concept::LessThanComparable<InputPixelType>));
147 
149 #endif
150 
151 protected:
154  {
155  }
156  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
157 
164  void GenerateInputRequestedRegion() override;
165 
167  void GenerateOutputInformation(void) override;
168 
170  void GenerateData() override;
171 
172 private:
173  DisparityMapMedianFilter(const Self&) = delete;
174  void operator=(const Self&) = delete;
175 
178 
181 };
182 
183 } // end namespace otb
184 
185 #ifndef OTB_MANUAL_INSTANTIATION
187 #endif
188 
189 #endif
190 
191 #endif
Applies a median filter to a monoband disparity map with an associated mask.
OutputImageType::IndexValueType IndexValueType
MaskImageType::PixelType MaskImagePixelType
InputImageType::PixelType InputPixelType
DisparityMapMedianFilter(const Self &)=delete
InputImageType::RegionType InputImageRegionType
OutputImageType::PixelType OutputPixelType
itk::SmartPointer< const Self > ConstPointer
OutputImageType::RegionType OutputImageRegionType
void operator=(const Self &)=delete
itk::ImageToImageFilter< InputImageType, OutputImageType > Superclass
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.