VTK  9.5.20250909
vtkPolyDataConnectivityFilter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
140#ifndef vtkPolyDataConnectivityFilter_h
141#define vtkPolyDataConnectivityFilter_h
142
143#include "vtkFiltersCoreModule.h" // For export macro
144#include "vtkPolyDataAlgorithm.h"
145#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
146
147#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
148#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
149#define VTK_EXTRACT_SPECIFIED_REGIONS 3
150#define VTK_EXTRACT_LARGEST_REGION 4
151#define VTK_EXTRACT_ALL_REGIONS 5
152#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
153
154VTK_ABI_NAMESPACE_BEGIN
155class vtkDataArray;
156class vtkIdList;
157class vtkIdTypeArray;
158
160 : public vtkPolyDataAlgorithm
161{
162public:
164 void PrintSelf(ostream& os, vtkIndent indent) override;
165
167
171 vtkGetObjectMacro(RegionSizes, vtkIdTypeArray);
173
178
180
185 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
186 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
187 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
189
191
200 vtkSetMacro(FullScalarConnectivity, vtkTypeBool);
201 vtkGetMacro(FullScalarConnectivity, vtkTypeBool);
202 vtkBooleanMacro(FullScalarConnectivity, vtkTypeBool);
204
206
209 vtkSetVector2Macro(ScalarRange, double);
210 vtkGetVector2Macro(ScalarRange, double);
212
214
217 vtkSetClampMacro(
219 vtkGetMacro(ExtractionMode, int);
221 {
222 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
223 }
225 {
226 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
227 }
230 {
231 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
232 }
234 {
235 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
236 }
237 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
238 const char* GetExtractionModeAsString();
240
245
249 void AddSeed(int id);
250
254 void DeleteSeed(int id);
255
260
264 void AddSpecifiedRegion(int id);
265
270
272
276 vtkSetVector3Macro(ClosestPoint, double);
277 vtkGetVectorMacro(ClosestPoint, double, 3);
279
284
286
289 vtkSetMacro(ColorRegions, vtkTypeBool);
290 vtkGetMacro(ColorRegions, vtkTypeBool);
291 vtkBooleanMacro(ColorRegions, vtkTypeBool);
293
295
300 vtkSetMacro(MarkVisitedPointIds, vtkTypeBool);
301 vtkGetMacro(MarkVisitedPointIds, vtkTypeBool);
302 vtkBooleanMacro(MarkVisitedPointIds, vtkTypeBool);
304
306
310 vtkGetObjectMacro(VisitedPointIds, vtkIdList);
312
314
319 vtkSetMacro(OutputPointsPrecision, int);
320 vtkGetMacro(OutputPointsPrecision, int);
322
323protected:
326
327 // Usual data generation method
329
330 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
331 int ExtractionMode; // how to extract regions
332 vtkIdList* Seeds; // id's of points or cells used to seed regions
333 vtkIdList* SpecifiedRegionIds; // regions specified for extraction
334 vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
335
336 double ClosestPoint[3];
337
340
341 // Does this cell qualify as being scalar connected ?
343
344 double ScalarRange[2];
345
347
348 // used to support algorithm execution
359 std::vector<vtkIdType> Wave;
360 std::vector<vtkIdType> Wave2;
364
367
368private:
370 void operator=(const vtkPolyDataConnectivityFilter&) = delete;
371};
372
377{
379 {
380 return "ExtractPointSeededRegions";
381 }
383 {
384 return "ExtractCellSeededRegions";
385 }
387 {
388 return "ExtractSpecifiedRegions";
389 }
390 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
391 {
392 return "ExtractAllRegions";
393 }
395 {
396 return "ExtractClosestPointRegion";
397 }
398 else
399 {
400 return "ExtractLargestRegion";
401 }
402}
403
404VTK_ABI_NAMESPACE_END
405#endif
abstract superclass for arrays of numeric data
list of point or cell ids
Definition vtkIdList.h:133
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only polydata as output.
extract polygonal data based on geometric connectivity
void SetExtractionModeToAllRegions()
Control the extraction of connected surfaces.
void InitializeSpecifiedRegionList()
Initialize list of region ids to extract.
const char * GetExtractionModeAsString()
Return the method of extraction as a string.
void InitializeSeedList()
Initialize list of point ids/cell ids used to seed regions.
~vtkPolyDataConnectivityFilter() override
static vtkPolyDataConnectivityFilter * New()
Construct with default extraction mode to extract largest regions.
void SetExtractionModeToLargestRegion()
Control the extraction of connected surfaces.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void DeleteSpecifiedRegion(int id)
Delete a region id to extract.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetExtractionModeToClosestPointRegion()
Control the extraction of connected surfaces.
int IsScalarConnected(vtkIdType cellId)
int GetNumberOfExtractedRegions()
Obtain the number of connected regions.
void DeleteSeed(int id)
Delete a seed id (point or cell id).
void AddSpecifiedRegion(int id)
Add a region id to extract.
void SetExtractionModeToPointSeededRegions()
Control the extraction of connected surfaces.
void SetExtractionModeToSpecifiedRegions()
Control the extraction of connected surfaces.
void SetExtractionModeToCellSeededRegions()
Control the extraction of connected surfaces.
void AddSeed(int id)
Add a seed id (point or cell id).
concrete dataset represents vertices, lines, polygons, and triangle strips
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_EXTRACT_CLOSEST_POINT_REGION
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
#define VTK_EXTRACT_ALL_REGIONS
#define VTK_EXTRACT_CELL_SEEDED_REGIONS
#define VTK_EXTRACT_SPECIFIED_REGIONS
#define VTK_EXTRACT_LARGEST_REGION
#define VTK_EXTRACT_CLOSEST_POINT_REGION
#define VTK_EXTRACT_POINT_SEEDED_REGIONS
#define VTK_EXTRACT_ALL_REGIONS
#define VTK_EXTRACT_CELL_SEEDED_REGIONS
#define VTK_EXTRACT_SPECIFIED_REGIONS
int vtkIdType
Definition vtkType.h:332
#define VTK_MARSHALAUTO