VTK  9.2.6
vtkPolyDataConnectivityFilter.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkPolyDataConnectivityFilter.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
152#ifndef vtkPolyDataConnectivityFilter_h
153#define vtkPolyDataConnectivityFilter_h
154
155#include "vtkFiltersCoreModule.h" // For export macro
156#include "vtkPolyDataAlgorithm.h"
157
158#define VTK_EXTRACT_POINT_SEEDED_REGIONS 1
159#define VTK_EXTRACT_CELL_SEEDED_REGIONS 2
160#define VTK_EXTRACT_SPECIFIED_REGIONS 3
161#define VTK_EXTRACT_LARGEST_REGION 4
162#define VTK_EXTRACT_ALL_REGIONS 5
163#define VTK_EXTRACT_CLOSEST_POINT_REGION 6
164
165class vtkDataArray;
166class vtkIdList;
167class vtkIdTypeArray;
168
169class VTKFILTERSCORE_EXPORT vtkPolyDataConnectivityFilter : public vtkPolyDataAlgorithm
170{
171public:
173 void PrintSelf(ostream& os, vtkIndent indent) override;
174
176
180 vtkGetObjectMacro(RegionSizes, vtkIdTypeArray);
182
187
189
194 vtkSetMacro(ScalarConnectivity, vtkTypeBool);
195 vtkGetMacro(ScalarConnectivity, vtkTypeBool);
196 vtkBooleanMacro(ScalarConnectivity, vtkTypeBool);
198
200
209 vtkSetMacro(FullScalarConnectivity, vtkTypeBool);
210 vtkGetMacro(FullScalarConnectivity, vtkTypeBool);
211 vtkBooleanMacro(FullScalarConnectivity, vtkTypeBool);
213
215
218 vtkSetVector2Macro(ScalarRange, double);
219 vtkGetVector2Macro(ScalarRange, double);
221
223
226 vtkSetClampMacro(
228 vtkGetMacro(ExtractionMode, int);
230 {
231 this->SetExtractionMode(VTK_EXTRACT_POINT_SEEDED_REGIONS);
232 }
234 {
235 this->SetExtractionMode(VTK_EXTRACT_CELL_SEEDED_REGIONS);
236 }
239 {
240 this->SetExtractionMode(VTK_EXTRACT_SPECIFIED_REGIONS);
241 }
243 {
244 this->SetExtractionMode(VTK_EXTRACT_CLOSEST_POINT_REGION);
245 }
246 void SetExtractionModeToAllRegions() { this->SetExtractionMode(VTK_EXTRACT_ALL_REGIONS); }
247 const char* GetExtractionModeAsString();
249
254
258 void AddSeed(int id);
259
263 void DeleteSeed(int id);
264
269
273 void AddSpecifiedRegion(int id);
274
279
281
285 vtkSetVector3Macro(ClosestPoint, double);
286 vtkGetVectorMacro(ClosestPoint, double, 3);
288
293
295
298 vtkSetMacro(ColorRegions, vtkTypeBool);
299 vtkGetMacro(ColorRegions, vtkTypeBool);
300 vtkBooleanMacro(ColorRegions, vtkTypeBool);
302
304
309 vtkSetMacro(MarkVisitedPointIds, vtkTypeBool);
310 vtkGetMacro(MarkVisitedPointIds, vtkTypeBool);
311 vtkBooleanMacro(MarkVisitedPointIds, vtkTypeBool);
313
315
319 vtkGetObjectMacro(VisitedPointIds, vtkIdList);
321
323
328 vtkSetMacro(OutputPointsPrecision, int);
329 vtkGetMacro(OutputPointsPrecision, int);
331
332protected:
335
336 // Usual data generation method
338
339 vtkTypeBool ColorRegions; // boolean turns on/off scalar gen for separate regions
340 int ExtractionMode; // how to extract regions
341 vtkIdList* Seeds; // id's of points or cells used to seed regions
342 vtkIdList* SpecifiedRegionIds; // regions specified for extraction
343 vtkIdTypeArray* RegionSizes; // size (in cells) of each region extracted
344
345 double ClosestPoint[3];
346
349
350 // Does this cell qualify as being scalar connected ?
352
353 double ScalarRange[2];
354
356
357 // used to support algorithm execution
368 std::vector<vtkIdType> Wave;
369 std::vector<vtkIdType> Wave2;
373
376
377private:
379 void operator=(const vtkPolyDataConnectivityFilter&) = delete;
380};
381
386{
388 {
389 return "ExtractPointSeededRegions";
390 }
392 {
393 return "ExtractCellSeededRegions";
394 }
396 {
397 return "ExtractSpecifiedRegions";
398 }
399 else if (this->ExtractionMode == VTK_EXTRACT_ALL_REGIONS)
400 {
401 return "ExtractAllRegions";
402 }
404 {
405 return "ExtractClosestPointRegion";
406 }
407 else
408 {
409 return "ExtractLargestRegion";
410 }
411}
412
413#endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
list of point or cell ids
Definition: vtkIdList.h:143
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:119
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
Definition: vtkPolyData.h:200
int vtkTypeBool
Definition: vtkABI.h:69
#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
int vtkIdType
Definition: vtkType.h:332