OTB  10.0.0
Orfeo Toolbox
otbDSFusionOfClassifiersImageFilter.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 otbDSFusionOfClassifiersImageFilter_h
22 #define otbDSFusionOfClassifiersImageFilter_h
23 
24 #include "itkImageToImageFilter.h"
25 #include "otbVectorImage.h"
26 #include "otbImage.h"
27 
28 namespace otb
29 {
68 template <class TInputImage, class TOutputImage, class TMaskImage = TOutputImage>
69 class ITK_EXPORT DSFusionOfClassifiersImageFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
70 {
71 public:
74  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
75  typedef itk::SmartPointer<Self> Pointer;
76  typedef itk::SmartPointer<const Self> ConstPointer;
77 
79  itkNewMacro(Self);
80 
82  itkTypeMacro(DSFusionOfClassifiersImageFilter, ImageToImageFilter);
83 
84  // TInputImage is expected to be a vector image
85  typedef TInputImage InputImageType;
86  typedef typename InputImageType::ConstPointer InputImageConstPointerType;
87  typedef typename InputImageType::InternalPixelType ValueType;
88  typedef typename InputImageType::PixelType PixelType;
89  typedef typename InputImageType::InternalPixelType InternalPixelType;
90 
91  // TMaskImage is expected to be a mono band image
92  typedef TMaskImage MaskImageType;
93  typedef typename MaskImageType::ConstPointer MaskImageConstPointerType;
94  typedef typename MaskImageType::Pointer MaskImagePointerType;
95 
96  // TOutputImage is expected to be a mono band image
97  typedef TOutputImage OutputImageType;
98  typedef typename OutputImageType::Pointer OutputImagePointerType;
99  typedef typename OutputImageType::RegionType OutputImageRegionType;
100  typedef typename OutputImageType::PixelType LabelType;
101 
102  typedef double MassType;
103  typedef typename std::map<LabelType, MassType> LabelMassMapType;
104  typedef typename std::map<LabelType, unsigned int> ClassifierHistogramType;
105  typedef typename std::vector<LabelMassMapType> VectorOfMapOfMassesOfBeliefType;
106 
107 
109  itkSetMacro(LabelForNoDataPixels, LabelType);
110  itkGetMacro(LabelForNoDataPixels, LabelType);
112 
114  itkSetMacro(LabelForUndecidedPixels, LabelType);
115  itkGetMacro(LabelForUndecidedPixels, LabelType);
117 
118 
125  void SetInputMask(const MaskImageType* mask);
126 
127  void SetInputMapsOfMassesOfBelief(const VectorOfMapOfMassesOfBeliefType* ptrVectorOfMapOfMassesOfBelief);
128 
134 
136 
138 
139 
140 protected:
143 
146  {
147  }
148 
150  void GenerateOutputInformation() override;
151 
153  void DynamicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread) override;
154 
156  void BeforeThreadedGenerateData() override;
157 
159  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
160 
161 private:
163  void operator=(const Self&) = delete;
164 
165  unsigned int m_NumberOfClassifiers;
168 
170  std::vector<MassType> m_VectorOfUniverseMOBs;
171 
174 
177 };
178 } // End namespace otb
179 #ifndef OTB_MANUAL_INSTANTIATION
181 #endif
182 
183 #endif
Performs a fusion of n classification maps using the Dempster Shafer (noted DS) rule of combination.
const MaskImageType * GetInputMask(void)
void SetInputMask(const MaskImageType *mask)
std::map< LabelType, unsigned int > ClassifierHistogramType
const LabelType OptimizedDSMassCombination(PixelType vectorPixelValue)
void PrintSelf(std::ostream &os, itk::Indent indent) const override
void operator=(const Self &)=delete
const VectorOfMapOfMassesOfBeliefType * GetInputMapsOfMassesOfBelief(void)
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
DSFusionOfClassifiersImageFilter(const Self &)=delete
std::vector< LabelMassMapType > VectorOfMapOfMassesOfBeliefType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
void SetInputMapsOfMassesOfBelief(const VectorOfMapOfMassesOfBeliefType *ptrVectorOfMapOfMassesOfBelief)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.