OTB  9.0.0
Orfeo Toolbox
otbAdhesionCorrectionFilter.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 otbAdhesionCorrectionFilter_h
22 #define otbAdhesionCorrectionFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 #include "otbImage.h"
26 #include "itkConstNeighborhoodIterator.h"
27 #include "itkImageRegionConstIterator.h"
28 #include "itkImageLinearConstIteratorWithIndex.h"
29 #include <algorithm>
30 
31 namespace otb
32 {
33 
69 template <class TImage, class TMask>
70 class ITK_EXPORT AdhesionCorrectionFilter : public itk::ImageToImageFilter<TImage, TImage>
71 {
72 public:
75  typedef itk::ImageToImageFilter<TImage, TImage> Superclass;
76  typedef itk::SmartPointer<Self> Pointer;
77  typedef itk::SmartPointer<const Self> ConstPointer;
78 
80  itkNewMacro(Self);
81 
83  itkTypeMacro(AdhesionCorrectionFilter, ImageToImageFilter);
84 
86  typedef typename TImage::RegionType ImageRegionType;
87  typedef typename TImage::PixelType PixelType;
88  typedef typename TImage::Pointer ImagePointerType;
89  typedef typename TImage::SizeType SizeType;
90  typedef typename TImage::IndexType IndexType;
91  typedef typename TImage::SpacingType SpacingType;
92  typedef typename TImage::PointType PointType;
93  typedef typename TImage::OffsetType OffsetType;
94  typedef typename TMask::Pointer MaskImagePointerType;
95  typedef typename TMask::PixelType MaskImagePixelType;
96 
97  typedef itk::ConstNeighborhoodIterator<TImage> NeighborhoodIteratorType;
98 
101 
102  typedef std::vector<int> IntVectorType;
103 
105  void SetMedianDisparityInput(const TImage* medianmap);
106  void SetMedianMaskInput(const TMask* medianmask);
107  void SetEdgesDisparityInput(const TImage* cannymedianmap);
108  void SetSubPixelMaskInput(const TMask* subpixelmask);
110 
112  const TImage* GetMedianDisparityInput();
113  const TMask* GetMedianMaskInput();
114  const TImage* GetEdgesDisparityInput();
115  const TMask* GetSubPixelMaskInput();
117 
119  TMask* GetOutputMask(); // mask corresponding to the corrected disparity map
120 
122  TImage* GetOutputRiskEdges();
123 
125  itkSetMacro(Radius, SizeType);
126  itkGetMacro(Radius, SizeType);
128 
130  void SetRadius(unsigned int radius)
131  {
132  m_Radius.Fill(radius);
133  }
134 
136  itkSetMacro(Tolerance, double);
137  itkGetMacro(Tolerance, double);
139 
141  itkSetMacro(DiscontinuityThreshold, double);
142  itkGetMacro(DiscontinuityThreshold, double);
144 
146  itkSetMacro(DiscontinuityHighThreshold, double);
147  itkGetMacro(DiscontinuityHighThreshold, double);
149 
151  itkSetMacro(MaxEdgeGap, double);
152  itkGetMacro(MaxEdgeGap, double);
154 
156  itkSetMacro(EdgeThreshold, double);
157  itkGetMacro(EdgeThreshold, double);
159 
160 protected:
163 
166 
168  void GenerateData() override;
169 
171  void GenerateInputRequestedRegion(void) override;
172 
174  void GenerateOutputInformation(void) override;
175 
176 private:
177  AdhesionCorrectionFilter(const Self&) = delete;
178  void operator=(const Self&) = delete;
179 
183 
185  double m_Tolerance;
186 
190  double m_MaxEdgeGap;
192 };
193 
194 } // end namespace otb
195 
196 #ifndef OTB_MANUAL_INSTANTIATION
198 #endif
199 
200 #endif
otb::AdhesionCorrectionFilter::AuxImagePointerType
AuxImageType::Pointer AuxImagePointerType
Definition: otbAdhesionCorrectionFilter.h:100
otb::AdhesionCorrectionFilter::m_DiscontinuityHighThreshold
double m_DiscontinuityHighThreshold
Definition: otbAdhesionCorrectionFilter.h:189
otb::AdhesionCorrectionFilter::~AdhesionCorrectionFilter
~AdhesionCorrectionFilter() override
Definition: otbAdhesionCorrectionFilter.h:165
otb::AdhesionCorrectionFilter::SizeType
TImage::SizeType SizeType
Definition: otbAdhesionCorrectionFilter.h:89
otb::AdhesionCorrectionFilter::m_ImageSize
SizeType m_ImageSize
Definition: otbAdhesionCorrectionFilter.h:180
otbImage.h
otb::AdhesionCorrectionFilter::SetRadius
void SetRadius(unsigned int radius)
Definition: otbAdhesionCorrectionFilter.h:130
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Image
Creation of an "otb" image which contains metadata.
Definition: otbImage.h:89
otb::AdhesionCorrectionFilter::m_Radius
SizeType m_Radius
Definition: otbAdhesionCorrectionFilter.h:182
otb::AdhesionCorrectionFilter::ImagePointerType
TImage::Pointer ImagePointerType
Definition: otbAdhesionCorrectionFilter.h:88
otb::AdhesionCorrectionFilter::MaskImagePointerType
TMask::Pointer MaskImagePointerType
Definition: otbAdhesionCorrectionFilter.h:94
otb::AdhesionCorrectionFilter::m_EdgeThreshold
double m_EdgeThreshold
Definition: otbAdhesionCorrectionFilter.h:191
otb::AdhesionCorrectionFilter::Self
AdhesionCorrectionFilter Self
Definition: otbAdhesionCorrectionFilter.h:74
otb::AdhesionCorrectionFilter::Superclass
itk::ImageToImageFilter< TImage, TImage > Superclass
Definition: otbAdhesionCorrectionFilter.h:75
otb::AdhesionCorrectionFilter::AuxImageType
otb::Image< double, 2 > AuxImageType
Definition: otbAdhesionCorrectionFilter.h:99
otb::AdhesionCorrectionFilter::IntVectorType
std::vector< int > IntVectorType
Definition: otbAdhesionCorrectionFilter.h:102
otb::AdhesionCorrectionFilter::m_MaxEdgeGap
double m_MaxEdgeGap
Definition: otbAdhesionCorrectionFilter.h:190
otb::AdhesionCorrectionFilter::OffsetType
TImage::OffsetType OffsetType
Definition: otbAdhesionCorrectionFilter.h:93
otb::AdhesionCorrectionFilter::m_Tolerance
double m_Tolerance
Definition: otbAdhesionCorrectionFilter.h:185
otb::AdhesionCorrectionFilter::MaskImagePixelType
TMask::PixelType MaskImagePixelType
Definition: otbAdhesionCorrectionFilter.h:95
otb::AdhesionCorrectionFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbAdhesionCorrectionFilter.h:77
otb::AdhesionCorrectionFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbAdhesionCorrectionFilter.h:76
otb::AdhesionCorrectionFilter::PixelType
TImage::PixelType PixelType
Definition: otbAdhesionCorrectionFilter.h:87
otbAdhesionCorrectionFilter.hxx
otb::AdhesionCorrectionFilter::SpacingType
TImage::SpacingType SpacingType
Definition: otbAdhesionCorrectionFilter.h:91
otb::Image::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbImage.h:97
otb::AdhesionCorrectionFilter
This filter eliminates pixels risking adhesion from the input disparity map. To do so it applies the ...
Definition: otbAdhesionCorrectionFilter.h:70
otb::AdhesionCorrectionFilter::PointType
TImage::PointType PointType
Definition: otbAdhesionCorrectionFilter.h:92
otb::AdhesionCorrectionFilter::IndexType
TImage::IndexType IndexType
Definition: otbAdhesionCorrectionFilter.h:90
otb::AdhesionCorrectionFilter::ImageRegionType
TImage::RegionType ImageRegionType
Definition: otbAdhesionCorrectionFilter.h:83
otb::AdhesionCorrectionFilter::m_DiscontinuityThreshold
double m_DiscontinuityThreshold
Definition: otbAdhesionCorrectionFilter.h:188
otb::AdhesionCorrectionFilter::NeighborhoodIteratorType
itk::ConstNeighborhoodIterator< TImage > NeighborhoodIteratorType
Definition: otbAdhesionCorrectionFilter.h:97