OTB  10.0.0
Orfeo Toolbox
otbSpatialisationFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2024 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 
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
Base class for filter that output LabelMap.
Create a label map from objects description.
std::vector< AttributesValueType > VectorType
OutputLabelMapType::ConstPointer OutputLabelMapConstPointer
OutputLabelMapType::IndexType IndexType
LabelMapSource< TLabelMap > Superclass
itk::SmartPointer< Self > Pointer
OutputLabelMapType::LabelObjectType LabelObjectType
OutputLabelMapType::Pointer OutputLabelMapPointer
void operator=(const Self &)=delete
OutputLabelMapType::LabelObjectType::LabelType LabelType
std::vector< LabelType > LabelVectorType
itk::SmartPointer< const Self > ConstPointer
void SetLabels(LabelVectorType &v)
OutputLabelMapType::RegionType RegionType
SpatialisationFilter(const Self &)=delete
LabelObjectType::AttributesValueType AttributesValueType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.