OTB  6.7.0
Orfeo Toolbox
otbLabelMapClassifier.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2019 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 
26 #include "itkListSample.h"
28 
29 namespace otb {
30 
40 template<class TInputLabelMap>
41 class ITK_EXPORT LabelMapClassifier :
42  public itk::InPlaceLabelMapFilter<TInputLabelMap>
43 {
44 public:
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,
62  TInputLabelMap::ImageDimension);
63 
66  typedef typename ModelType::Pointer ModelPointer;
70 
72  itkNewMacro(Self);
73 
75  itkTypeMacro(LabelMapClassifier,
77 
78  itkSetObjectMacro(Model, ModelType);
79 
81  {
82  m_MeasurementFunctor = functor;
83  }
84 
86  {
87  return m_MeasurementFunctor;
88  }
89 
90 protected:
92  ~LabelMapClassifier() override {};
93 
94  void ThreadedProcessLabelObject( LabelObjectType * labelObject ) override;
95 
96  void ReleaseInputs() override;
97 
98 
99 private:
100  LabelMapClassifier(const Self&) = delete;
101  void operator=(const Self&) = delete;
102 
105 
108 
109 }; // end of class
110 
111 } // end namespace otb
112 
113 #ifndef OTB_MANUAL_INSTANTIATION
114 #include "otbLabelMapClassifier.hxx"
115 #endif
116 
117 #endif
118 
119 
MachineLearningModel is the base class for all classifier objects (SVM, KNN, Random Forests...
LabelObjectType::AttributesValueType AttributesValueType
This class allows building a measurement vector from an AttributesMapLabelObject. ...
LabelMapType::ConstPointer LabelMaponstPointer
LabelObjectType::ClassLabelType ClassLabelType
itk::InPlaceLabelMapFilter< TInputLabelMap > Superclass
ModelType::InputSampleType MeasurementVectorType
ModelType::Pointer ModelPointer
itk::SmartPointer< Self > Pointer
LabelMapType::Pointer LabelMapPointer
MeasurementFunctorType m_MeasurementFunctor
Functor::AttributesMapMeasurementFunctor< LabelObjectType, MeasurementVectorType > MeasurementFunctorType
Classify each LabelObject of the input LabelMap in place.
MeasurementFunctorType & GetMeasurementFunctor()
LabelMapType::LabelObjectType LabelObjectType
itk::SmartPointer< const Self > ConstPointer
void SetMeasurementFunctor(const MeasurementFunctorType &functor)
MLMSampleTraits< TInputValue >::SampleType InputSampleType
MachineLearningModel< AttributesValueType, ClassLabelType > ModelType