1 |
""" |
2 |
class that represents scalar data as plane deformated along the plane normal |
3 |
and proportional to the scalar value on the plane. |
4 |
""" |
5 |
|
6 |
import vtk |
7 |
from plane import Plane |
8 |
from common import Common |
9 |
|
10 |
class Carpet(Common, Plane): |
11 |
""" |
12 |
represents scalar data as plane deformated along the plane normal |
13 |
and proportional to the scalar value on the plane. |
14 |
""" |
15 |
|
16 |
def __init__(self, scene, data_collector, lut = None): |
17 |
Common.__init__(self, scene, data_collector) |
18 |
self.vtk_plane = vtk.vtkPlane() |
19 |
self.vtk_cutter = vtk.vtkCutter() |
20 |
self.vtk_transform = vtk.vtkTransform() |
21 |
self.vtk_transform_filter = vtk.vtkTransformPolyDataFilter() |
22 |
self.vtk_warp = vtk.vtkWarpScalar() |
23 |
|
24 |
Plane.setPlane(self) |
25 |
Plane.setCutter(self, data_collector.getReader().GetOutput()) |
26 |
self.warpScalar() |
27 |
Plane.setTransformFilter(self, self.vtk_warp.GetOutput()) |
28 |
|
29 |
Common.setMapperInput(self, self.vtk_transform_filter.GetOutput(), lut) |
30 |
Common.setActorInput(self) |
31 |
Common.addActor(self) |
32 |
|
33 |
def warpScalar(self): |
34 |
self.vtk_warp.SetInput(self.vtk_cutter.GetOutput()) |
35 |
self.vtk_warp.SetScaleFactor(0.5) |
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|