MCPcopy Create free account
hub / github.com/Kitware/VTK / testVolumePicker

Method testVolumePicker

Rendering/Volume/Testing/Python/VolumePicker.py:48–283  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

46class VolumePicker(vtkmodules.test.Testing.vtkTest):
47
48 def testVolumePicker(self):
49 # volume render a medical data set
50
51 # renderer and interactor
52 ren = vtkRenderer()
53
54 renWin = vtkRenderWindow()
55 renWin.AddRenderer(ren)
56
57 iRen = vtkRenderWindowInteractor()
58 iRen.SetRenderWindow(renWin)
59
60 # read the volume
61 v16 = vtkVolume16Reader()
62 v16.SetDataDimensions(64, 64)
63 v16.SetImageRange(1, 93)
64 v16.SetDataByteOrderToLittleEndian()
65 v16.SetFilePrefix(VTK_DATA_ROOT + "/Data/headsq/quarter")
66 v16.SetDataSpacing(3.2, 3.2, 1.5)
67
68 #---------------------------------------------------------
69 # set up the volume rendering
70
71 volumeMapper = vtkFixedPointVolumeRayCastMapper()
72 volumeMapper.SetInputConnection(v16.GetOutputPort())
73
74 volumeColor = vtkColorTransferFunction()
75 volumeColor.AddRGBPoint(0, 0.0, 0.0, 0.0)
76 volumeColor.AddRGBPoint(180, 0.3, 0.1, 0.2)
77 volumeColor.AddRGBPoint(1000, 1.0, 0.7, 0.6)
78 volumeColor.AddRGBPoint(2000, 1.0, 1.0, 0.9)
79
80 volumeScalarOpacity = vtkPiecewiseFunction()
81 volumeScalarOpacity.AddPoint(0, 0.0)
82 volumeScalarOpacity.AddPoint(180, 0.0)
83 volumeScalarOpacity.AddPoint(1000, 0.2)
84 volumeScalarOpacity.AddPoint(2000, 0.8)
85
86 volumeGradientOpacity = vtkPiecewiseFunction()
87 volumeGradientOpacity.AddPoint(0, 0.0)
88 volumeGradientOpacity.AddPoint(90, 0.5)
89 volumeGradientOpacity.AddPoint(100, 1.0)
90
91 volumeProperty = vtkVolumeProperty()
92 volumeProperty.SetColor(volumeColor)
93 volumeProperty.SetScalarOpacity(volumeScalarOpacity)
94 volumeProperty.SetGradientOpacity(volumeGradientOpacity)
95 volumeProperty.SetInterpolationTypeToLinear()
96 volumeProperty.ShadeOn()
97 volumeProperty.SetAmbient(0.6)
98 volumeProperty.SetDiffuse(0.6)
99 volumeProperty.SetSpecular(0.1)
100
101 volume = vtkVolume()
102 volume.SetMapper(volumeMapper)
103 volume.SetProperty(volumeProperty)
104
105 #---------------------------------------------------------

Callers

nothing calls this directly

Calls 15

vtkStripperClass · 0.85
vtkDataSetMapperClass · 0.85
SetImageRangeMethod · 0.80
SetDataSpacingMethod · 0.80
AddRGBPointMethod · 0.80
SetScalarOpacityMethod · 0.80
SetGradientOpacityMethod · 0.80
ShadeOnMethod · 0.80
SetSliceNumberMethod · 0.80
RotateWXYZMethod · 0.80
AddClippingPlaneMethod · 0.80
GetActiveCameraMethod · 0.80

Tested by

no test coverage detected