/
volume.py
65 lines (50 loc) · 1.68 KB
/
volume.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""PyVista volume module."""
from . import _vtk
from ._property import Property
from .mapper import _BaseMapper
from .prop3d import Prop3D
class Volume(Prop3D, _vtk.vtkVolume):
"""Wrapper class for VTK volume.
This class represents a volume in a rendered scene. It inherits
functions related to the volume's position, orientation and origin
from Prop3D.
"""
def __init__(self):
"""Initialize volume."""
super().__init__()
@property
def mapper(self) -> _BaseMapper: # numpydoc ignore=RT01
"""Return or set the mapper of the volume.
Examples
--------
Add a volume to a :class:`pyvista.Plotter` and get its mapper.
>>> import pyvista as pv
>>> vol = pv.ImageData(dimensions=(10, 10, 10))
>>> vol['scalars'] = 255 - vol.z * 25
>>> pl = pv.Plotter()
>>> actor = pl.add_volume(vol)
>>> actor.mapper.bounds
(0.0, 9.0, 0.0, 9.0, 0.0, 9.0)
"""
return self.GetMapper()
@mapper.setter
def mapper(self, obj): # numpydoc ignore=GL08
self.SetMapper(obj)
@property
def prop(self): # numpydoc ignore=RT01
"""Return or set the property of this actor.
Examples
--------
Create an volume and get its properties.
>>> import pyvista as pv
>>> vol = pv.ImageData(dimensions=(10, 10, 10))
>>> vol['scalars'] = 255 - vol.z * 25
>>> pl = pv.Plotter()
>>> actor = pl.add_volume(vol)
>>> actor.prop.GetShade()
0
"""
return self.GetProperty()
@prop.setter
def prop(self, obj: Property): # numpydoc ignore=GL08
self.SetProperty(obj)