polydata_filter
PolydataFilter
Tool class containing filters for polydata.
__init__()
center_of_mass(polydata)
staticmethod
generate_global_ids(polydata)
staticmethod
Generate global ids for points and cells of the polydata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polydata |
vtkPolyData
|
Input polydata. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
vtkPolyData |
vtkPolyData
|
Polydata with global ids. |
generate_ids(polydata, point_ids_name='vtkIdFilter_Ids')
staticmethod
Generate ids for points and cells of the polydata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polydata |
vtkPolyData
|
Input polydata. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
vtkPolyData |
vtkPolyData
|
Polydata with point and cell ids arrays. |
gradient(polydata, scalar_name)
staticmethod
Construct gradient filter for target data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scalar_name |
str
|
name of the target data array. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
vtkGradientFilter |
vtkGradientFilter
|
initialized filter object. |
pca_normals(polydata, radius=1, sample_size=10)
staticmethod
Construct filter for normal calculation. Estimator uses PCA for normals calculation.
For more info see: https://vtk.org/doc/nightly/html/classvtkPCANormalEstimation.html#details
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
radius |
int
|
Defaults to 1. |
1
|
sample_size |
int
|
Number of points for computing normals. Defaults to 10. |
10
|
Returns:
| Name | Type | Description |
|---|---|---|
vtkPCANormalEstimation |
vtkPCANormalEstimation
|
estimator object for normals computation. |
point_scalar_to_cell_scalar(polydata, categorical=False)
staticmethod
Converts point scalar value to cell scalar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polydata |
vtkPolyData
|
Input polydata |
required |
categorical |
bool
|
If true "majority rules" applied with ties going to the smaller point data value. Defaults to False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
vtkPointDataToCellData |
vtkPointDataToCellData
|
filter mapping point scalar to cell scalar. |
scale(polydata, scale_factor, center)
staticmethod
Construct filter to scale polydata. Scaled data has to be centered first to apply transition matrix correctly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scale_factor |
float
|
scale factor to increase/decrease the object geometry. |
required |
center |
list
|
center coordiantes of the object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
vtkTransformPolyDataFilter |
vtkTransformPolyDataFilter
|
initialized filter object. |
scale_points(polydata, scale_factor=1.0)
staticmethod
Scale polydata relative to the center of mass.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polydata |
vtkPolyData
|
Surface polydata that has to be scaled. |
required |
scale_factor |
float
|
Fraction to scale. |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
vtkPolyData |
vtkPolyData
|
Scaled polydata. |
translate(polydata, position)
staticmethod
Construct filter to scale polydata. Scaled data has to be centered first to apply transition matrix correctly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
position |
list
|
New coordiantes of the object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
vtkTransformPolyDataFilter |
vtkTransformPolyDataFilter
|
initialized filter object. |
vertex_glyph(polydata)
staticmethod
Add vertex to each point of polydata.
Returns:
| Name | Type | Description |
|---|---|---|
vtkVertexGlyphFilter |
vtkVertexGlyphFilter
|
initialized filter object. |
warp_scale(polydata, distance, vector_name='Normals')
staticmethod
Move polydata along normal vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance |
float
|
scale factor. |
required |