OTB  9.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-2022 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:
122  LabelMapFeaturesFunctorImageFilter(const Self&) = delete;
123  void operator=(const Self&) = delete;
124 
127 
128 }; // end of class
129 
130 } // end namespace otb
131 
132 #endif
otb::LabelMapFeaturesFunctorImageFilter::m_Functor
FunctorType m_Functor
Definition: otbLabelMapFeaturesFunctorImageFilter.h:126
otb::LabelMapFeaturesFunctorImageFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbLabelMapFeaturesFunctorImageFilter.h:59
otb::LabelMapFeaturesFunctorImageFilter
This class applies a functor to compute new features.
Definition: otbLabelMapFeaturesFunctorImageFilter.h:53
otb::LabelMapFeaturesFunctorImageFilter::ImageType
TImage ImageType
Definition: otbLabelMapFeaturesFunctorImageFilter.h:63
otb::LabelMapFeaturesFunctorImageFilter::LabelObjectType
ImageType::LabelObjectType LabelObjectType
Definition: otbLabelMapFeaturesFunctorImageFilter.h:64
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::LabelMapFeaturesFunctorImageFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbLabelMapFeaturesFunctorImageFilter.h:60
otb::LabelMapFeaturesFunctorImageFilter::GetFunctor
FunctorType & GetFunctor()
Definition: otbLabelMapFeaturesFunctorImageFilter.h:91
otb::LabelMapFeaturesFunctorImageFilter::FunctorType
TFunctor FunctorType
Definition: otbLabelMapFeaturesFunctorImageFilter.h:65
otb::Functor::BandStatsAttributesLabelObjectFunctor< TImage::LabelObjectType, otb::Image< double, 2 > >
otb::LabelMapFeaturesFunctorImageFilter::PrintSelf
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Definition: otbLabelMapFeaturesFunctorImageFilter.h:115
otb::LabelMapFeaturesFunctorImageFilter::~LabelMapFeaturesFunctorImageFilter
~LabelMapFeaturesFunctorImageFilter() override
Definition: otbLabelMapFeaturesFunctorImageFilter.h:103
otb::LabelMapFeaturesFunctorImageFilter::GetFunctor
const FunctorType & GetFunctor() const
Definition: otbLabelMapFeaturesFunctorImageFilter.h:85
otb::LabelMapFeaturesFunctorImageFilter::LabelMapFeaturesFunctorImageFilter
LabelMapFeaturesFunctorImageFilter()
Definition: otbLabelMapFeaturesFunctorImageFilter.h:98
otb::LabelMapFeaturesFunctorImageFilter::SetFunctor
void SetFunctor(FunctorType &functor)
Definition: otbLabelMapFeaturesFunctorImageFilter.h:74
otb::LabelMapFeaturesFunctorImageFilter::ThreadedProcessLabelObject
void ThreadedProcessLabelObject(LabelObjectType *labelObject) override
Definition: otbLabelMapFeaturesFunctorImageFilter.h:108
otb::LabelMapFeaturesFunctorImageFilter::Self
LabelMapFeaturesFunctorImageFilter Self
Definition: otbLabelMapFeaturesFunctorImageFilter.h:57
otb::LabelMapFeaturesFunctorImageFilter::Superclass
itk::InPlaceLabelMapFilter< TImage > Superclass
Definition: otbLabelMapFeaturesFunctorImageFilter.h:58