File: skinOrder.tcl

package info (click to toggle)
vtk 5.8.0-13
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 130,524 kB
  • sloc: cpp: 1,129,256; ansic: 708,203; tcl: 48,526; python: 20,875; xml: 6,779; yacc: 4,208; perl: 3,121; java: 2,788; lex: 931; sh: 660; asm: 471; makefile: 299
file content (76 lines) | stat: -rw-r--r-- 2,199 bytes parent folder | download | duplicates (8)
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
package require vtk
package require vtkinteraction
package require vtktesting

source [file join [file dirname [info script]] SliceOrder.tcl]

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

set RESOLUTION 64
set START_SLICE 50
set END_SLICE 60
set PIXEL_SIZE 3.2
set centerX [expr ( $RESOLUTION / 2 )]
set centerY [expr ( $RESOLUTION / 2 )]
set centerZ [expr ( $END_SLICE - $START_SLICE ) / 2]
set endX [expr ( $RESOLUTION - 1 ) ]
set endY [expr ( $RESOLUTION - 1 ) ]
set endZ [expr ( $END_SLICE - 1 ) ]
set origin [expr ( $RESOLUTION / 2.0 ) * $PIXEL_SIZE * -1.0]

vtkMath math

set orders "ap pa si is lr rl"

foreach order $orders {
  vtkVolume16Reader reader$order
    eval reader$order SetDataDimensions $RESOLUTION $RESOLUTION
    reader$order SetFilePrefix $VTK_DATA_ROOT/Data/headsq/quarter
    reader$order SetDataSpacing $PIXEL_SIZE $PIXEL_SIZE 1.5
    reader$order SetDataOrigin $origin $origin 1.5
    reader$order SetImageRange $START_SLICE $END_SLICE
    reader$order SetTransform $order
    reader$order SetHeaderSize 0
    reader$order SetDataMask 0x7fff;
    reader$order SetDataByteOrderToLittleEndian
    [reader$order GetOutput] ReleaseDataFlagOn

  vtkContourFilter iso$order
    iso$order SetInputConnection [reader$order GetOutputPort]
    iso$order SetValue 0 550.5
    iso$order ComputeScalarsOff
    iso$order ReleaseDataFlagOn

  vtkPolyDataMapper mapper$order
    mapper$order SetInputConnection [iso$order GetOutputPort]
    mapper$order ImmediateModeRenderingOn

  vtkActor actor$order
    actor$order SetMapper mapper$order
    [actor$order GetProperty] SetDiffuseColor [math Random .5 1] [math Random .5 1] [math Random .5 1]

    ren1 AddActor actor$order
}

renWin SetSize 300 300
ren1 ResetCamera
[ren1 GetActiveCamera] Azimuth 210
[ren1 GetActiveCamera] Elevation 30
[ren1 GetActiveCamera] Dolly 1.2
ren1 ResetCameraClippingRange

ren1 SetBackground .8 .8 .8
iren Initialize;

renWin Render

iren AddObserver UserEvent {wm deiconify .vtkInteract};

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