OTB  10.0.0
Orfeo Toolbox
otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter.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 #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
A LabelObject with a generic attributes map.
This filter computes band statistics attributes for each object.
convert a labeled image to a label map with adjacency information.
This class vectorizes a LabelObject to a VectorData.
This class is a LabelMap with additional adjacency information.
[internal] Helper class to perform connected component segmentation on an input image,...
otb::LabelMapToVectorDataFilter< AttributesLabelMapType, VectorDataType > LabelMapToVectorDataFilterType
itk::ConnectedComponentFunctorImageFilter< VectorImageType, LabelImageType, FunctorType, MaskImageType > ConnectedComponentFilterType
otb::AttributesMapLabelObject< unsigned int, InputImageDimension, double > AttributesMapLabelObjectType
otb::LabelImageToLabelMapWithAdjacencyFilter< LabelImageType, AttributesLabelMapType > LabelImageToLabelMapFilterType
otb::BandsStatisticsAttributesLabelMapFilter< AttributesLabelMapType, VectorImageType > RadiometricLabelMapFilterType
This filter link a persistent filter with a StreamingImageVirtualWriter.
This filter is the base class for all filter persisting data through multiple update....
Perform vectorization in a persistent way.
This class is a fork of the itk::ShapeLabelMapFilter working with AttributesMapLabelObject.
Performs connected component segmentation on an input image, apply OBIA filtering and output a Vector...
PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType::MaskImageType MaskImageType
PersistentFilterStreamingDecorator< PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType > FilterType
PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType::LabelImageType LabelImageType
PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType::VectorDataType VectorDataType
PersistentConnectedComponentSegmentationOBIAToVectorDataFilter< TVImage, TLabelImage, TMaskImage, TOutputVectorData > PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType
PersistentConnectedComponentSegmentationOBIAToVectorDataFilterType::VectorImageType VectorImageType
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.