File: TestAllLogic.tcl

package info (click to toggle)
paraview 4.0.1-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 526,572 kB
  • sloc: cpp: 2,284,430; ansic: 816,374; python: 239,936; xml: 70,162; tcl: 48,295; fortran: 39,116; yacc: 5,466; java: 3,518; perl: 3,107; lex: 1,620; sh: 1,555; makefile: 932; asm: 471; pascal: 228
file content (56 lines) | stat: -rw-r--r-- 1,743 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
# append multiple displaced spheres into an RGB image.
package require vtk


# Image pipeline

vtkRenderWindow imgWin

set logics "And Or Xor Nand Nor Not"
set types "Float Double UnsignedInt UnsignedLong UnsignedShort UnsignedChar"
set i 0
foreach operator $logics {
    set ScalarType [lindex $types $i]

    vtkImageEllipsoidSource sphere1${operator}
      sphere1${operator} SetCenter 95 100 0
      sphere1${operator} SetRadius 70 70 70
      sphere1${operator} SetOutputScalarTypeTo${ScalarType}
      sphere1${operator} Update

    vtkImageEllipsoidSource sphere2${operator}
      sphere2${operator} SetCenter 161 100 0
      sphere2${operator} SetRadius 70 70 70
      sphere2${operator} SetOutputScalarTypeTo${ScalarType}
      sphere2${operator} Update

    vtkImageLogic logic${operator}
      logic${operator} SetInput1Data [sphere1${operator} GetOutput]
   if {$operator != "Not"} {
      logic${operator} SetInput2Data [sphere2${operator} GetOutput]
   }
      logic${operator} SetOutputTrueValue 150
      logic${operator} SetOperationTo${operator}
    vtkImageMapper mapper${operator}
      mapper${operator} SetInputConnection [logic${operator} GetOutputPort]
      mapper${operator} SetColorWindow 255
      mapper${operator} SetColorLevel 127.5
    vtkActor2D actor${operator}
      actor${operator} SetMapper mapper${operator}
    vtkRenderer imager${operator}
      imager${operator} AddActor2D actor${operator}
    imgWin AddRenderer imager${operator}
    incr i
}

imagerAnd SetViewport 0 .5 .33 1
imagerOr SetViewport .33 .5 .66 1
imagerXor SetViewport .66 .5 1 1
imagerNand SetViewport 0 0 .33 .5
imagerNor SetViewport .33 0 .66 .5
imagerNot SetViewport .66 0 1 .5

imgWin SetSize 768 512
imgWin Render

wm withdraw .