OTB  10.0.0
Orfeo Toolbox
otbSOMbasedImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
3  * Copyright (C) 2007-2012 Institut Mines Telecom / Telecom Bretagne
4  *
5  * This file is part of Orfeo Toolbox
6  *
7  * https://www.orfeo-toolbox.org/
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21 
22 #ifndef otbSOMbasedImageFilter_h
23 #define otbSOMbasedImageFilter_h
24 
25 #include "itkMacro.h"
26 #include "itkUnaryFunctorImageFilter.h"
27 
28 namespace otb
29 {
30 
31 namespace Functor
32 {
33 
43 template <class TInput, class TOutput, class TDistanceMetric, class TMap>
45 {
46 public:
49  typedef TMap MapType;
50  typedef typename MapType::Pointer MapPointerType;
51  typedef typename MapType::IndexType IndexType;
52  typedef typename MapType::PixelType NeuronType;
53 
54  typedef TDistanceMetric DistanceType;
55  typedef typename DistanceType::Pointer DistancePointerType;
56 
59  {
60  }
62  {
63  }
65 
67  TOutput operator()(const TInput& input);
68 
70  MapType* GetMap() const
71  {
72  return this->m_Map;
73  }
74  void SetMap(const MapType* theMap);
76 
79  {
80  return this->m_Distance;
81  }
82 
83 protected:
86  IndexType GetWinner(const NeuronType& sample);
87 
90 
91 private:
92  SOMbasedImageFilterFunctor(const Self&); // not implemented
93  void operator=(const Self&); // not implemented
94 };
95 
96 } // end of namespace Functor
97 
116 template <class TInputImage, class TOutputImage, class TDistanceMetric, class TMap>
117 class ITK_EXPORT SOMbasedImageFilter
118  : public itk::UnaryFunctorImageFilter<
119  TInputImage, TOutputImage,
120  Functor::SOMbasedImageFilterFunctor<typename TInputImage::PixelType, typename TOutputImage::PixelType, TDistanceMetric, TMap>>
121 {
122 public:
125  typedef typename itk::UnaryFunctorImageFilter<
128  typedef itk::SmartPointer<Self> Pointer;
129  typedef itk::SmartPointer<const Self> ConstPointer;
130 
132  itkNewMacro(Self);
133 
135  itkTypeMacro(SOMbasedImageFilter, UnaryFunctorImageFilter);
136 
138  typedef TDistanceMetric DistanceMetricType;
139  typedef typename DistanceMetricType::Pointer DistanceMetricPointerType;
140 
141  typedef TMap MapType;
142  typedef typename MapType::Pointer MapPointerType;
143 
145 
147  typedef typename TInputImage::PixelType MeasurementType;
148 
150  void SetMap(const MapType* theMap);
151 
152 protected:
153  // throw the Map to the functor
154  void BeforeThreadedGenerateData(void) override;
155 
158  {
159  }
160 
161 private:
163  void operator=(const Self&) = delete;
164 
166 
167 }; // end of class SOMbasedImageFilter
168 
169 } // end of namespace otb
170 
171 #ifndef OTB_MANUAL_INSTANTIATION
173 #endif
174 
175 #endif
This class implements the functor that perform substitution between input image pixels and the corres...
This class perform the substitution between initial input image pixels and the winning neurons of a S...
Functor::SOMbasedImageFilterFunctor< typename TInputImage::PixelType, typename TOutputImage::PixelType, TDistanceMetric, TMap > FunctorType
itk::UnaryFunctorImageFilter< TInputImage, TOutputImage, Functor::SOMbasedImageFilterFunctor< typename TInputImage::PixelType, typename TOutputImage::PixelType, TDistanceMetric, TMap > > Superclass
void operator=(const Self &)=delete
itk::SmartPointer< const Self > ConstPointer
DistanceMetricType::Pointer DistanceMetricPointerType
TInputImage::PixelType MeasurementType
SOMbasedImageFilter(const Self &)
itk::SmartPointer< Self > Pointer
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.