OTB  9.0.0
Orfeo Toolbox
otbSpatialisationFilter.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 
22 #ifndef otbSpatialisationFilter_h
23 #define otbSpatialisationFilter_h
24 
25 #include "itkLabelObject.h"
26 #include "otbLabelMapSource.h"
27 #include "itkSize.h"
28 #include "itkImageRegionIterator.h"
29 #include "otbImage.h"
30 
31 namespace otb
32 {
33 
52 template <class TLabelMap>
53 class ITK_EXPORT SpatialisationFilter : public LabelMapSource<TLabelMap>
54 
55 {
56 public:
62  typedef itk::SmartPointer<Self> Pointer;
63  typedef itk::SmartPointer<const Self> ConstPointer;
64 
66  typedef TLabelMap OutputLabelMapType;
67  typedef typename OutputLabelMapType::Pointer OutputLabelMapPointer;
68  typedef typename OutputLabelMapType::ConstPointer OutputLabelMapConstPointer;
69  typedef typename OutputLabelMapType::IndexType IndexType;
70  typedef typename OutputLabelMapType::RegionType RegionType;
71  typedef typename OutputLabelMapType::LabelObjectType::LabelType LabelType;
72  typedef typename OutputLabelMapType::LabelObjectType LabelObjectType;
73  typedef typename LabelObjectType::AttributesValueType AttributesValueType;
74 
75  typedef itk::Size<2> SizeType;
76  typedef std::vector<AttributesValueType> VectorType;
77  typedef std::vector<LabelType> LabelVectorType;
78 
79 
81  itkTypeMacro(SpatialisationFilter, LabelMapSource);
82  itkNewMacro(Self);
84 
86  itkSetMacro(ObjectSize, SizeType);
87  itkGetMacro(ObjectSize, SizeType);
89 
90  itkSetMacro(NumberOfObjects, SizeType);
91  itkGetMacro(NumberOfObjects, SizeType);
92 
93  // itkSetMacro(PathVector, VectorType);
94  // itkGetMacro(PathVector, VectorType);
95  //
96  // itkSetMacro(AreaVector, VectorType);
97  // itkGetMacro(AreaVector, VectorType);
99  {
100  m_PathVector = v;
101  }
102 
104  {
105  m_AreaVector = v;
106  }
107 
109  {
110  m_Labels = v;
111  }
112 
113 
114 protected:
117  {
118  }
119  void PrintSelf(std::ostream& os, itk::Indent indent) const override;
120 
121  void GenerateData() override;
122  virtual void ProcessObject(unsigned int obj);
123  void GenerateOutputInformation() override;
124 
125 private:
126  SpatialisationFilter(const Self&) = delete;
127  void operator=(const Self&) = delete;
128 
131 
134 
138  VectorType m_PathVector; // vector containing the spectrum path (if any) for each object
139 
141  VectorType m_AreaVector; // vector containing the the type of each object
142 
144  LabelVectorType m_Labels; // vector containing the label of each object.
145 };
146 
147 } // end namespace itk
148 
149 #ifndef OTB_MANUAL_INSTANTIATION
151 #endif
152 
153 #endif
otb::SpatialisationFilter::IndexType
OutputLabelMapType::IndexType IndexType
Definition: otbSpatialisationFilter.h:69
otb::SpatialisationFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbSpatialisationFilter.h:62
otb::SpatialisationFilter::SetLabels
void SetLabels(LabelVectorType &v)
Definition: otbSpatialisationFilter.h:108
otb::SpatialisationFilter::VectorType
std::vector< AttributesValueType > VectorType
Definition: otbSpatialisationFilter.h:76
otb::SpatialisationFilter::LabelVectorType
std::vector< LabelType > LabelVectorType
Definition: otbSpatialisationFilter.h:77
otbImage.h
otb::SpatialisationFilter::Superclass
LabelMapSource< TLabelMap > Superclass
Definition: otbSpatialisationFilter.h:61
otb::SpatialisationFilter
Create a label map from objects description.
Definition: otbSpatialisationFilter.h:53
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::SpatialisationFilter::OutputLabelMapType
TLabelMap OutputLabelMapType
Definition: otbSpatialisationFilter.h:66
otb::SpatialisationFilter::m_Labels
LabelVectorType m_Labels
Definition: otbSpatialisationFilter.h:144
otb::SpatialisationFilter::m_PathVector
VectorType m_PathVector
Definition: otbSpatialisationFilter.h:138
otb::SpatialisationFilter::SetAreaVector
void SetAreaVector(VectorType &v)
Definition: otbSpatialisationFilter.h:103
otb::SpatialisationFilter::SizeType
itk::Size< 2 > SizeType
Definition: otbSpatialisationFilter.h:75
otb::SpatialisationFilter::SetPathVector
void SetPathVector(VectorType &v)
Definition: otbSpatialisationFilter.h:98
otb::SpatialisationFilter::RegionType
OutputLabelMapType::RegionType RegionType
Definition: otbSpatialisationFilter.h:70
otb::SpatialisationFilter::OutputLabelMapConstPointer
OutputLabelMapType::ConstPointer OutputLabelMapConstPointer
Definition: otbSpatialisationFilter.h:68
otb::SpatialisationFilter::~SpatialisationFilter
~SpatialisationFilter() override
Definition: otbSpatialisationFilter.h:116
otb::LabelMapSource
Base class for filter that output LabelMap.
Definition: otbLabelMapSource.h:41
otb::SpatialisationFilter::m_AreaVector
VectorType m_AreaVector
Definition: otbSpatialisationFilter.h:141
otb::SpatialisationFilter::LabelType
OutputLabelMapType::LabelObjectType::LabelType LabelType
Definition: otbSpatialisationFilter.h:71
otb::SpatialisationFilter::LabelObjectType
OutputLabelMapType::LabelObjectType LabelObjectType
Definition: otbSpatialisationFilter.h:72
otb::SpatialisationFilter::m_NumberOfObjects
SizeType m_NumberOfObjects
Definition: otbSpatialisationFilter.h:133
otb::SpatialisationFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbSpatialisationFilter.h:63
otbSpatialisationFilter.hxx
otb::SpatialisationFilter::m_ObjectSize
SizeType m_ObjectSize
Definition: otbSpatialisationFilter.h:130
otb::SpatialisationFilter::Self
SpatialisationFilter Self
Definition: otbSpatialisationFilter.h:60
otb::SpatialisationFilter::OutputLabelMapPointer
OutputLabelMapType::Pointer OutputLabelMapPointer
Definition: otbSpatialisationFilter.h:67
otb::SpatialisationFilter::AttributesValueType
LabelObjectType::AttributesValueType AttributesValueType
Definition: otbSpatialisationFilter.h:73
otbLabelMapSource.h