File: TestShearWarpMip.tcl

package info (click to toggle)
vtk 5.0.4-1.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 51,084 kB
  • ctags: 70,426
  • sloc: cpp: 524,166; ansic: 220,276; tcl: 43,377; python: 14,037; perl: 3,102; java: 1,436; yacc: 1,033; sh: 339; lex: 248; makefile: 197; asm: 154
file content (85 lines) | stat: -rw-r--r-- 2,486 bytes parent folder | download | duplicates (2)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# This is a simple volume rendering example that
# uses a vtkVolumeRayCast mapper

package require vtk
package require vtkinteraction

# Simple volume rendering example.
vtkImageReader reader
reader SetDataByteOrderToLittleEndian
reader SetDataExtent 0 63 0 63 1 93
reader SetFilePrefix "$VTK_DATA_ROOT/Data/headsq/quarter"
reader SetDataMask 0x7fff
reader SetDataSpacing 2 2 1
reader SetDataScalarTypeToUnsignedShort
reader Update

[reader GetOutput] SetOrigin -63 -63 -46

# Create transfer functions for opacity and color
vtkPiecewiseFunction opacityTransferFunction
    opacityTransferFunction AddPoint  100  0.0
    opacityTransferFunction AddPoint 2000  1.0

vtkColorTransferFunction colorTransferFunction
    colorTransferFunction ClampingOff
    colorTransferFunction AddRGBPoint      0.0 1.00 0.0 0.0
    colorTransferFunction AddRGBPoint   1000.0 0.00 1.0 0.0
    colorTransferFunction AddRGBPoint   2000.0 0.00 0.0 1.0
    colorTransferFunction AddRGBPoint   3000.0 1.00 1.0 1.0
    colorTransferFunction AddRGBPoint   4000.0 1.00 1.0 1.0
#    colorTransferFunction SetColorSpaceToHSV

# Create properties, mappers, volume actors, and ray cast function
vtkVolumeProperty volumeProperty
    volumeProperty SetColor colorTransferFunction
    volumeProperty SetScalarOpacity opacityTransferFunction
    volumeProperty ShadeOn
    volumeProperty SetInterpolationTypeToLinear 

# The mapper / ray cast function know how to render the data
vtkOpenGLVolumeShearWarpMapper  volumeMapper
   volumeMapper SetInputConnection [reader GetOutputPort]
	volumeMapper FastClassificationOff
	volumeMapper SetFunctionTypeToMIP
volumeMapper IntermixIntersectingGeometryOn

# The volume holds the mapper and the property and
# can be used to position/orient the volume
vtkVolume volume
    volume SetMapper volumeMapper
    volume SetProperty volumeProperty

	vtkCamera cam
	cam ParallelProjectionOn

# Create the standard renderer, render window
# and interactor
vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

ren1 SetActiveCamera cam
#ren1 AddVolume volume
ren1 SetBackground 0.5 0.5 0.5
renWin SetSize 600 600

ren1 AddVolume volume
ren1 ResetCamera
renWin Render

proc TkCheckAbort {} {
  set foo [renWin GetEventPending]
  if {$foo != 0} {renWin SetAbortRender 1}
}
renWin AddObserver AbortCheckEvent {TkCheckAbort}

iren AddObserver UserEvent {wm deiconify .vtkInteract}
iren Initialize

wm withdraw .