OTB  9.0.0
Orfeo Toolbox
otbImageDimensionalityReductionFilter.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 #ifndef otbImageDimensionalityReduction_h
21 #define otbImageDimensionalityReduction_h
22 
23 #include "itkImageToImageFilter.h"
25 #include "otbImage.h"
26 
27 namespace otb
28 {
41 template <class TInputImage, class TOutputImage, class TMaskImage = TOutputImage>
42 class ITK_EXPORT ImageDimensionalityReductionFilter : public itk::ImageToImageFilter<TInputImage, TOutputImage>
43 {
44 public:
47  typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
48  typedef itk::SmartPointer<Self> Pointer;
49  typedef itk::SmartPointer<const Self> ConstPointer;
50 
52  itkNewMacro(Self);
53 
55  itkTypeMacro(ImageDimensionalityReductionFilter, ImageToImageFilter);
56 
57  typedef TInputImage InputImageType;
58  typedef typename InputImageType::ConstPointer InputImageConstPointerType;
59  typedef typename InputImageType::InternalPixelType ValueType;
60 
61  typedef TMaskImage MaskImageType;
62  typedef typename MaskImageType::ConstPointer MaskImageConstPointerType;
63  typedef typename MaskImageType::Pointer MaskImagePointerType;
64 
65  typedef TOutputImage OutputImageType;
66  typedef typename OutputImageType::Pointer OutputImagePointerType;
67  typedef typename OutputImageType::RegionType OutputImageRegionType;
68  typedef typename OutputImageType::InternalPixelType LabelType;
69 
70  typedef MachineLearningModel<itk::VariableLengthVector<ValueType>, itk::VariableLengthVector<LabelType>> ModelType;
72 
75 
77  itkSetObjectMacro(Model, ModelType);
78  itkGetObjectMacro(Model, ModelType);
80 
82  itkSetMacro(DefaultLabel, LabelType);
83  itkGetMacro(DefaultLabel, LabelType);
85 
87  itkSetMacro(UseConfidenceMap, bool);
88  itkGetMacro(UseConfidenceMap, bool);
90 
91  itkSetMacro(BatchMode, bool);
92  itkGetMacro(BatchMode, bool);
93  itkBooleanMacro(BatchMode);
94 
100  void SetInputMask(const MaskImageType* mask);
101 
106  const MaskImageType* GetInputMask(void);
107 
111  ConfidenceImageType* GetOutputConfidence(void);
112 
113 protected:
116 
119  {
120  }
121 
123  virtual void GenerateOutputInformation() override;
124 
126  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
127  void ClassicThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId);
128  void BatchThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId);
129 
131  void BeforeThreadedGenerateData() override;
132 
134  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
135 
136 private:
137  ImageDimensionalityReductionFilter(const Self&) = delete;
138  void operator=(const Self&) = delete;
139 
142 
145 
149 };
150 } // End namespace otb
151 #ifndef OTB_MANUAL_INSTANTIATION
153 #endif
154 
155 #endif
otb::ImageDimensionalityReductionFilter::Self
ImageDimensionalityReductionFilter Self
Definition: otbImageDimensionalityReductionFilter.h:46
otbImageDimensionalityReductionFilter.hxx
otb::ImageDimensionalityReductionFilter::MaskImageConstPointerType
MaskImageType::ConstPointer MaskImageConstPointerType
Definition: otbImageDimensionalityReductionFilter.h:62
otb::ImageDimensionalityReductionFilter::MaskImageType
TMaskImage MaskImageType
Definition: otbImageDimensionalityReductionFilter.h:61
otbImage.h
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::ImageDimensionalityReductionFilter::ValueType
InputImageType::InternalPixelType ValueType
Definition: otbImageDimensionalityReductionFilter.h:59
otb::ImageDimensionalityReductionFilter::m_UseConfidenceMap
bool m_UseConfidenceMap
Definition: otbImageDimensionalityReductionFilter.h:147
otb::ImageDimensionalityReductionFilter::m_DefaultLabel
LabelType m_DefaultLabel
Definition: otbImageDimensionalityReductionFilter.h:144
otb::ImageDimensionalityReductionFilter::InputImageType
TInputImage InputImageType
Definition: otbImageDimensionalityReductionFilter.h:55
otb::ImageDimensionalityReductionFilter::ModelType
MachineLearningModel< itk::VariableLengthVector< ValueType >, itk::VariableLengthVector< LabelType > > ModelType
Definition: otbImageDimensionalityReductionFilter.h:70
otb::ImageDimensionalityReductionFilter::m_Model
ModelPointerType m_Model
Definition: otbImageDimensionalityReductionFilter.h:141
otb::ImageDimensionalityReductionFilter::LabelType
OutputImageType::InternalPixelType LabelType
Definition: otbImageDimensionalityReductionFilter.h:68
otbMachineLearningModel.h
otb::ImageDimensionalityReductionFilter
Definition: otbImageDimensionalityReductionFilter.h:42
otb::ImageDimensionalityReductionFilter::MaskImagePointerType
MaskImageType::Pointer MaskImagePointerType
Definition: otbImageDimensionalityReductionFilter.h:63
otb::ImageDimensionalityReductionFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbImageDimensionalityReductionFilter.h:49
otb::ImageDimensionalityReductionFilter::m_BatchMode
bool m_BatchMode
Definition: otbImageDimensionalityReductionFilter.h:148
otb::ImageDimensionalityReductionFilter::~ImageDimensionalityReductionFilter
~ImageDimensionalityReductionFilter() override
Definition: otbImageDimensionalityReductionFilter.h:118
otb::ImageDimensionalityReductionFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbImageDimensionalityReductionFilter.h:67
otb::MachineLearningModel::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbMachineLearningModel.h:77
otb::MachineLearningModel
MachineLearningModel is the base class for all classifier objects (SVM, KNN, Random Forests,...
Definition: otbMachineLearningModel.h:70
otb::ImageDimensionalityReductionFilter::ModelPointerType
ModelType::Pointer ModelPointerType
Definition: otbImageDimensionalityReductionFilter.h:71
otb::ImageDimensionalityReductionFilter::OutputImagePointerType
OutputImageType::Pointer OutputImagePointerType
Definition: otbImageDimensionalityReductionFilter.h:66
otb::ImageDimensionalityReductionFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbImageDimensionalityReductionFilter.h:65
otb::ImageDimensionalityReductionFilter::Superclass
itk::ImageToImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbImageDimensionalityReductionFilter.h:47
otb::Image::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbImage.h:97
otb::ImageDimensionalityReductionFilter::InputImageConstPointerType
InputImageType::ConstPointer InputImageConstPointerType
Definition: otbImageDimensionalityReductionFilter.h:58
otb::ImageDimensionalityReductionFilter::ConfidenceImagePointerType
ConfidenceImageType::Pointer ConfidenceImagePointerType
Definition: otbImageDimensionalityReductionFilter.h:74
otb::ImageDimensionalityReductionFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbImageDimensionalityReductionFilter.h:48
otb::ImageDimensionalityReductionFilter::ConfidenceImageType
otb::Image< double > ConfidenceImageType
Definition: otbImageDimensionalityReductionFilter.h:73