<s> import vtk <EOL> from vtk . util . misc import vtkGetDataRoot <EOL> VTK_DATA_ROOT = vtkGetDataRoot ( ) <EOL> ren = vtk . vtkRenderer ( ) <EOL> renWin = vtk . vtkRenderWindow ( ) <EOL> renWin . AddRenderer ( ren ) <EOL> iren = vtk . vtkRenderWindowInteractor ( ) <EOL> iren . SetRenderWindow ( renWin ) <EOL> reader = vtk . vtkStructuredPointsReader ( ) <EOL> reader . SetFileName ( VTK_DATA_ROOT + "<STR_LIT>" ) <EOL> opacityTransferFunction = vtk . vtkPiecewiseFunction ( ) <EOL> opacityTransferFunction . AddPoint ( <NUM_LIT:20> , <NUM_LIT:0.0> ) <EOL> opacityTransferFunction . AddPoint ( <NUM_LIT:255> , <NUM_LIT> ) <EOL> colorTransferFunction = vtk . vtkColorTransferFunction ( ) <EOL> colorTransferFunction . AddRGBPoint ( <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> ) <EOL> colorTransferFunction . AddRGBPoint ( <NUM_LIT> , <NUM_LIT:1.0> , <NUM_LIT:0.0> , <NUM_LIT:0.0> ) <EOL> colorTransferFunction . AddRGBPoint ( <NUM_LIT> , <NUM_LIT:0.0> , <NUM_LIT:0.0> , <NUM_LIT:1.0> ) <EOL> colorTransferFunction . AddRGBPoint ( <NUM_LIT> , <NUM_LIT:0.0> , <NUM_LIT:1.0> , <NUM_LIT:0.0> ) <EOL> colorTransferFunction . AddRGBPoint ( <NUM_LIT> , <NUM_LIT:0.0> , <NUM_LIT> , <NUM_LIT:0.0> ) <EOL> volumeProperty = vtk . vtkVolumeProperty ( ) <EOL> volumeProperty . SetColor ( colorTransferFunction ) <EOL> volumeProperty . SetScalarOpacity ( opacityTransferFunction ) <EOL> volumeMapper = vtk . vtkVolumeTextureMapper2D ( ) <EOL> volumeMapper . SetInputConnection ( reader . GetOutputPort ( ) ) <EOL> volume = vtk . vtkVolume ( ) <EOL> volume . SetMapper ( volumeMapper ) <EOL> volume . SetProperty ( volumeProperty ) <EOL> ren . AddVolume ( volume ) <EOL> renWin . Render ( ) <EOL> def CheckAbort ( obj , event ) : <EOL> if obj . GetEventPending ( ) != <NUM_LIT:0> : <EOL> obj . SetAbortRender ( <NUM_LIT:1> ) <EOL> renWin . AddObserver ( "<STR_LIT>" , CheckAbort ) <EOL> iren . Initialize ( ) <EOL> renWin . Render ( ) <EOL> iren . Start ( ) </s>
