ImageData.dimensionality#
- property ImageData.dimensionality: _Dimensionality[source]#
Return the number of spatial dimensions spanned by this dataset’s points.
This is equivalent to computing the matrix rank of the points.
Changed in version 0.47: This property is now generalized for all datasets. Previously, it was only available for datasets with a
dimensionsproperty.- Returns:
intThe dimensionality of the dataset.
Notes#
ranges from
0to3for all mesh types.is equivalent to
max_cell_dimensionalityandmin_cell_dimensionalityfor gridded data typesImageDataandRectilinearGrid.
Examples#
Download Python source code | Download Jupyter notebook
A single point has 0 dimensionality.
>>> import pyvista as pv
>>> mesh = pv.PointSet([[0.0, 0.0, 0.0]])
>>> mesh.dimensionality
0
With two points, the dimensionality is 1.
>>> mesh = pv.PointSet([[0.0, 0.0, 0.0], [1.0, 1.0, 1.0]])
>>> mesh.dimensionality
1
Two-dimensional ImageData (i.e. where one of its dimensions is one) has
a dimensionality of 2.
>>> mesh = pv.ImageData(dimensions=(100, 100, 1))
>>> mesh.dimensionality
2
A Plane() also has dimensionality of 2, even if it’s arbitrarily
rotated in space.
>>> mesh = pv.Plane().rotate_vector((1, 2, 3), 30)
>>> mesh.dimensionality
2
A Cube() has a dimensionality of 3.
>>> mesh = pv.Cube()
>>> mesh.dimensionality
3