File: ImageActorStressed.tcl

package info (click to toggle)
vtk6 6.3.0%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 118,880 kB
  • sloc: cpp: 1,442,792; ansic: 113,395; python: 72,383; tcl: 46,998; xml: 8,119; yacc: 4,525; java: 4,239; perl: 3,108; lex: 1,694; sh: 1,093; asm: 154; makefile: 103; objc: 17
file content (154 lines) | stat: -rw-r--r-- 3,897 bytes parent folder | download | duplicates (12)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
package require vtk
package require vtkinteraction

# Create the RenderWindow, Renderer and both Actors
vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin

# First one tests the changing display extent without
# changing the size of the display extent (so it
# reuses a texture, but not a contiguous one)
vtkImageEllipsoidSource gsOne
gsOne SetWholeExtent 0 999 0 999 0 0
gsOne SetCenter 500 500 0
gsOne SetRadius 300 400 0
gsOne SetInValue 0
gsOne SetOutValue 255
gsOne SetOutputScalarTypeToUnsignedChar

vtkImageShiftScale ssOne
ssOne SetInputConnection [gsOne GetOutputPort]
ssOne SetOutputScalarTypeToUnsignedChar
ssOne SetShift 0
ssOne SetScale 1
ssOne UpdateWholeExtent

vtkImageActor iaOne
[iaOne GetMapper] SetInputConnection [ssOne GetOutputPort]

ren1 AddActor iaOne

# The second one tests a really large texture
vtkImageEllipsoidSource gsTwo
gsTwo SetWholeExtent 1000 8999 1000 8999 0 0
gsTwo SetCenter 4000 4000 0
gsTwo SetRadius 1800 1800 0
gsTwo SetInValue 250
gsTwo SetOutValue 150
gsTwo SetOutputScalarTypeToUnsignedChar

vtkImageShiftScale ssTwo
ssTwo SetInputConnection [gsTwo GetOutputPort]
ssTwo SetOutputScalarTypeToUnsignedChar
ssTwo SetShift 0
ssTwo SetScale 1
ssTwo UpdateWholeExtent

vtkImageActor iaTwo
[iaTwo GetMapper] SetInputConnection [ssTwo GetOutputPort]
iaTwo SetScale 0.1 0.1 1.0
iaTwo AddPosition 1000 1000 0

ren1 AddActor iaTwo

# The third one will test changing input and a
# power of two texture
vtkImageEllipsoidSource gsThree
gsThree SetWholeExtent 0 511 2000 2511 0 0
gsThree SetCenter 255 2255 0
gsThree SetRadius 100 200 0
gsThree SetInValue 250
gsThree SetOutValue 0
gsThree SetOutputScalarTypeToUnsignedChar

vtkImageShiftScale ssThree
ssThree SetInputConnection [gsThree GetOutputPort]
ssThree SetOutputScalarTypeToUnsignedChar
ssThree SetShift 0
ssThree SetScale 1
ssThree UpdateWholeExtent

vtkImageActor iaThree
[iaThree GetMapper] SetInputConnection [ssThree GetOutputPort]

ren1 AddActor iaThree


# Same as first one, but the display extents
# represent contiguous section of memory that
# are powers of two
vtkImageEllipsoidSource gsFour
gsFour SetWholeExtent 2000 2511 0 511 0 0
gsFour SetCenter 2255 255 0
gsFour SetRadius 130 130 0
gsFour SetInValue 40
gsFour SetOutValue 190
gsFour SetOutputScalarTypeToUnsignedChar

vtkImageShiftScale ssFour
ssFour SetInputConnection [gsFour GetOutputPort]
ssFour SetOutputScalarTypeToUnsignedChar
ssFour SetShift 0
ssFour SetScale 1
ssFour UpdateWholeExtent

vtkImageActor iaFour
[iaFour GetMapper] SetInputConnection [ssFour GetOutputPort]

ren1 AddActor iaFour

# Same as previous one, but the display extents
# represent contiguous section of memory that
# are not powers of two
vtkImageEllipsoidSource gsFive
gsFive SetWholeExtent 1200 1712 0 512 0 0
gsFive SetCenter 1456 256 0
gsFive SetRadius 130 180 0
gsFive SetInValue 190
gsFive SetOutValue 100
gsFive SetOutputScalarTypeToUnsignedChar

vtkImageShiftScale ssFive
ssFive SetInputConnection [gsFive GetOutputPort]
ssFive SetOutputScalarTypeToUnsignedChar
ssFive SetShift 0
ssFive SetScale 1
ssFive UpdateWholeExtent

vtkImageActor iaFive
[iaFive GetMapper] SetInputConnection [ssFive GetOutputPort]

ren1 AddActor iaFive


ren1 SetBackground 0.1 0.2 0.4
renWin SetSize 400 400

# render the image
iren AddObserver UserEvent {wm deiconify .vtkInteract}
ren1 ResetCamera
[ren1 GetActiveCamera] Zoom 1.5
renWin Render


# prevent the tk window from showing up then start the event loop
wm withdraw .


renWin Render

iaOne SetDisplayExtent 200 999 200 999 0 0
iaFour SetDisplayExtent 2000 2511 0 300 0 0
iaFive SetDisplayExtent 1200 1712 0 300 0 0
gsThree SetRadius 120 120 0
renWin Render

iaOne SetDisplayExtent 0 799 0 799 0 0
iaFour SetDisplayExtent 2000 2511 200 500 0 0
iaFive SetDisplayExtent 1200 1712 200 500 0 0
gsThree SetRadius 150 150 0
renWin Render