pyvista.convert_array#
- convert_array(
- arr: Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | vtkAbstractArray,
- name: str | None = None,
- deep: bool = False,
- array_type: int | None = None,
Convert a NumPy array to a vtkDataArray or vice versa.
- Parameters:
- arr
np.ndarray
|vtkDataArray
A numpy array or vtkDataArry to convert.
- name
str
,optional
The name of the data array for VTK.
- deepbool, default:
False
If input is numpy array then deep copy values.
- array_type
int
,optional
VTK array type ID as specified in
vtkType.h
.
- arr
- Returns:
vtkDataArray
ornumpy.ndarray
The converted array. If input is a
numpy.ndarray
then returnsvtkDataArray
or is input isvtkDataArray
then returns NumPyndarray
.