OTB  7.2.0
Orfeo Toolbox
otbSpatialisationFilter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005-2020 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;
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);
98  void SetPathVector(VectorType& v)
99  {
100  m_PathVector = v;
101  }
102 
103  void SetAreaVector(VectorType& v)
104  {
105  m_AreaVector = v;
106  }
107 
108  void SetLabels(LabelVectorType& v)
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 
130  SizeType m_ObjectSize;
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
OutputLabelMapType::RegionType RegionType
OutputLabelMapType::ConstPointer OutputLabelMapConstPointer
itk::Index< Monteverdi_DIMENSION > IndexType
Definition: mvdTypes.h:133
OutputLabelMapType::LabelObjectType::LabelType LabelType
Create a label map from objects description.
OutputLabelMapType::LabelObjectType LabelObjectType
OutputLabelMapType::IndexType IndexType
itk::SmartPointer< const Self > ConstPointer
OutputLabelMapType::Pointer OutputLabelMapPointer
Base class for filter that output LabelMap.
LabelObjectType::AttributesValueType AttributesValueType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
LabelMapSource< TLabelMap > Superclass
std::vector< AttributesValueType > VectorType
std::vector< LabelType > LabelVectorType
void SetLabels(LabelVectorType &v)
itk::SmartPointer< Self > Pointer