OTB  9.0.0
Orfeo Toolbox
otbSOMImageClassificationFilter.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 otbSOMImageClassificationFilter_h
22 #define otbSOMImageClassificationFilter_h
23 
24 #include "otbSOMClassifier.h"
25 #include "itkInPlaceImageFilter.h"
26 #include "itkListSample.h"
27 
28 namespace otb
29 {
44 template <class TInputImage, class TOutputImage, class TSOMMap, class TMaskImage = TOutputImage>
45 class ITK_EXPORT SOMImageClassificationFilter : public itk::InPlaceImageFilter<TInputImage, TOutputImage>
46 {
47 public:
50  typedef itk::InPlaceImageFilter<TInputImage, TOutputImage> Superclass;
51  typedef itk::SmartPointer<Self> Pointer;
52  typedef itk::SmartPointer<const Self> ConstPointer;
53 
55  itkNewMacro(Self);
56 
58  itkTypeMacro(SOMImageClassificationFilter, InPlaceImageFilter);
59 
60  typedef TInputImage InputImageType;
61  typedef typename InputImageType::ConstPointer InputImageConstPointerType;
62  typedef typename InputImageType::InternalPixelType ValueType;
63 
64  typedef TMaskImage MaskImageType;
65  typedef typename MaskImageType::ConstPointer MaskImageConstPointerType;
66  typedef typename MaskImageType::Pointer MaskImagePointerType;
67 
68  typedef TOutputImage OutputImageType;
69  typedef typename OutputImageType::Pointer OutputImagePointerType;
70  typedef typename OutputImageType::RegionType OutputImageRegionType;
71  typedef typename OutputImageType::PixelType LabelType;
72 
73  typedef TSOMMap SOMMapType;
74  typedef typename SOMMapType::Pointer SOMMapPointerType;
75  typedef typename SOMMapType::PixelType SampleType;
76 
77  typedef itk::Statistics::ListSample<SampleType> ListSampleType;
78  typedef typename ListSampleType::Pointer ListSamplePointerType;
81 
83  itkSetObjectMacro(Map, SOMMapType);
84  itkGetObjectMacro(Map, SOMMapType);
86 
88  itkSetMacro(DefaultLabel, LabelType);
89  itkGetMacro(DefaultLabel, LabelType);
91 
96  void SetInputMask(const MaskImageType* mask);
97 
102  const MaskImageType* GetInputMask(void);
103 
104 protected:
107 
110  {
111  }
112 
114  void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) override;
115 
117  void BeforeThreadedGenerateData() override;
118 
120  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
121 
122 private:
123  SOMImageClassificationFilter(const Self&) = delete;
124  void operator=(const Self&) = delete;
125 
128 
131 };
132 } // End namespace otb
133 #ifndef OTB_MANUAL_INSTANTIATION
135 #endif
136 
137 #endif
otb::SOMImageClassificationFilter::SOMMapType
TSOMMap SOMMapType
Definition: otbSOMImageClassificationFilter.h:73
otb::SOMImageClassificationFilter::ListSampleType
itk::Statistics::ListSample< SampleType > ListSampleType
Definition: otbSOMImageClassificationFilter.h:77
otb::SOMImageClassificationFilter::m_DefaultLabel
LabelType m_DefaultLabel
Definition: otbSOMImageClassificationFilter.h:130
otbSOMImageClassificationFilter.hxx
otb::SOMImageClassificationFilter::MaskImageType
TMaskImage MaskImageType
Definition: otbSOMImageClassificationFilter.h:64
otb::SOMImageClassificationFilter::~SOMImageClassificationFilter
~SOMImageClassificationFilter() override
Definition: otbSOMImageClassificationFilter.h:109
otb::SOMImageClassificationFilter::Self
SOMImageClassificationFilter Self
Definition: otbSOMImageClassificationFilter.h:49
otb::SOMImageClassificationFilter
This filter performs the classification of a VectorImage using a given SOM map.
Definition: otbSOMImageClassificationFilter.h:45
otb::SOMImageClassificationFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbSOMImageClassificationFilter.h:52
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::SOMImageClassificationFilter::MaskImageConstPointerType
MaskImageType::ConstPointer MaskImageConstPointerType
Definition: otbSOMImageClassificationFilter.h:65
otb::SOMImageClassificationFilter::ClassifierPointerType
ClassifierType::Pointer ClassifierPointerType
Definition: otbSOMImageClassificationFilter.h:80
otb::SOMImageClassificationFilter::OutputImageType
TOutputImage OutputImageType
Definition: otbSOMImageClassificationFilter.h:68
otb::SOMImageClassificationFilter::SOMMapPointerType
SOMMapType::Pointer SOMMapPointerType
Definition: otbSOMImageClassificationFilter.h:74
otb::SOMImageClassificationFilter::Superclass
itk::InPlaceImageFilter< TInputImage, TOutputImage > Superclass
Definition: otbSOMImageClassificationFilter.h:50
otb::SOMClassifier::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbSOMClassifier.h:53
otb::SOMImageClassificationFilter::ListSamplePointerType
ListSampleType::Pointer ListSamplePointerType
Definition: otbSOMImageClassificationFilter.h:78
otb::SOMImageClassificationFilter::InputImageConstPointerType
InputImageType::ConstPointer InputImageConstPointerType
Definition: otbSOMImageClassificationFilter.h:61
otb::SOMImageClassificationFilter::MaskImagePointerType
MaskImageType::Pointer MaskImagePointerType
Definition: otbSOMImageClassificationFilter.h:66
otb::SOMImageClassificationFilter::m_Map
SOMMapPointerType m_Map
Definition: otbSOMImageClassificationFilter.h:127
otb::SOMImageClassificationFilter::ClassifierType
otb::SOMClassifier< ListSampleType, SOMMapType, LabelType > ClassifierType
Definition: otbSOMImageClassificationFilter.h:79
otb::SOMImageClassificationFilter::OutputImageRegionType
OutputImageType::RegionType OutputImageRegionType
Definition: otbSOMImageClassificationFilter.h:70
otb::SOMImageClassificationFilter::OutputImagePointerType
OutputImageType::Pointer OutputImagePointerType
Definition: otbSOMImageClassificationFilter.h:69
otb::SOMImageClassificationFilter::SampleType
SOMMapType::PixelType SampleType
Definition: otbSOMImageClassificationFilter.h:75
otb::SOMImageClassificationFilter::LabelType
OutputImageType::PixelType LabelType
Definition: otbSOMImageClassificationFilter.h:71
otb::SOMClassifier
This class implements a SOM-Based classifier.
Definition: otbSOMClassifier.h:47
otb::SOMImageClassificationFilter::InputImageType
TInputImage InputImageType
Definition: otbSOMImageClassificationFilter.h:58
otbSOMClassifier.h
otb::SOMImageClassificationFilter::ValueType
InputImageType::InternalPixelType ValueType
Definition: otbSOMImageClassificationFilter.h:62
otb::SOMImageClassificationFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbSOMImageClassificationFilter.h:51