OTB  9.0.0
Orfeo Toolbox
otbLabelMapClassifier.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 otbLabelMapClassifier_h
22 #define otbLabelMapClassifier_h
23 
24 #include "itkInPlaceLabelMapFilter.h"
26 #include "itkListSample.h"
28 
29 namespace otb
30 {
31 
41 template <class TInputLabelMap>
42 class ITK_EXPORT LabelMapClassifier : public itk::InPlaceLabelMapFilter<TInputLabelMap>
43 {
44 public:
47  typedef itk::InPlaceLabelMapFilter<TInputLabelMap> Superclass;
48  typedef itk::SmartPointer<Self> Pointer;
49  typedef itk::SmartPointer<const Self> ConstPointer;
50 
52  typedef TInputLabelMap LabelMapType;
53  typedef typename LabelMapType::Pointer LabelMapPointer;
54  typedef typename LabelMapType::ConstPointer LabelMaponstPointer;
55  typedef typename LabelMapType::LabelObjectType LabelObjectType;
56 
57  typedef typename LabelObjectType::AttributesValueType AttributesValueType;
58  typedef typename LabelObjectType::ClassLabelType ClassLabelType;
59 
61  itkStaticConstMacro(InputImageDimension, unsigned int, TInputLabelMap::ImageDimension);
62 
65  typedef typename ModelType::Pointer ModelPointer;
68 
70  itkNewMacro(Self);
71 
73  itkTypeMacro(LabelMapClassifier, itk::InPlaceLabelMapFilter);
74 
75  itkSetObjectMacro(Model, ModelType);
76 
78  {
79  m_MeasurementFunctor = functor;
80  }
81 
83  {
84  return m_MeasurementFunctor;
85  }
86 
87 protected:
89  ~LabelMapClassifier() override = default;
90 
91  void ThreadedProcessLabelObject(LabelObjectType* labelObject) override;
92 
93  void ReleaseInputs() override;
94 
95 
96 private:
97  LabelMapClassifier(const Self&) = delete;
98  void operator=(const Self&) = delete;
99 
102 
105 
106 }; // end of class
107 
108 } // end namespace otb
109 
110 #ifndef OTB_MANUAL_INSTANTIATION
111 #include "otbLabelMapClassifier.hxx"
112 #endif
113 
114 #endif
otbAttributesMapLabelObject.h
otb::LabelMapClassifier::ModelPointer
ModelType::Pointer ModelPointer
Definition: otbLabelMapClassifier.h:65
otb::LabelMapClassifier::LabelMaponstPointer
LabelMapType::ConstPointer LabelMaponstPointer
Definition: otbLabelMapClassifier.h:54
otb::LabelMapClassifier::ClassLabelType
LabelObjectType::ClassLabelType ClassLabelType
Definition: otbLabelMapClassifier.h:58
otb::LabelMapClassifier::LabelObjectType
LabelMapType::LabelObjectType LabelObjectType
Definition: otbLabelMapClassifier.h:55
otb::LabelMapClassifier::Superclass
itk::InPlaceLabelMapFilter< TInputLabelMap > Superclass
Definition: otbLabelMapClassifier.h:47
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otbLabelMapClassifier.hxx
otb::LabelMapClassifier::AttributesValueType
LabelObjectType::AttributesValueType AttributesValueType
Definition: otbLabelMapClassifier.h:57
otb::LabelMapClassifier::m_Model
ModelPointer m_Model
Definition: otbLabelMapClassifier.h:101
otbMachineLearningModel.h
otb::Functor::AttributesMapMeasurementFunctor< LabelObjectType, MeasurementVectorType >
otb::LabelMapClassifier::LabelMapType
TInputLabelMap LabelMapType
Definition: otbLabelMapClassifier.h:52
otb::LabelMapClassifier::LabelMapPointer
LabelMapType::Pointer LabelMapPointer
Definition: otbLabelMapClassifier.h:53
otb::LabelMapClassifier::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbLabelMapClassifier.h:48
otb::LabelMapClassifier::MeasurementFunctorType
Functor::AttributesMapMeasurementFunctor< LabelObjectType, MeasurementVectorType > MeasurementFunctorType
Definition: otbLabelMapClassifier.h:67
otb::LabelMapClassifier::GetMeasurementFunctor
MeasurementFunctorType & GetMeasurementFunctor()
Definition: otbLabelMapClassifier.h:82
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::LabelMapClassifier::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbLabelMapClassifier.h:49
otb::LabelMapClassifier::SetMeasurementFunctor
void SetMeasurementFunctor(const MeasurementFunctorType &functor)
Definition: otbLabelMapClassifier.h:77
otb::LabelMapClassifier::ModelType
MachineLearningModel< AttributesValueType, ClassLabelType > ModelType
Definition: otbLabelMapClassifier.h:64
otb::LabelMapClassifier::m_MeasurementFunctor
MeasurementFunctorType m_MeasurementFunctor
Definition: otbLabelMapClassifier.h:104
otb::LabelMapClassifier::MeasurementVectorType
ModelType::InputSampleType MeasurementVectorType
Definition: otbLabelMapClassifier.h:66
otb::LabelMapClassifier::Self
LabelMapClassifier Self
Definition: otbLabelMapClassifier.h:46
otb::LabelMapClassifier
Classify each LabelObject of the input LabelMap in place.
Definition: otbLabelMapClassifier.h:42
otb::MachineLearningModel::InputSampleType
MLMSampleTraits< TInputValue >::SampleType InputSampleType
Definition: otbMachineLearningModel.h:84