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 
60 template <class TVImage, class TLabelImage, class TMaskImage, class TOutputVectorData>
62 {
63 public:
67  typedef itk::SmartPointer<Self> Pointer;
68  typedef itk::SmartPointer<const Self> ConstPointer;
69 
70  typedef TVImage VectorImageType;
71  typedef TLabelImage LabelImageType;
72  typedef TMaskImage MaskImageType;
73  typedef TOutputVectorData VectorDataType;
74 
75  typedef typename VectorImageType::Pointer VectorImagePointerType;
76  typedef typename VectorDataType::Pointer VectorDataPointerType;
77 
78  typedef typename VectorImageType::PixelType VectorImagePixelType;
79 
81  itkNewMacro(Self);
82 
85 
87  itkStaticConstMacro(InputImageDimension, unsigned int, TVImage::ImageDimension);
88 
89  // Mask generation
91  typedef itk::ConnectedComponentFunctorImageFilter<VectorImageType, LabelImageType, FunctorType, MaskImageType> ConnectedComponentFilterType;
92 
93  // mask typedef
95 
96  // Labelization
97  typedef itk::RelabelComponentImageFilter<LabelImageType, LabelImageType> RelabelComponentFilterType;
99 
102 
105 
108 
109  typedef typename RelabelComponentFilterType::ObjectSizeType ObjectSizeType;
110 
111  typedef itk::ExtractImageFilter<VectorImageType, VectorImageType> ExtractImageFilterType;
112 
113 
114  /* Set the mathematical expression used for the mask */
115  itkSetStringMacro(MaskExpression);
116 
117  /* Get the mathematical expression used for the mask */
118  itkGetStringMacro(MaskExpression);
119 
120  /* Set the mathematical expression used during connected component segmentation */
121  itkSetStringMacro(ConnectedComponentExpression);
122 
123  /* Get the mathematical expression used during connected component segmentation */
124  itkGetStringMacro(ConnectedComponentExpression);
125 
126  /* Set the minimum object size */
127  itkSetMacro(MinimumObjectSize, ObjectSizeType);
128 
129  /* Get the minimum object size */
130  itkGetMacro(MinimumObjectSize, ObjectSizeType);
131 
132  /* Set the mathematical expression for filtering labelobjects */
133  itkSetStringMacro(OBIAExpression);
134 
135  /* Get the mathematical expression for filtering labelobjects */
136  itkGetStringMacro(OBIAExpression);
137 
138  /* Set shape reduced set attributes flag for object attributes computing */
139  itkSetMacro(ShapeReducedSetOfAttributes, bool);
140 
141  /* Get shape reduced set attributes flag for object attributes computing */
142  itkGetMacro(ShapeReducedSetOfAttributes, bool);
143 
144  /* Set stat reduced set attributes flag for object attributes computing */
145  itkSetMacro(StatsReducedSetOfAttributes, bool);
146 
147  /* Get stat reduced set attributes flag for object attributes computing */
148  itkGetMacro(StatsReducedSetOfAttributes, bool);
149 
150  /* Set compute polygon flag for object attributes computing */
151  itkSetMacro(ComputePolygon, bool);
152 
153  /* Get compute polygon flag for object attributes computing */
154  itkGetMacro(ComputePolygon, bool);
155 
156  /* Set compute Flusser flag for object attributes computing */
157  itkSetMacro(ComputeFlusser, bool);
158 
159  /* Get compute Flusser flag for object attributes computing */
160  itkGetMacro(ComputeFlusser, bool);
161 
162  /* Set compute perimeter flag for object attributes computing */
163  itkSetMacro(ComputePerimeter, bool);
164 
165  /* Get compute perimeter flag for object attributes computing */
166  itkGetMacro(ComputePerimeter, bool);
167 
168  /* Set compute feret diameter flag for object attributes computing */
169  itkSetMacro(ComputeFeretDiameter, bool);
170 
171  /* Get compute FeretdDiameter flag for object attributes computing */
172  itkGetMacro(ComputeFeretDiameter, bool);
173 
174 
175 protected:
177 
179 
180  void GenerateInputRequestedRegion() override;
181 
182 private:
184  std::string m_MaskExpression;
186  std::string m_OBIAExpression;
187 
188  // attributes
195 
197 };
198 
226 template <class TVImage, class TLabelImage, class TMaskImage, class TOutputVectorData>
228 {
229 public:
230  // define the PersistentStreamingLineSegmentDetector template
233 
238 
239  // typedef for streaming capable filter
241 };
242 
243 } // end namespace itk
244 
245 #ifndef OTB_MANUAL_INSTANTIATION
247 #endif
248 
249 #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.