OTB  10.0.0
Orfeo Toolbox
otbLabelMapFeaturesFunctorImageFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1999-2011 Insight Software Consortium
3  * Copyright (C) 2005-2024 Centre National d'Etudes Spatiales (CNES)
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 otbLabelMapFeaturesFunctorImageFilter_h
23 #define otbLabelMapFeaturesFunctorImageFilter_h
24 
25 #include "itkInPlaceLabelMapFilter.h"
26 
27 namespace otb
28 {
29 
52 template <class TImage, class TFunctor>
53 class ITK_EXPORT LabelMapFeaturesFunctorImageFilter : public itk::InPlaceLabelMapFilter<TImage>
54 {
55 public:
58  typedef itk::InPlaceLabelMapFilter<TImage> Superclass;
59  typedef itk::SmartPointer<Self> Pointer;
60  typedef itk::SmartPointer<const Self> ConstPointer;
61 
63  typedef TImage ImageType;
64  typedef typename ImageType::LabelObjectType LabelObjectType;
65  typedef TFunctor FunctorType;
66 
68  itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension);
69 
71  itkTypeMacro(LabelMapFeaturesFunctorImageFilter, InPlaceLabelMapFilter);
72 
74  void SetFunctor(FunctorType& functor)
75  {
76  if (m_Functor != functor)
77  {
78  m_Functor = functor;
79  this->Modified();
80  }
81  }
83 
85  const FunctorType& GetFunctor() const
86  {
87  return m_Functor;
88  }
89 
92  {
93  return m_Functor;
94  }
95 
96 protected:
99  {
100  }
101 
104  {
105  }
106 
108  void ThreadedProcessLabelObject(LabelObjectType* labelObject) override
109  {
110  // Call the functor
111  m_Functor(labelObject);
112  }
113 
115  void PrintSelf(std::ostream& os, itk::Indent indent) const override
116  {
117  // Call superclass implementation
118  Superclass::PrintSelf(os, indent);
119  }
120 
121 private:
123  void operator=(const Self&) = delete;
124 
127 
128 }; // end of class
129 
130 } // end namespace otb
131 
132 #endif
This class applies a functor to compute new features.
void operator=(const Self &)=delete
LabelMapFeaturesFunctorImageFilter(const Self &)=delete
void PrintSelf(std::ostream &os, itk::Indent indent) const override
void ThreadedProcessLabelObject(LabelObjectType *labelObject) override
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.