Commit 348aeb03 authored by Ken Martin's avatar Ken Martin
Browse files

Approximate VTK 2.0 release

The VTK 2.0 release tag in CVS was moved file-wise as fixes were made.
Therefore the true history of the 'branch' is gone.  This commit was
manufactured during conversion from CVS to represent the version as a
merge from all the commits whose files have the tag.
......@@ -66,7 +66,7 @@ public:
virtual void *GetGenericDisplayId() = 0;
virtual void *GetGenericWindowId() = 0;
virtual void *GetGenericParentId() = 0;
virtual void *GetGenericContext() = 0;
// useful for scripting languages
virtual void SetWindowInfo(char *) = 0;
......
......@@ -18,8 +18,7 @@ ABSTRACT =
CONCRETE = \
vtkEarthSource \
vtkIVWriter \
vtkOBJReader
vtkIVWriter
#------------------------------------------------------------------------------
# Include the generated targets
......
#
# structured points to geometry
#
catch {load vtktcl}
source ../../examplesTcl/vtkInt.tcl
# Test the new reader
source ../imaging/examplesTcl/vtkImageInclude.tcl
# Image pipeline
vtkImageFileReader reader
reader ReleaseDataFlagOff
reader SetDataMemoryOrder $VTK_IMAGE_COMPONENT_AXIS $VTK_IMAGE_X_AXIS $VTK_IMAGE_Y_AXIS
reader SetFlips 0 0 1 0
reader SetDataDimensions 3 256 256
reader SetFileName "../../data/masonry.ppm"
reader SetDataScalarType $VTK_UNSIGNED_CHAR
#reader DebugOn
# Create the RenderWindow, Renderer and both Actors
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# read in some structured points
#
vtkPNMReader reader
reader SetFileName ../../../vtkdata/B.pgm
vtkStructuredPointsGeometryFilter geometry
geometry SetInput [reader GetOutput]
geometry SetExtent 0 10000 0 10000 0 0
vtkWarpScalar warp
warp SetInput [geometry GetOutput]
warp SetScaleFactor -.1
vtkDataSetMapper mapper
mapper SetInput [warp GetOutput]
mapper SetScalarRange 0 255
mapper ImmediateModeRenderingOff
vtkActor actor
actor SetMapper mapper
# create a plane source and actor
vtkPlaneSource plane
vtkPolyDataMapper planeMapper
planeMapper SetInput [plane GetOutput]
vtkActor planeActor
planeActor SetMapper planeMapper
# load in the texture map
#
vtkTexture atext
atext SetInput [reader GetOutput]
atext InterpolateOn
planeActor SetTexture atext
# Add the actors to the renderer, set the background and size
#
ren1 AddActor actor
[ren1 GetActiveCamera] Azimuth 20
[ren1 GetActiveCamera] Elevation 30
ren1 AddActor planeActor
ren1 SetBackground 0.1 0.2 0.4
renWin SetSize 640 480
renWin SetSize 500 500
# render the image
#
iren SetUserMethod {wm deiconify .vtkInteract}
set cam1 [ren1 GetActiveCamera]
$cam1 Zoom 1.4
iren Initialize
#renWin SetFileName "spToPd.tcl.ppm"
set cam1 [ren1 GetActiveCamera]
$cam1 Elevation -30
$cam1 Roll -20
renWin Render
#renWin SetFileName "TPlane.tcl.ppm"
#renWin SaveImageAsPPM
# prevent the tk window from showing up then start the event loop
wm withdraw .
# Converts gradient vectors and magnitude into a structured points with
# scalars and vectors. It displays them with hedge hogs.
# Now create the RenderWindow and Renderer.
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
## Create an image pipeline
vtkImageSeriesReader reader;
reader SwapBytesOn;
reader SetDataDimensions 256 256 93;
reader SetFilePrefix "../data/fullHead/headsq"
reader SetPixelMask 0x7fff;
reader SetOutputScalarType 1;
#reader DebugOn
vtkImageGradient gradient;
gradient SetInput [reader GetOutput];
gradient SetAxes 0 1 2;
gradient ReleaseDataFlagOff;
vtkImageMagnitude magnitude;
magnitude SetInput [gradient GetOutput];
vtkImageToStructuredPoints image;
image SetScalarInput [magnitude GetOutput];
image SetVectorInput [gradient GetOutput];
image SetExtent 0 255 0 255 20 20;
image SetAxes 0 1 2;
# create vis pipeline
#
vtkHedgeHog hhog;
hhog SetInput [image GetOutput];
hhog SetScaleFactor 0.002;
vtkLookupTable lut;
# lut SetHueRange 0 10;
lut Build;
vtkPolyDataMapper hhogMapper;
hhogMapper SetInput [hhog GetOutput];
hhogMapper SetScalarRange 50 2000;
hhogMapper SetLookupTable lut;
vtkActor hhogActor;
hhogActor SetMapper hhogMapper;
vtkOutlineFilter outline;
outline SetInput [image GetOutput];
vtkPolyDataMapper outlineMapper;
outlineMapper SetInput [outline GetOutput];
vtkActor outlineActor;
outlineActor SetMapper outlineMapper;
set outlineProp [outlineActor GetProperty];
#eval $outlineProp SetColor 0 0 0;
# Add the actors to the renderer, set the background and size
#
ren1 AddActor outlineActor;
ren1 AddActor hhogActor;
ren1 SetBackground 1 1 1;
renWin SetSize 500 500;
#renWin SetSize 1000 1000;
ren1 SetBackground 0.1 0.2 0.4;
iren Initialize;
# render the image
#
iren SetUserMethod {wm deiconify .vtkInteract};
[ren1 GetActiveCamera] Zoom 1.5;
renWin Render;
#renWin SetFileName "complexV.tcl.ppm";
#renWin SaveImageAsPPM;
# prevent the tk window from showing up then start the event loop
wm withdraw .
catch {load vtktcl}
# Convert a structured points data set into an image.
# Display the image in an XViewer.
source ../imaging/examplesTcl/vtkImageInclude.tcl
vtkVolume16Reader v16
v16 SetDataDimensions 256 256
v16 SetFilePrefix "../../vtkdata/fullHead/headsq";
v16 SetDataOrigin -127.5 -127.5 5.33
v16 SetImageRange 1 94
v16 SetDataSpacing 1 1 5.33
v16 SwapBytesOn
v16 Update
vtkStructuredPointsToImage sti
sti SetInput [v16 GetOutput]
#sti Update
vtkImageXViewer viewer;
#viewer DebugOn;
viewer SetInput [sti GetOutput];
viewer SetZSlice 22;
viewer SetColorWindow 3000
viewer SetColorLevel 1500
# make interface
source ../imaging/examplesTcl/WindowLevelInterface.tcl
# Convert a structured points data set into an image.
# Display the image in an XViewer.
source ../imaging/examplesTcl/vtkImageInclude.tcl
vtkVolume16Reader v16
v16 SetDataDimensions 256 256
v16 SetFilePrefix "../data/fullHead/headsq";
v16 SetDataOrigin -127.5 -127.5 5.33
v16 SetImageRange 1 90
v16 SetDataSpacing 1 1 5.33
v16 SwapBytesOn
v16 Update
vtkImageXViewer viewer;
#viewer DebugOn;
viewer SetInput [v16 GetOutput];
viewer SetZSlice 22;
viewer SetColorWindow 3000
viewer SetColorLevel 1500
viewer Render;
# make interface
source ../imaging/examplesTcl/WindowLevelInterface.tcl
#
# these transformations permute medical image data to maintain proper orientation
# regardless os the acqusition order. After apply these transforms with
# vtkTransformFilter, a view up of 0,-1,0 will result in the body part
# facing the viewer.
# NOTE: some transformations have a -1 scale factor for one of the components.
# To ensure proper polygon orientation and normal direction, you must
# apply the vtkPolyNormals filter.
vtkTransform is;
# is RotateX 90;
[is GetMatrix] SetElement 0 0 1
[is GetMatrix] SetElement 0 1 0
[is GetMatrix] SetElement 0 2 0
[is GetMatrix] SetElement 0 3 0
[is GetMatrix] SetElement 1 0 0
[is GetMatrix] SetElement 1 1 0
[is GetMatrix] SetElement 1 2 -1
[is GetMatrix] SetElement 1 3 0
[is GetMatrix] SetElement 2 0 0
[is GetMatrix] SetElement 2 1 1
[is GetMatrix] SetElement 2 2 0
[is GetMatrix] SetElement 2 3 0
[is GetMatrix] SetElement 3 0 0
[is GetMatrix] SetElement 3 1 0
[is GetMatrix] SetElement 3 2 0
[is GetMatrix] SetElement 3 3 1
vtkTransform si;
# si RotateX -90;
# si Scale 1 -1 1;
[si GetMatrix] SetElement 0 0 1
[si GetMatrix] SetElement 0 1 0
[si GetMatrix] SetElement 0 2 0
[si GetMatrix] SetElement 0 3 0
[si GetMatrix] SetElement 1 0 0
[si GetMatrix] SetElement 1 1 0
[si GetMatrix] SetElement 1 2 1
[si GetMatrix] SetElement 1 3 0
[si GetMatrix] SetElement 2 0 0
[si GetMatrix] SetElement 2 1 1
[si GetMatrix] SetElement 2 2 0
[si GetMatrix] SetElement 2 3 0
[si GetMatrix] SetElement 3 0 0
[si GetMatrix] SetElement 3 1 0
[si GetMatrix] SetElement 3 2 0
[si GetMatrix] SetElement 3 3 1
vtkTransform pa;
pa Scale 1 1 -1;
vtkTransform ap;
vtkTransform rl;
# rl RotateY -90;
# rl Scale 1 1 -1;
[rl GetMatrix] SetElement 0 0 0
[rl GetMatrix] SetElement 0 1 0
[rl GetMatrix] SetElement 0 2 1
[rl GetMatrix] SetElement 0 3 0
[rl GetMatrix] SetElement 1 0 0
[rl GetMatrix] SetElement 1 1 1
[rl GetMatrix] SetElement 1 2 0
[rl GetMatrix] SetElement 1 3 0
[rl GetMatrix] SetElement 2 0 1
[rl GetMatrix] SetElement 2 1 0
[rl GetMatrix] SetElement 2 2 0
[rl GetMatrix] SetElement 2 3 0
[rl GetMatrix] SetElement 3 0 0
[rl GetMatrix] SetElement 3 1 0
[rl GetMatrix] SetElement 3 2 0
[rl GetMatrix] SetElement 3 3 1
vtkTransform lr;
# lr RotateY -90;
[lr GetMatrix] SetElement 0 0 0
[lr GetMatrix] SetElement 0 1 0
[lr GetMatrix] SetElement 0 2 -1
[lr GetMatrix] SetElement 0 3 0
[lr GetMatrix] SetElement 1 0 0
[lr GetMatrix] SetElement 1 1 1
[lr GetMatrix] SetElement 1 2 0
[lr GetMatrix] SetElement 1 3 0
[lr GetMatrix] SetElement 2 0 1
[lr GetMatrix] SetElement 2 1 0
[lr GetMatrix] SetElement 2 2 0
[lr GetMatrix] SetElement 2 3 0
[lr GetMatrix] SetElement 3 0 0
[lr GetMatrix] SetElement 3 1 0
[lr GetMatrix] SetElement 3 2 0
[lr GetMatrix] SetElement 3 3 1
Demo mace.tcl Mace
Chapter 2
Topic Glyphs
Topic Graphics
BeginDescription
A simple example of using glyphs to create a mace
EndDescription
Demo vol.tcl Volume Rendering With UI
Chapter 7
Topic Volume Rendering
BeginDescription
A volume rendering example with controls for viewing slices and changing
rendering parameters
EndDescription
Demo bottle.tcl Bottle
Topic Modelling
Topic Graphics
Demo volSimple.tcl Simple Volume Rendering Example
Chapter 7
Demo OBBTree.tcl Oriented Bounding Box Tree
Topic Graphics
Demo hello.tcl Hello
Topic Graphics
Topic Modelling
Chapter 3
BeginDescription
This example loads lines in the shape of the word hello, uses
implicit modelling to create a volume from these lines, then uses a contour
filter to extract a surface from the volume.
EndDescription
#
# some functions for look-and-feel
#
set the_font "-*-helvetica-bold-r-normal--12-*-*-*-p-70-iso8859-1"
proc SetFrameProperties { w } {
$w configure -bg #224488 -bd 0
}
proc SetButtonProperties { w } {
global the_font
$w configure -bg #bbbbbb -fg #224488 -highlightthickness 0 \
-activebackground #dddddd -activeforeground #112244 \
-font $the_font
}
proc SetLabelProperties { w } {
global the_font
$w configure -bg #224488 -fg #bbbbbb \
-font $the_font
}
proc SetMenuProperties { w } {
global the_font
$w configure -fg #224488 -bg #bbbbbb \
-activebackground #dddddd -activeforeground #112244 \
-font $the_font -tearoff 0
}
proc SetMenuButtonProperties { w } {
global the_font
$w configure -bg #bbbbbb -fg #224488 \
-activebackground #dddddd -activeforeground #112244 \
-font $the_font -highlightthickness 0 -bd 4 -relief raised
}
proc SetScrolledListboxProperties { w1 w2 } {
global the_font
$w1 configure -bg #bbbbbb -fg #000000 \
-font $the_font \
-selectforeground #000000 -selectbackground #cccccc \
-bd 4 -relief sunken -highlightthickness 0 \
-yscrollcommand " $w2 set "
$w2 configure -bg #bbbbbb \
-activebackground #dddddd -troughcolor #aaaaaa \
-highlightthickness 0 -bd 4 -relief sunken \
-command " $w1 yview " -orient vertical
}
proc SetScrolledTextProperties { w1 w2 } {
global the_font
$w1 configure -bg #bbbbbb -fg #000000 \
-font $the_font \
-selectforeground #000000 -selectbackground #cccccc \
-bd 4 -relief sunken -highlightthickness 0 \
-yscrollcommand " $w2 set "
$w2 configure -bg #bbbbbb \
-activebackground #dddddd -troughcolor #aaaaaa \
-highlightthickness 0 -bd 4 -relief sunken \
-command " $w1 yview " -orient vertical
}
#
# Process the data file
#
set DataFile Launcher.dat
set fd [open $DataFile]
set ActiveDemo none
set OneLine [gets $fd]
while { ![eof $fd] } {
if { $OneLine != "" } {
set count [scan $OneLine "%s" FirstWord]
if { $count > 0 && $FirstWord != "" } {
if { $FirstWord == "Demo" } {
scan $OneLine "%s %s" FirstWord SecondWord
set index [expr [string first $SecondWord $OneLine] + \
[string length $SecondWord] + 1]
set DemoName [string range $OneLine $index end]
set Demos($SecondWord) $DemoName
set ActiveDemo $SecondWord
}
if { $FirstWord == "Chapter" } {
scan $OneLine "%s %s" FirstWord SecondWord
set CurrentList [lindex [array get Chapters $SecondWord] 1]
set CurrentList [lappend CurrentList $ActiveDemo]
set Chapters($SecondWord) $CurrentList
}
if { $FirstWord == "Topic" } {
set index [expr [string first $FirstWord $OneLine] + \
[string length $FirstWord] + 1]
set TopicName [string range $OneLine $index end]
set CurrentList [lindex [array get Topics $TopicName] 1]
set CurrentList [lappend CurrentList $ActiveDemo]
set Topics($TopicName) $CurrentList
}
if { $FirstWord == "BeginDescription" } {
set OneLine [gets $fd]
set Message ""
while { $OneLine != "EndDescription" } {
set Message "$Message $OneLine"
set OneLine [gets $fd]
}
set Descriptions($ActiveDemo) $Message
}
}
}
set OneLine [gets $fd]
}
#
# Create the user interface
#
set ViewBy Topic
wm withdraw .
toplevel .win -visual best -bg #224488
frame .win.viewby
SetFrameProperties .win.viewby
.win.viewby configure -bd 2 -relief ridge
label .win.viewby.label -text "View Demos By: "
SetLabelProperties .win.viewby.label
menubutton .win.viewby.menubutton -text $ViewBy \
-menu .win.viewby.menubutton.menu
SetMenuButtonProperties .win.viewby.menubutton
menu .win.viewby.menubutton.menu
SetMenuProperties .win.viewby.menubutton.menu
.win.viewby.menubutton.menu add command -label "Topic" \
-command { .win.viewby.menubutton configure -text Topic; \
set ViewBy Topic; \
.win.type.label configure -text { Topic: }; \
catch { pack forget .win.type.topicmenu }; \
catch { pack forget .win.type.chaptermenu }; \
pack .win.type.topicmenu -side left -expand 0 -fill none \
-padx 4 -pady 4; \
ChangeViewBy }
.win.viewby.menubutton.menu add command -label "Chapter" \
-command { .win.viewby.menubutton configure -text {Chapter}; \
set ViewBy Chapter; \
.win.type.label configure -text { Chapter: }; \
catch { pack forget .win.type.topicmenu }; \
catch { pack forget .win.type.chaptermenu }; \
pack .win.type.chaptermenu -side left -expand 0 -fill none \
-padx 4 -pady 4; \
ChangeViewBy }
pack .win.viewby.label .win.viewby.menubutton -side left -expand 0 -fill none \
-padx 4 -pady 4 -anchor w
set Topic [lindex [array names Topics] 1]
set Chapter [lindex [array names Chapters] 1]
frame .win.type
SetFrameProperties .win.type
.win.type configure -bd 2 -relief ridge
label .win.type.label -text { Topic: }
SetLabelProperties .win.type.label
menubutton .win.type.topicmenu -text $Topic \
-menu .win.type.topicmenu.menu
SetMenuButtonProperties .win.type.topicmenu
menu .win.type.topicmenu.menu
SetMenuProperties .win.type.topicmenu.menu
foreach name [array names Topics] {
.win.type.topicmenu.menu add command -label $name \
-command [subst { .win.type.topicmenu configure -text "$name"; \
set Topic "$name"; ChangeTopic }]
}
menubutton .win.type.chaptermenu -text $Chapter \
-menu .win.type.chaptermenu.menu
SetMenuButtonProperties .win.type.chaptermenu
menu .win.type.chaptermenu.menu
SetMenuProperties .win.type.chaptermenu.menu
foreach name [array names Chapters] {
.win.type.chaptermenu.menu add command -label $name \
-command [subst { .win.type.chaptermenu configure -text "$name"; \
set Chapter "$name"; ChangeChapter }]
}
pack .win.type.label .win.type.topicmenu -side left -expand 0 -fill none \
-padx 4 -pady 4 -anchor w
frame .win.listframe
SetFrameProperties .win.listframe
.win.listframe configure -bd 2 -relief ridge
frame .win.listframe.listmsg
SetFrameProperties .win.listframe.listmsg
label .win.listframe.listmsg.msg -text "Demo List
Single Click To View Description
Double Click To Run Demo"
SetLabelProperties .win.listframe.listmsg.msg
pack .win.listframe.listmsg.msg -side top -anchor n -expand 1 -fill both
frame .win.listframe.list
SetFrameProperties .win.listframe.list
listbox .win.listframe.list.box -width 50 -height 10