OTB  9.0.0
Orfeo Toolbox
otbDisparityMapMedianFilter.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 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
143 
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
otb::DisparityMapMedianFilter
Applies a median filter to a monoband disparity map with an associated mask.
Definition: otbDisparityMapMedianFilter.h:74
otb::DisparityMapMedianFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbDisparityMapMedianFilter.h:84
otb::DisparityMapMedianFilter::SetRadius
void SetRadius(unsigned int radius)
Definition: otbDisparityMapMedianFilter.h:132
otb::DisparityMapMedianFilter::SizeType
InputImageType::SizeType SizeType
Definition: otbDisparityMapMedianFilter.h:108
otbImage.h
otb::DisparityMapMedianFilter::Superclass
itk::ImageToImageFilter< InputImageType, OutputImageType > Superclass
Definition: otbDisparityMapMedianFilter.h:90
otb::DisparityMapMedianFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbDisparityMapMedianFilter.h:91
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::DisparityMapMedianFilter::m_Radius
SizeType m_Radius
Definition: otbDisparityMapMedianFilter.h:177
otb::DisparityMapMedianFilter::InputImageRegionType
InputImageType::RegionType InputImageRegionType
Definition: otbDisparityMapMedianFilter.h:106
otb::DisparityMapMedianFilter::IndexValueType
OutputImageType::IndexValueType IndexValueType
Definition: otbDisparityMapMedianFilter.h:109
otb::DisparityMapMedianFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbDisparityMapMedianFilter.h:107
otb::DisparityMapMedianFilter::Self
DisparityMapMedianFilter Self
Definition: otbDisparityMapMedianFilter.h:89
otb::DisparityMapMedianFilter::MaskImagePixelType
MaskImageType::PixelType MaskImagePixelType
Definition: otbDisparityMapMedianFilter.h:103
otb::DisparityMapMedianFilter::~DisparityMapMedianFilter
~DisparityMapMedianFilter() override
Definition: otbDisparityMapMedianFilter.h:153
otb::DisparityMapMedianFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbDisparityMapMedianFilter.h:92
otb::DisparityMapMedianFilter::InputPixelType
InputImageType::PixelType InputPixelType
Definition: otbDisparityMapMedianFilter.h:98
otb::DisparityMapMedianFilter::OutputPixelType
OutputImageType::PixelType OutputPixelType
Definition: otbDisparityMapMedianFilter.h:102
otbDisparityMapMedianFilter.hxx
otb::DisparityMapMedianFilter::m_IncoherenceThreshold
double m_IncoherenceThreshold
Definition: otbDisparityMapMedianFilter.h:180
otb::DisparityMapMedianFilter::InputImageType
TInputImage InputImageType
Definition: otbDisparityMapMedianFilter.h:83
otb::DisparityMapMedianFilter::MaskImagePointerType
MaskImageType::Pointer MaskImagePointerType
Definition: otbDisparityMapMedianFilter.h:104
otb::DisparityMapMedianFilter::MaskImageType
TMask MaskImageType
Definition: otbDisparityMapMedianFilter.h:85