OTB  9.0.0
Orfeo Toolbox
otbBandsStatisticsAttributesLabelMapFilter.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 otbBandsStatisticsAttributesLabelMapFilter_h
22 #define otbBandsStatisticsAttributesLabelMapFilter_h
23 
26 
27 namespace otb
28 {
29 namespace Functor
30 {
50 template <class TLabelObject, class TFeatureImage>
52 {
53 public:
54  // Self typedef
56 
58  typedef typename TFeatureImage::PixelType FeatureType;
59 
61  typedef TLabelObject LabelObjectType;
62 
64  typedef typename TFeatureImage::ConstPointer FeatureImageConstPointer;
65 
68 
70  typedef std::map<std::string, StatsFunctorType> StatsFunctorsMapType;
71 
74 
77 
79  bool operator!=(const Self& self);
80  bool operator==(const Self& self);
82 
86  inline void operator()(LabelObjectType* lo) const;
87 
89  void AddFeature(const std::string& name, const TFeatureImage* img);
90 
92  bool RemoveFeature(const std::string& name);
93 
95  const TFeatureImage* GetFeatureImage(const std::string& name) const;
96 
98  void ClearAllFeatures();
99 
101  unsigned int GetNumberOfFeatures() const;
102 
104  void SetReducedAttributeSet(bool flag);
105 
107  bool GetReducedAttributeSet() const;
108 
109 private:
112 
115 };
116 } // End namespace Functor
117 
138 template <class TImage, class TFeatureImage>
141  TImage, typename Functor::BandStatsAttributesLabelObjectFunctor<typename TImage::LabelObjectType, otb::Image<double, 2>>>
142 {
143 public:
145  typedef TImage ImageType;
146  typedef typename ImageType::RegionType InputImageRegionType;
147  typedef typename ImageType::LabelObjectType LabelObjectType;
148  typedef TFeatureImage FeatureImageType;
149  typedef typename FeatureImageType::InternalPixelType FeatureInternalPixelType;
150  typedef double InternalPrecisionType;
152 
155 
159  typedef itk::SmartPointer<Self> Pointer;
160  typedef itk::SmartPointer<const Self> ConstPointer;
161  typedef typename ImageType::Pointer ImagePointer;
162 
164  itkStaticConstMacro(ImageDimension, unsigned int, TImage::ImageDimension);
165 
167  itkNewMacro(Self);
168 
171 
173  void SetFeatureImage(const TFeatureImage* input);
174 
176  const FeatureImageType* GetFeatureImage() const;
177 
179  void SetReducedAttributeSet(bool flag);
180 
182  bool GetReducedAttributeSet() const;
183 
184  itkBooleanMacro(ReducedAttributeSet);
185 
186 protected:
189 
192  {
193  }
194 
195  void AllocateOutputs() override;
196 
197  void GenerateInputRequestedRegion() override;
198 
199  void EnlargeOutputRequestedRegion(itk::DataObject*) override{};
200 
202  void BeforeThreadedGenerateData() override;
203 
205  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
206 
207 private:
208  BandsStatisticsAttributesLabelMapFilter(const Self&) = delete;
209  void operator=(const Self&) = delete;
210 
211 }; // end of class
212 
213 } // end namespace itk
214 
215 #ifndef OTB_MANUAL_INSTANTIATION
217 #endif
218 
219 #endif
otb::Functor::BandStatsAttributesLabelObjectFunctor::GetFeatureImage
const TFeatureImage * GetFeatureImage(const std::string &name) const
Definition: otbBandsStatisticsAttributesLabelMapFilter.hxx:103
otb::BandsStatisticsAttributesLabelMapFilter::FeatureInternalPixelType
FeatureImageType::InternalPixelType FeatureInternalPixelType
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:149
otb::BandsStatisticsAttributesLabelMapFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:159
otb::BandsStatisticsAttributesLabelMapFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:160
otb::Functor::BandStatsAttributesLabelObjectFunctor::~BandStatsAttributesLabelObjectFunctor
virtual ~BandStatsAttributesLabelObjectFunctor()
Definition: otbBandsStatisticsAttributesLabelMapFilter.hxx:39
otb::BandsStatisticsAttributesLabelMapFilter::~BandsStatisticsAttributesLabelMapFilter
~BandsStatisticsAttributesLabelMapFilter() override
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:191
otb::LabelMapFeaturesFunctorImageFilter
This class applies a functor to compute new features.
Definition: otbLabelMapFeaturesFunctorImageFilter.h:53
otb::Functor::BandStatsAttributesLabelObjectFunctor::operator!=
bool operator!=(const Self &self)
Definition: otbBandsStatisticsAttributesLabelMapFilter.hxx:45
otb::Functor::BandStatsAttributesLabelObjectFunctor::m_StatsFunctorsMap
StatsFunctorsMapType m_StatsFunctorsMap
The Stat functors map.
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:114
otb::Functor::BandStatsAttributesLabelObjectFunctor::GetReducedAttributeSet
bool GetReducedAttributeSet() const
Definition: otbBandsStatisticsAttributesLabelMapFilter.hxx:142
otb::BandsStatisticsAttributesLabelMapFilter::InternalPrecisionType
double InternalPrecisionType
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:150
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::Image
Creation of an "otb" image which contains metadata.
Definition: otbImage.h:89
otbStatisticsAttributesLabelMapFilter.h
otb::Functor::BandStatsAttributesLabelObjectFunctor::GetNumberOfFeatures
unsigned int GetNumberOfFeatures() const
Definition: otbBandsStatisticsAttributesLabelMapFilter.hxx:122
otb::Functor::BandStatsAttributesLabelObjectFunctor::RemoveFeature
bool RemoveFeature(const std::string &name)
Definition: otbBandsStatisticsAttributesLabelMapFilter.hxx:96
otb::Functor::BandStatsAttributesLabelObjectFunctor::SetReducedAttributeSet
void SetReducedAttributeSet(bool flag)
Definition: otbBandsStatisticsAttributesLabelMapFilter.hxx:129
otb::BandsStatisticsAttributesLabelMapFilter::InputImageRegionType
ImageType::RegionType InputImageRegionType
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:146
otb::BandsStatisticsAttributesLabelMapFilter::Superclass
LabelMapFeaturesFunctorImageFilter< ImageType, FunctorType > Superclass
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:158
otb::Functor::BandStatsAttributesLabelObjectFunctor
Functor to compute bands statistics attributes.
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:51
otb::Functor::BandStatsAttributesLabelObjectFunctor::BandStatsAttributesLabelObjectFunctor
BandStatsAttributesLabelObjectFunctor()
Definition: otbBandsStatisticsAttributesLabelMapFilter.hxx:33
otb::BandsStatisticsAttributesLabelMapFilter::FeatureImageType
TFeatureImage FeatureImageType
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:148
otb::Functor::BandStatsAttributesLabelObjectFunctor::ClearAllFeatures
void ClearAllFeatures()
Definition: otbBandsStatisticsAttributesLabelMapFilter.hxx:115
otb::Functor::BandStatsAttributesLabelObjectFunctor::operator()
void operator()(LabelObjectType *lo) const
Definition: otbBandsStatisticsAttributesLabelMapFilter.hxx:64
otb::Functor::BandStatsAttributesLabelObjectFunctor::Self
BandStatsAttributesLabelObjectFunctor Self
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:55
otb::Functor::BandStatsAttributesLabelObjectFunctor::m_ReducedAttributeSet
bool m_ReducedAttributeSet
True to compute only a reduced attribute set.
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:111
otb::Functor::BandStatsAttributesLabelObjectFunctor::operator==
bool operator==(const Self &self)
True to compute only a reduced attribute set.
Definition: otbBandsStatisticsAttributesLabelMapFilter.hxx:55
otbMultiToMonoChannelExtractROI.h
otb::BandsStatisticsAttributesLabelMapFilter::ImagePointer
ImageType::Pointer ImagePointer
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:161
otb::BandsStatisticsAttributesLabelMapFilter::Self
BandsStatisticsAttributesLabelMapFilter Self
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:157
otb::BandsStatisticsAttributesLabelMapFilter::ImageType
TImage ImageType
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:145
otb::BandsStatisticsAttributesLabelMapFilter::FunctorType
Functor::BandStatsAttributesLabelObjectFunctor< LabelObjectType, InternalImageType > FunctorType
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:154
otb::Functor::BandStatsAttributesLabelObjectFunctor::AddFeature
void AddFeature(const std::string &name, const TFeatureImage *img)
Definition: otbBandsStatisticsAttributesLabelMapFilter.hxx:76
otb::Functor::BandStatsAttributesLabelObjectFunctor::StatsFunctorType
StatisticsAttributesLabelObjectFunctor< TLabelObject, TFeatureImage > StatsFunctorType
Statistics functor.
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:67
otb::BandsStatisticsAttributesLabelMapFilter::InternalImageType
Image< InternalPrecisionType, 2 > InternalImageType
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:151
otb::BandsStatisticsAttributesLabelMapFilter::LabelObjectType
ImageType::LabelObjectType LabelObjectType
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:147
otb::Functor::BandStatsAttributesLabelObjectFunctor::StatsFunctorsMapType
std::map< std::string, StatsFunctorType > StatsFunctorsMapType
Map to store the functors.
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:70
otb::Functor::BandStatsAttributesLabelObjectFunctor::LabelObjectType
TLabelObject LabelObjectType
Typedef of the label object.
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:61
otb::Functor::BandStatsAttributesLabelObjectFunctor::FeatureType
TFeatureImage::PixelType FeatureType
Typedef of the feature image type.
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:58
otb::BandsStatisticsAttributesLabelMapFilter::EnlargeOutputRequestedRegion
void EnlargeOutputRequestedRegion(itk::DataObject *) override
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:199
otb::Functor::BandStatsAttributesLabelObjectFunctor::FeatureImageConstPointer
TFeatureImage::ConstPointer FeatureImageConstPointer
Feature image const pointer.
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:64
otb::BandsStatisticsAttributesLabelMapFilter
This filter computes band statistics attributes for each object.
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:139
otbBandsStatisticsAttributesLabelMapFilter.hxx
otb::Functor::StatisticsAttributesLabelObjectFunctor
Functor to compute statistics attributes of one LabelObject.
Definition: otbStatisticsAttributesLabelMapFilter.h:42