pyvista.ImageData.dimensionality#
- property ImageData.dimensionality: Literal[0, 1, 2, 3][source]#
Return the spatial dimensions spanned by this dataset.
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.
Examples
A single point has
0dimensionality.>>> 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 of2.>>> mesh = pv.ImageData(dimensions=(100, 100, 1)) >>> mesh.dimensionality 2
A
Plane()also has dimensionality of2, 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