VTK  9.3.20240425
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
146#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
147#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
148#define VTK_EXTRACT_SPECIFIED_REGIONS 3
149#define VTK_EXTRACT_LARGEST_REGION 4
150#define VTK_EXTRACT_ALL_REGIONS 5
151#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
152
153VTK_ABI_NAMESPACE_BEGIN
154class vtkDataArray;
155class vtkIdList;
156class vtkIdTypeArray;
157
158class VTKFILTERSCORE_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataAlgorithm
159{
160public:
162 void PrintSelf(ostream& os, vtkIndent indent) override;
163
165
169 vtkGetObjectMacro(RegionSizes, vtkIdTypeArray);
171
176
178
183 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
184 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
185 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
187
189
198 vtkSetMacro(FullScalarConnectivity, vtkTypeBool);
199 vtkGetMacro(FullScalarConnectivity, vtkTypeBool);
200 vtkBooleanMacro(FullScalarConnectivity, vtkTypeBool);
202
204
207 vtkSetVector2Macro(ScalarRange, double);
208 vtkGetVector2Macro(ScalarRange, double);
210
212
215 vtkSetClampMacro(
217 vtkGetMacro(ExtractionMode, int);
219 {
220 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
221 }
223 {
224 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
225 }
228 {
229 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
230 }
232 {
233 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
234 }
235 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
236 const char* GetExtractionModeAsString();
238
243
247 void AddSeed(int id);
248
252 void DeleteSeed(int id);
253
258
262 void AddSpecifiedRegion(int id);
263
268
270
274 vtkSetVector3Macro(ClosestPoint, double);
275 vtkGetVectorMacro(ClosestPoint, double, 3);
277
282
284
287 vtkSetMacro(ColorRegions, vtkTypeBool);
288 vtkGetMacro(ColorRegions, vtkTypeBool);
289 vtkBooleanMacro(ColorRegions, vtkTypeBool);
291
293
298 vtkSetMacro(MarkVisitedPointIds, vtkTypeBool);
299 vtkGetMacro(MarkVisitedPointIds, vtkTypeBool);
300 vtkBooleanMacro(MarkVisitedPointIds, vtkTypeBool);
302
304
308 vtkGetObjectMacro(VisitedPointIds, vtkIdList);
310
312
317 vtkSetMacro(OutputPointsPrecision, int);
318 vtkGetMacro(OutputPointsPrecision, int);
320
321protected:
324
325 // Usual data generation method
327
328 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
329 int ExtractionMode; // how to extract regions
330 vtkIdList* Seeds; // id's of points or cells used to seed regions
331 vtkIdList* SpecifiedRegionIds; // regions specified for extraction
332 vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
333
334 double ClosestPoint[3];
335
338
339 // Does this cell qualify as being scalar connected ?
341
342 double ScalarRange[2];
343
345
346 // used to support algorithm execution
357 std::vector<vtkIdType> Wave;
358 std::vector<vtkIdType> Wave2;
362
365
366private:
368 void operator=(const vtkPolyDataConnectivityFilter&) = delete;
369};
370
375{
377 {
378 return "ExtractPointSeededRegions";
379 }
381 {
382 return "ExtractCellSeededRegions";
383 }
385 {
386 return "ExtractSpecifiedRegions";
387 }
388 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
389 {
390 return "ExtractAllRegions";
391 }
393 {
394 return "ExtractClosestPointRegion";
395 }
396 else
397 {
398 return "ExtractLargestRegion";
399 }
400}
401
402VTK_ABI_NAMESPACE_END
403#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:315