VMTK
Loading...
Searching...
No Matches
vtkvmtkCellDimensionFilter Class Reference

Threshold all cells of a given dimension, output to an unstructured grid. More...

#include <vtkvmtkCellDimensionFilter.h>

Inheritance diagram for vtkvmtkCellDimensionFilter:
[legend]
Collaboration diagram for vtkvmtkCellDimensionFilter:
[legend]

Public Types

typedef vtkUnstructuredGridAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkCellDimensionFilter * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
void ThresholdByLower (int lower)
void ThresholdByUpper (int upper)
void ThresholdBetween (int lower, int upper)
virtual int GetUpperThreshold ()
virtual int GetLowerThreshold ()

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkvmtkCellDimensionFilter * SafeDownCast (vtkObjectBase *o)
static vtkvmtkCellDimensionFilter * New ()

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkCellDimensionFilter ()
 ~vtkvmtkCellDimensionFilter ()
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
virtual int FillInputPortInformation (int port, vtkInformation *info) override

Protected Attributes

vtkThreshold * Threshold

Detailed Description

Threshold all cells of a given dimension, output to an unstructured grid.

vtkvmtkCellDimensionFilter selects the cells of the input data set whose topological dimension (0 for vertices, 1 for lines, 2 for polygons, 3 for solids) satisfies a threshold criterion set with ThresholdByLower(), ThresholdByUpper(), or ThresholdBetween(), and outputs them as an unstructured grid. It is a thin wrapper around vtkThreshold applied to a cell-dimension array.

Definition at line 44 of file vtkvmtkCellDimensionFilter.h.

Member Typedef Documentation

◆ Superclass

typedef vtkUnstructuredGridAlgorithm vtkvmtkCellDimensionFilter::Superclass

Definition at line 47 of file vtkvmtkCellDimensionFilter.h.

Constructor & Destructor Documentation

◆ vtkvmtkCellDimensionFilter()

vtkvmtkCellDimensionFilter::vtkvmtkCellDimensionFilter ( )
protected

Definition at line 40 of file vtkvmtkCellDimensionFilter.cxx.

41{
42 this->Threshold = vtkThreshold::New();
43}

◆ ~vtkvmtkCellDimensionFilter()

vtkvmtkCellDimensionFilter::~vtkvmtkCellDimensionFilter ( )
protected

Definition at line 45 of file vtkvmtkCellDimensionFilter.cxx.

46{
47 if (this->Threshold)
48 {
49 this->Threshold->Delete();
50 }
51}

Member Function Documentation

◆ IsTypeOf()

int vtkvmtkCellDimensionFilter::IsTypeOf ( const char * type)
static

◆ IsA()

virtual int vtkvmtkCellDimensionFilter::IsA ( const char * type)
virtual

◆ SafeDownCast()

vtkvmtkCellDimensionFilter * vtkvmtkCellDimensionFilter::SafeDownCast ( vtkObjectBase * o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkCellDimensionFilter::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkCellDimensionFilter * vtkvmtkCellDimensionFilter::NewInstance ( ) const

◆ PrintSelf()

void vtkvmtkCellDimensionFilter::PrintSelf ( std::ostream & os,
vtkIndent indent )
override

Definition at line 142 of file vtkvmtkCellDimensionFilter.cxx.

143{
144 this->Superclass::PrintSelf(os,indent);
145}

◆ New()

vtkvmtkCellDimensionFilter * vtkvmtkCellDimensionFilter::New ( )
static

◆ ThresholdByLower()

void vtkvmtkCellDimensionFilter::ThresholdByLower ( int lower)

Criterion is cells whose dimension is less or equal to lower threshold.

Definition at line 60 of file vtkvmtkCellDimensionFilter.cxx.

61{
62#if VTK_MAJOR_VERSION >= 9
63 Threshold->SetLowerThreshold(lower);
64 Threshold->SetThresholdFunction(vtkThreshold::THRESHOLD_LOWER);
65#else
66 Threshold->ThresholdByLower(lower);
67#endif
68}

◆ ThresholdByUpper()

void vtkvmtkCellDimensionFilter::ThresholdByUpper ( int upper)

Criterion is cells whose dimension is greater or equal to upper threshold.

Definition at line 70 of file vtkvmtkCellDimensionFilter.cxx.

71{
72#if VTK_MAJOR_VERSION >= 9
73 Threshold->SetUpperThreshold(upper);
74 Threshold->SetThresholdFunction(vtkThreshold::THRESHOLD_UPPER);
75#else
76 Threshold->ThresholdByUpper(upper);
77#endif
78}

◆ ThresholdBetween()

void vtkvmtkCellDimensionFilter::ThresholdBetween ( int lower,
int upper )

Criterion is cells whose dimension is between lower and upper thresholds (inclusive of the end values).

Definition at line 80 of file vtkvmtkCellDimensionFilter.cxx.

81{
82#if VTK_MAJOR_VERSION >= 9
83 Threshold->SetLowerThreshold(lower);
84 Threshold->SetUpperThreshold(upper);
85 Threshold->SetThresholdFunction(vtkThreshold::THRESHOLD_BETWEEN);
86#else
87 Threshold->ThresholdBetween(lower,upper);
88#endif
89}

◆ GetUpperThreshold()

int vtkvmtkCellDimensionFilter::GetUpperThreshold ( )
virtual

Get the Upper and Lower thresholds.

Definition at line 96 of file vtkvmtkCellDimensionFilter.cxx.

97{
98 return Threshold->GetUpperThreshold();
99}

◆ GetLowerThreshold()

int vtkvmtkCellDimensionFilter::GetLowerThreshold ( )
virtual

Get the Upper and Lower thresholds.

Definition at line 91 of file vtkvmtkCellDimensionFilter.cxx.

92{
93 return Threshold->GetLowerThreshold();
94}

◆ RequestData()

int vtkvmtkCellDimensionFilter::RequestData ( vtkInformation * ,
vtkInformationVector ** ,
vtkInformationVector *  )
overrideprotectedvirtual

Definition at line 102 of file vtkvmtkCellDimensionFilter.cxx.

106{
107 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
108 vtkInformation *outInfo = outputVector->GetInformationObject(0);
109
110 vtkDataSet *input = vtkDataSet::SafeDownCast(
111 inInfo->Get(vtkDataObject::DATA_OBJECT()));
112 vtkUnstructuredGrid *output = vtkUnstructuredGrid::SafeDownCast(
113 outInfo->Get(vtkUnstructuredGrid::DATA_OBJECT()));
114
115 vtkIdType numberOfCells = input->GetNumberOfCells();
116
117 vtkIntArray *cellDimensionArray = vtkIntArray::New();
118 cellDimensionArray->SetName("CellDimensionArray");
119 cellDimensionArray->SetNumberOfComponents(1);
120 cellDimensionArray->SetNumberOfTuples(numberOfCells);
121
122 for (int i=0; i<numberOfCells; i++)
123 {
124 cellDimensionArray->SetValue(i,input->GetCell(i)->GetCellDimension());
125
126 }
127 input->GetCellData()->AddArray(cellDimensionArray);
128
129 Threshold->SetInputData(input);
130 Threshold->SetInputArrayToProcess(0,0,0,1,"CellDimensionArray");
131 Threshold->Update();
132 output->DeepCopy(Threshold->GetOutput());
133
134
135
136 input->GetCellData()->RemoveArray("CellDimensionArray");
137 cellDimensionArray->Delete();
138
139 return 1;
140}

◆ FillInputPortInformation()

int vtkvmtkCellDimensionFilter::FillInputPortInformation ( int port,
vtkInformation * info )
overrideprotectedvirtual

Definition at line 53 of file vtkvmtkCellDimensionFilter.cxx.

54{
55 info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet");
56 return 1;
57}

Member Data Documentation

◆ Threshold

vtkThreshold* vtkvmtkCellDimensionFilter::Threshold
protected

Definition at line 84 of file vtkvmtkCellDimensionFilter.h.


The documentation for this class was generated from the following files: