OTB  9.0.0
Orfeo Toolbox
otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.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 otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter_h
22 #define otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter_h
23 
26 
28 #include "itkConnectedComponentFunctorImageFilter.h"
29 #include "otbMaskMuParserFilter.h"
30 #include "itkRelabelComponentImageFilter.h"
37 #include <string>
38 
39 namespace otb
40 {
41 
63 template <class TVImage, class TLabelImage, class TMaskImage, class TOutputVectorData>
65 {
66 public:
70  typedef itk::SmartPointer<Self> Pointer;
71  typedef itk::SmartPointer<const Self> ConstPointer;
72 
73  typedef TVImage VectorImageType;
74  typedef TLabelImage LabelImageType;
75  typedef TMaskImage MaskImageType;
76  typedef TOutputVectorData VectorDataType;
77 
78  typedef typename VectorImageType::Pointer VectorImagePointerType;
79  typedef typename VectorDataType::Pointer VectorDataPointerType;
80 
81  typedef typename VectorImageType::PixelType VectorImagePixelType;
82 
84  itkNewMacro(Self);
85 
88 
90  itkStaticConstMacro(InputImageDimension, unsigned int, TVImage::ImageDimension);
91 
92  // Mask generation
94  typedef itk::ConnectedComponentFunctorImageFilter<VectorImageType, LabelImageType, FunctorType, MaskImageType> ConnectedComponentFilterType;
95 
96  // mask typedef
98 
99  // Labelization
100  typedef itk::RelabelComponentImageFilter<LabelImageType, LabelImageType> RelabelComponentFilterType;
102 
105 
108 
111 
112  typedef typename RelabelComponentFilterType::ObjectSizeType ObjectSizeType;
113 
114  typedef itk::ExtractImageFilter<VectorImageType, VectorImageType> ExtractImageFilterType;
115 
116 
117  /* Set the mathematical expression used for the mask */
118  itkSetStringMacro(MaskExpression);
119 
120  /* Get the mathematical expression used for the mask */
121  itkGetStringMacro(MaskExpression);
122 
123  /* Set the mathematical expression used during connected component segmentation */
124  itkSetStringMacro(ConnectedComponentExpression);
125 
126  /* Get the mathematical expression used during connected component segmentation */
127  itkGetStringMacro(ConnectedComponentExpression);
128 
129  /* Set the minimum object size */
130  itkSetMacro(MinimumObjectSize, ObjectSizeType);
131 
132  /* Get the minimum object size */
133  itkGetMacro(MinimumObjectSize, ObjectSizeType);
134 
135  /* Set the mathematical expression for filtering labelobjects */
136  itkSetStringMacro(OBIAExpression);
137 
138  /* Get the mathematical expression for filtering labelobjects */
139  itkGetStringMacro(OBIAExpression);
140 
141  /* Set shape reduced set attributes flag for object attributes computing */
142  itkSetMacro(ShapeReducedSetOfAttributes, bool);
143 
144  /* Get shape reduced set attributes flag for object attributes computing */
145  itkGetMacro(ShapeReducedSetOfAttributes, bool);
146 
147  /* Set stat reduced set attributes flag for object attributes computing */
148  itkSetMacro(StatsReducedSetOfAttributes, bool);
149 
150  /* Get stat reduced set attributes flag for object attributes computing */
151  itkGetMacro(StatsReducedSetOfAttributes, bool);
152 
153  /* Set compute polygon flag for object attributes computing */
154  itkSetMacro(ComputePolygon, bool);
155 
156  /* Get compute polygon flag for object attributes computing */
157  itkGetMacro(ComputePolygon, bool);
158 
159  /* Set compute Flusser flag for object attributes computing */
160  itkSetMacro(ComputeFlusser, bool);
161 
162  /* Get compute Flusser flag for object attributes computing */
163  itkGetMacro(ComputeFlusser, bool);
164 
165  /* Set compute perimeter flag for object attributes computing */
166  itkSetMacro(ComputePerimeter, bool);
167 
168  /* Get compute perimeter flag for object attributes computing */
169  itkGetMacro(ComputePerimeter, bool);
170 
171  /* Set compute feret diameter flag for object attributes computing */
172  itkSetMacro(ComputeFeretDiameter, bool);
173 
174  /* Get compute FeretdDiameter flag for object attributes computing */
175  itkGetMacro(ComputeFeretDiameter, bool);
176 
177 
178 protected:
180 
182 
183  void GenerateInputRequestedRegion() override;
184 
185 private:
187  std::string m_MaskExpression;
189  std::string m_OBIAExpression;
190 
191  // attributes
198 
200 };
201 
229 template <class TVImage, class TLabelImage, class TMaskImage, class TOutputVectorData>
231 {
232 public:
233  // define the PersistentStreamingLineSegmentDetector template
236 
241 
242  // typedef for streaming capable filter
244 };
245 
246 } // end namespace itk
247 
248 #ifndef OTB_MANUAL_INSTANTIATION
250 #endif
251 
252 #endif
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::ConnectedComponentFilterType
itk::ConnectedComponentFunctorImageFilter< VectorImageType, LabelImageType, FunctorType, MaskImageType > ConnectedComponentFilterType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:94
otbAttributesMapLabelObject.h
otb::ShapeAttributesLabelMapFilter
This class is a fork of the itk::ShapeLabelMapFilter working with AttributesMapLabelObject.
Definition: otbShapeAttributesLabelMapFilter.h:212
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::Pointer
itk::SmartPointer< Self > Pointer
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:70
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::~PersistentConnectedComponentSegmentationOBIAToVectorDataFilter
~PersistentConnectedComponentSegmentationOBIAToVectorDataFilter() override
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.hxx:46
otb::PersistentImageToVectorDataFilter
Perform vectorization in a persistent way.
Definition: otbPersistentImageToVectorDataFilter.h:52
otb::AttributesMapLabelObject
A LabelObject with a generic attributes map.
Definition: otbAttributesMapLabelObject.h:177
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::m_ConnectedComponentExpression
std::string m_ConnectedComponentExpression
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:188
otb::LabelMapToVectorDataFilter
This class vectorizes a LabelObject to a VectorData.
Definition: otbLabelMapToVectorDataFilter.h:58
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::LabelMapToVectorDataFilterType
otb::LabelMapToVectorDataFilter< AttributesLabelMapType, VectorDataType > LabelMapToVectorDataFilterType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:110
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::RadiometricLabelMapFilterType
otb::BandsStatisticsAttributesLabelMapFilter< AttributesLabelMapType, VectorImageType > RadiometricLabelMapFilterType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:106
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::ShapeLabelMapFilterType
otb::ShapeAttributesLabelMapFilter< AttributesLabelMapType > ShapeLabelMapFilterType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:107
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::LabelObjectOpeningFilterType
otb::LabelObjectOpeningMuParserFilter< AttributesLabelMapType > LabelObjectOpeningFilterType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:109
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:71
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::m_MinimumObjectSize
ObjectSizeType m_MinimumObjectSize
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:186
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::ProcessTile
VectorDataPointerType ProcessTile() override
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.hxx:58
otbPersistentFilterStreamingDecorator.h
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::LabelImageToLabelMapFilterType
otb::LabelImageToLabelMapWithAdjacencyFilter< LabelImageType, AttributesLabelMapType > LabelImageToLabelMapFilterType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:104
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::FunctorType
Functor::ConnectedComponentMuParserFunctor< VectorImagePixelType > FunctorType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:93
otb
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.
Definition: otbJoinContainer.h:32
otb::LabelImageToLabelMapWithAdjacencyFilter
convert a labeled image to a label map with adjacency information.
Definition: otbLabelImageToLabelMapWithAdjacencyFilter.h:39
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::VectorImageType
TVImage VectorImageType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:73
otb::StreamingConnectedComponentSegmentationOBIAToVectorDataFilter::VectorImageType
PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType::VectorImageType VectorImageType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:237
otb::StreamingConnectedComponentSegmentationOBIAToVectorDataFilter::PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType
PersistentConnectedComponentSegmentationOBIAToVectorDataFilter< TVImage, TLabelImage, TMaskImage, TOutputVectorData > PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:235
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::m_MaskExpression
std::string m_MaskExpression
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:187
otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.hxx
otb::StreamingConnectedComponentSegmentationOBIAToVectorDataFilter::VectorDataType
PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType::VectorDataType VectorDataType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:240
otbShapeAttributesLabelMapFilter.h
otbPersistentImageToVectorDataFilter.h
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::m_ComputeFeretDiameter
bool m_ComputeFeretDiameter
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:196
otbLabelImageToLabelMapWithAdjacencyFilter.h
otb::Functor::ConnectedComponentMuParserFunctor
Definition: otbConnectedComponentMuParserFunctor.h:74
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::VectorDataPointerType
VectorDataType::Pointer VectorDataPointerType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:79
otb::StreamingConnectedComponentSegmentationOBIAToVectorDataFilter::MaskImageType
PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType::MaskImageType MaskImageType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:239
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::Superclass
PersistentImageToVectorDataFilter< TVImage, TOutputVectorData > Superclass
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:69
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::ObjectSizeType
RelabelComponentFilterType::ObjectSizeType ObjectSizeType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:112
otb::StreamingConnectedComponentSegmentationOBIAToVectorDataFilter
Performs connected component segmentation on an input image, apply OBIA filtering and output a Vector...
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:230
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::MaskMuParserFilterType
otb::MaskMuParserFilter< VectorImageType, MaskImageType > MaskMuParserFilterType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:97
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter
PersistentConnectedComponentSegmentationOBIAToVectorDataFilter()
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.hxx:33
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::m_ComputePolygon
bool m_ComputePolygon
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:195
otb::LabelObjectOpeningMuParserFilter
Definition: otbLabelObjectOpeningMuParserFilter.h:62
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::RelabelComponentFilterType
itk::RelabelComponentImageFilter< LabelImageType, LabelImageType > RelabelComponentFilterType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:100
otb::PersistentFilterStreamingDecorator
This filter link a persistent filter with a StreamingImageVirtualWriter.
Definition: otbPersistentFilterStreamingDecorator.h:47
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::MaskImageType
TMaskImage MaskImageType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:75
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::m_ComputeFlusser
bool m_ComputeFlusser
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:194
otbLabelObjectOpeningMuParserFilter.h
otbBandsStatisticsAttributesLabelMapFilter.h
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::VectorImagePointerType
VectorImageType::Pointer VectorImagePointerType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:78
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::m_ComputePerimeter
bool m_ComputePerimeter
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:197
otbConnectedComponentMuParserFunctor.h
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::m_ShapeReducedSetOfAttributes
bool m_ShapeReducedSetOfAttributes
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:192
otb::StreamingConnectedComponentSegmentationOBIAToVectorDataFilter::LabelImageType
PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType::LabelImageType LabelImageType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:238
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter
[internal] Helper class to perform connected component segmentation on an input image,...
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:64
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::AttributesMapLabelObjectType
otb::AttributesMapLabelObject< unsigned int, InputImageDimension, double > AttributesMapLabelObjectType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:101
otb::MaskMuParserFilter
Definition: otbMaskMuParserFilter.h:73
otbLabelMapToVectorDataFilter.h
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::InputImageDimension
static const unsigned int InputImageDimension
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:90
otb::LabelMapWithAdjacency
This class is a LabelMap with additional adjacency information.
Definition: otbLabelMapWithAdjacency.h:41
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::m_OBIAExpression
std::string m_OBIAExpression
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:189
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::AttributesLabelMapType
otb::LabelMapWithAdjacency< AttributesMapLabelObjectType > AttributesLabelMapType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:103
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::LabelImageType
TLabelImage LabelImageType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:74
otbMaskMuParserFilter.h
otb::StreamingConnectedComponentSegmentationOBIAToVectorDataFilter::FilterType
PersistentFilterStreamingDecorator< PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType > FilterType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:243
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::m_StatsReducedSetOfAttributes
bool m_StatsReducedSetOfAttributes
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:193
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::Self
PersistentConnectedComponentSegmentationOBIAToVectorDataFilter Self
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:68
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::ExtractImageFilterType
itk::ExtractImageFilter< VectorImageType, VectorImageType > ExtractImageFilterType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:114
otb::BandsStatisticsAttributesLabelMapFilter
This filter computes band statistics attributes for each object.
Definition: otbBandsStatisticsAttributesLabelMapFilter.h:139
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::GenerateInputRequestedRegion
void GenerateInputRequestedRegion() override
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.hxx:51
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::VectorDataType
TOutputVectorData VectorDataType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:76
otb::PersistentConnectedComponentSegmentationOBIAToVectorDataFilter::VectorImagePixelType
VectorImageType::PixelType VectorImagePixelType
Definition: otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.h:81