Commit 4c28bc70 authored by Amy Squillacote's avatar Amy Squillacote
Browse files

ENH: re-enabling VolumePro 1000 support

parent eceac00a
# Try to find VLI libraries for VolumePro.
# Once done this will define
#
# VLI_LIBRARY_FOR_VG500
# VLI_LIBRARY_FOR_VP1000
# VLI_INCLUDE_PATH_FOR_VG500
# VLI_INCLUDE_PATH_FOR_VP1000
#
# The VolumePro VG500 (using the following variables) is no longer supported.
# VLI_LIBRARY_FOR_VG500
# VLI_INCLUDE_PATH_FOR_VG500
FIND_LIBRARY(VLI_LIBRARY_FOR_VG500
NAMES vli
PATHS
/usr/lib
/usr/local/lib
/opt/vli/lib
"C:/Program Files/VolumePro/lib"
)
#FIND_LIBRARY(VLI_LIBRARY_FOR_VG500
# NAMES vli
# PATHS
# /usr/lib
# /usr/local/lib
# /opt/vli/lib
# "C:/Program Files/VolumePro/lib"
# )
FIND_LIBRARY(VLI_LIBRARY_FOR_VP1000
NAMES vli3
......@@ -24,19 +26,19 @@ FIND_LIBRARY(VLI_LIBRARY_FOR_VP1000
"C:/Program Files/VolumePro1000/lib"
)
IF (VLI_LIBRARY_FOR_VG500)
IF (WIN32)
FIND_PATH(VLI_INCLUDE_PATH_FOR_VG500 VolumePro/inc/vli.h
"C:/Program Files"
)
ELSE (WIN32)
FIND_PATH(VLI_INCLUDE_PATH_FOR_VG500 vli/include/vli.h
/usr
/usr/local
/opt
)
ENDIF (WIN32)
ENDIF (VLI_LIBRARY_FOR_VG500)
#IF (VLI_LIBRARY_FOR_VG500)
# IF (WIN32)
# FIND_PATH(VLI_INCLUDE_PATH_FOR_VG500 VolumePro/inc/vli.h
# "C:/Program Files"
# )
# ELSE (WIN32)
# FIND_PATH(VLI_INCLUDE_PATH_FOR_VG500 vli/include/vli.h
# /usr
# /usr/local
# /opt
# )
# ENDIF (WIN32)
#ENDIF (VLI_LIBRARY_FOR_VG500)
IF (VLI_LIBRARY_FOR_VP1000)
IF (WIN32)
......
......@@ -99,6 +99,7 @@ SET(VTK_WRAP_PYTHON "@VTK_WRAP_PYTHON@")
SET(VTK_WRAP_TCL "@VTK_WRAP_TCL@")
SET(VTK_LEGACY_REMOVE "@VTK_LEGACY_REMOVE@")
SET(VTK_LEGACY_SILENT "@VTK_LEGACY_SILENT@")
SET(VTK_USE_VOLUMEPRO_1000 "@VTK_USE_VOLUMEPRO_1000@")
# The Hybrid and VolumeRendering kits are now switched with Rendering.
SET(VTK_USE_HYBRID "@VTK_USE_RENDERING@")
......
......@@ -32,6 +32,7 @@ vtkRayCastImageDisplayHelper.cxx
vtkRecursiveSphereDirectionEncoder.cxx
vtkSphericalDirectionEncoder.cxx
vtkVolumeMapper.cxx
vtkVolumeProMapper.cxx
vtkVolumeRayCastCompositeFunction.cxx
vtkVolumeRayCastFunction.cxx
vtkVolumeRayCastIsosurfaceFunction.cxx
......@@ -132,6 +133,32 @@ ELSE (VTK_USE_MANGLED_MESA)
ENDIF (OSMESA_LIBRARY)
ENDIF(VTK_OPENGL_HAS_OSMESA)
ENDIF(VTK_USE_MANGLED_MESA)
INCLUDE(${VTK_SOURCE_DIR}/CMake/FindVLI.cmake)
IF (VLI_LIBRARY_FOR_VP1000 AND VLI_INCLUDE_PATH_FOR_VP1000)
OPTION (VTK_USE_VOLUMEPRO_1000 "Enable support for VolumePro 1000." ON)
ELSE (VLI_LIBRARY_FOR_VP1000 AND VLI_INCLUDE_PATH_FOR_VP1000)
OPTION (VTK_USE_VOLUMEPRO_1000 "Enable support for VolumePro 1000." OFF)
ENDIF (VLI_LIBRARY_FOR_VP1000 AND VLI_INCLUDE_PATH_FOR_VP1000)
IF (VTK_USE_VOLUMEPRO_1000)
SET (Kit_SRCS ${Kit_SRCS}
vtkVolumeProVP1000Mapper.cxx
)
SET (KitOpenGL_SRCS ${KitOpenGL_SRCS}
vtkOpenGLVolumeProVP1000Mapper.cxx
)
INCLUDE_DIRECTORIES (${VLI_INCLUDE_PATH_FOR_VP1000})
SET (KIT_LIBS ${KIT_LIBS} ${VLI_LIBRARY_FOR_VP1000})
ENDIF (VTK_USE_VOLUMEPRO_1000)
MARK_AS_ADVANCED (
VTK_USE_VOLUMEPRO_1000
VLI_LIBRARY_FOR_VP1000
VLI_INCLUDE_PATH_FOR_VP1000
)
SET(Kit_SRCS ${Kit_SRCS} ${KitOpenGL_SRCS})
#-----------------------------------------------------------------------------
......
......@@ -36,7 +36,42 @@ IF (VTK_USE_RENDERING AND VTK_USE_DISPLAY)
-T ${VTK_BINARY_DIR}/Testing/Temporary
-V Baseline/VolumeRendering/cursor3D.png
-A ${VTK_SOURCE_DIR}/Wrapping/Tcl)
IF (VTK_USE_VOLUMEPRO_1000)
ADD_TEST(imageCursor3DVP-image ${VTK_EXECUTABLE}
${VTK_SOURCE_DIR}/Common/Testing/Tcl/rtImageTest.tcl
${VTK_SOURCE_DIR}/VolumeRendering/Testing/Tcl/cursor3DVP.tcl
-D ${VTK_DATA_ROOT}
-T ${VTK_BINARY_DIR}/Testing/Temporary
-V Baseline/VolumeRendering/cursor3D.png
-A ${VTK_SOURCE_DIR}/Wrapping/Tcl)
ENDIF (VTK_USE_VOLUMEPRO_1000)
ENDIF(VTK_USE_TK)
IF (VTK_USE_VOLUMEPRO_1000)
ADD_TEST(gaussianVP-image ${VTK_EXECUTABLE}
${VTK_SOURCE_DIR}/Common/Testing/Tcl/rtImageTest.tcl
${VTK_SOURCE_DIR}/VolumeRendering/Testing/Tcl/gaussianVP.tcl
-D ${VTK_DATA_ROOT}
-V Baseline/VolumeRendering/gaussianVP.png
-A ${VTK_SOURCE_DIR}/Wrapping/Tcl)
ADD_TEST(volVPClipPlanes-image ${VTK_EXECUTABLE}
${VTK_SOURCE_DIR}/Common/Testing/Tcl/rtImageTest.tcl
${VTK_SOURCE_DIR}/VolumeRendering/Testing/Tcl/volVPClipPlanes.tcl
-D ${VTK_DATA_ROOT}
-V Baseline/VolumeRendering/volVPClipPlanes.png
-A ${VTK_SOURCE_DIR}/Wrapping/Tcl)
ADD_TEST(volVPCropRegions-image ${VTK_EXECUTABLE}
${VTK_SOURCE_DIR}/Common/Testing/Tcl/rtImageTest.tcl
${VTK_SOURCE_DIR}/VolumeRendering/Testing/Tcl/volVPCropRegions.tcl
-D ${VTK_DATA_ROOT}
-V Baseline/VolumeRendering/volVPCropRegions.png
-A ${VTK_SOURCE_DIR}/Wrapping/Tcl)
ADD_TEST(volVPGradientOpacity-image ${VTK_EXECUTABLE}
${VTK_SOURCE_DIR}/Common/Testing/Tcl/rtImageTest.tcl
${VTK_SOURCE_DIR}/VolumeRendering/Testing/Tcl/volVPGradientOpacity.tcl
-D ${VTK_DATA_ROOT}
-V Baseline/VolumeRendering/volVPGradientOpacity.png
-A ${VTK_SOURCE_DIR}/Wrapping/Tcl)
ENDIF (VTK_USE_VOLUMEPRO_1000)
#
# If we do not have the data, still run the tests that we can
#
......
# This little example shows how a cursor can be created in
# image viewers, and renderers. The standard TkImageViewerWidget and
# TkRenderWidget bindings are used. There is a new binding:
# middle button in the image viewer sets the position of the cursor.
# First we include the VTK Tcl packages which will make available
# all of the vtk commands to Tcl
package require vtk
package require vtkinteraction
# Global values
set CURSOR_X 20
set CURSOR_Y 20
set CURSOR_Z 20
set IMAGE_MAG_X 4
set IMAGE_MAG_Y 4
set IMAGE_MAG_Z 1
# Pipeline stuff
vtkSLCReader reader
reader SetFileName "$VTK_DATA_ROOT/Data/neghip.slc"
# Cursor stuff
vtkImageMagnify magnify
magnify SetInputConnection [reader GetOutputPort]
magnify SetMagnificationFactors $IMAGE_MAG_X $IMAGE_MAG_Y $IMAGE_MAG_Z
vtkImageCursor3D image_cursor
image_cursor SetInputConnection [magnify GetOutputPort]
image_cursor SetCursorPosition \
[expr $CURSOR_X * $IMAGE_MAG_X] \
[expr $CURSOR_Y * $IMAGE_MAG_Y] \
[expr $CURSOR_Z * $IMAGE_MAG_Z]
image_cursor SetCursorValue 255
image_cursor SetCursorRadius [expr 50 * $IMAGE_MAG_X]
vtkAxes axes
axes SymmetricOn
axes SetOrigin $CURSOR_X $CURSOR_Y $CURSOR_Z
axes SetScaleFactor 50.0
vtkPolyDataMapper axes_mapper
axes_mapper SetInputConnection [axes GetOutputPort]
vtkActor axesActor
axesActor SetMapper axes_mapper
[axesActor GetProperty] SetAmbient 0.5
# Image viewer stuff
vtkImageViewer viewer
viewer SetInputConnection [image_cursor GetOutputPort]
viewer SetZSlice [expr $CURSOR_Z * $IMAGE_MAG_Z]
viewer SetColorWindow 256
viewer SetColorLevel 128
proc viewer_down {viewer} {
viewer_set_z_slice $viewer [expr [$viewer GetZSlice] - 1]
}
proc viewer_up {viewer} {
viewer_set_z_slice $viewer [expr [$viewer GetZSlice] + 1]
}
proc viewer_set_z_slice {viewer z} {
global slice_label
$viewer SetZSlice $z
$slice_label configure -text "slice: $z"
$viewer Render
}
# Create transfer functions for opacity and color
vtkPiecewiseFunction opacity_transfer_function
opacity_transfer_function AddPoint 20 0.0
opacity_transfer_function AddPoint 255 0.2
vtkColorTransferFunction color_transfer_function
color_transfer_function AddRGBPoint 0 0 0 0
color_transfer_function AddRGBPoint 64 1 0 0
color_transfer_function AddRGBPoint 128 0 0 1
color_transfer_function AddRGBPoint 192 0 1 0
color_transfer_function AddRGBPoint 255 0 .2 0
# Create properties, mappers, volume actors, and ray cast function
vtkVolumeProperty volume_property
volume_property SetColor color_transfer_function
volume_property SetScalarOpacity opacity_transfer_function
vtkVolumeProMapper volume_mapper
volume_mapper SetInputConnection [reader GetOutputPort]
volume_mapper SetBlendModeToComposite
volume_mapper IntermixIntersectingGeometryOn
vtkVolume volume
volume SetMapper volume_mapper
volume SetProperty volume_property
# Create outline
vtkOutlineFilter outline
outline SetInputConnection [reader GetOutputPort]
vtkPolyDataMapper outline_mapper
outline_mapper SetInputConnection [outline GetOutputPort]
vtkActor outlineActor
outlineActor SetMapper outline_mapper
eval [outlineActor GetProperty] SetColor 1 1 1
# Create the renderer
vtkRenderer ren1
ren1 AddActor axesActor
ren1 AddVolume volume
ren1 SetBackground 0.1 0.2 0.4
[ren1 GetActiveCamera] ParallelProjectionOn
vtkRenderWindow renWin2
renWin2 AddRenderer ren1
renWin2 SetSize 256 256
# Create the GUI: two renderer widgets and a quit button
wm withdraw .
toplevel .top
# Set the window manager (wm command) so that it registers a
# command to handle the WM_DELETE_WINDOW protocal request. This
# request is triggered when the widget is closed using the standard
# window manager icons or buttons. In this case the exit callback
# will be called and it will free up any objects we created then exit
# the application.
wm protocol .top WM_DELETE_WINDOW ::vtk::cb_exit
# Help label, frame and quit button
set help_label [label .top.help \
-text "MiddleMouse (or shift-LeftMouse) in image viewer to place cursor"]
set display_frame [frame .top.f1]
set quit_button [button .top.btn \
-text Quit \
-command ::vtk::cb_exit]
# Pack the GUI
pack $help_label
pack $display_frame \
-fill both -expand t
pack $quit_button \
-fill x
# Create the viewer widget
set viewer_frame [frame $display_frame.vFm]
pack $viewer_frame \
-padx 3 -pady 3 \
-side left -anchor n \
-fill both -expand f
set viewer_widget [vtkTkImageViewerWidget $viewer_frame.v \
-width 264 \
-height 264 \
-iv viewer]
set viewer_controls [frame $viewer_frame.c]
pack $viewer_widget $viewer_controls \
-side top -anchor n \
-fill both -expand f
set down_button [button $viewer_controls.down \
-text "Down" \
-command [list viewer_down viewer]]
set up_button [button $viewer_controls.up \
-text "Up" \
-command [list viewer_up viewer]]
set slice_label [label $viewer_controls.slice \
-text "slice: [expr $CURSOR_Z * $IMAGE_MAG_Z]"]
pack $down_button $up_button $slice_label \
-side left \
-expand t -fill both
# Create the render widget
set renderer_frame [frame $display_frame.rFm]
pack $renderer_frame \
-padx 3 -pady 3 \
-side left -anchor n \
-fill both -expand t
set render_widget [vtkTkRenderWidget $renderer_frame.r \
-width 264 \
-height 264 \
-rw renWin2]
pack $render_widget \
-side top -anchor n \
-expand t -fill both
# Bindings
::vtk::bind_tk_imageviewer_widget $viewer_widget
$viewer_widget Render
::vtk::bind_tk_render_widget $render_widget
[[[$render_widget GetRenderWindow] GetInteractor] GetInteractorStyle] SetCurrentStyleToTrackballCamera
$render_widget Render
ren1 ResetCamera
# Lets add an extra binding of the middle button in the image viewer
# to set the cursor location
bind $viewer_widget <Button-2> {SetCursorFromViewer %x %y}
bind $viewer_widget <Shift-Button-1> {SetCursorFromViewer %x %y}
# Supporting procedures
proc SetCursorFromViewer {x y} {
global viewer_widget
global IMAGE_MAG_X IMAGE_MAG_Y IMAGE_MAG_Z
# we have to flip y axis because tk uses upper right origin.
set height [lindex [$viewer_widget configure -height] 4]
set y [expr $height - $y]
set z [viewer GetZSlice]
SetCursor [expr $x / $IMAGE_MAG_X] [expr $y / $IMAGE_MAG_Y] \
[expr $z / $IMAGE_MAG_Z]
}
proc SetCursor {x y z} {
global CURSOR_X CURSOR_Y CURSOR_Z IMAGE_MAG_X IMAGE_MAG_Y IMAGE_MAG_Z
set CURSOR_X $x
set CURSOR_Y $y
set CURSOR_Z $z
axes SetOrigin $CURSOR_X $CURSOR_Y $CURSOR_Z
image_cursor SetCursorPosition [expr $CURSOR_X * $IMAGE_MAG_X] \
[expr $CURSOR_Y * $IMAGE_MAG_Y] [expr $CURSOR_Z * $IMAGE_MAG_Z]
viewer Render
renWin2 Render
}
package require vtk
package require vtkinteraction
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
renWin SetSize 300 300
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
vtkCamera camera
camera ParallelProjectionOn
camera SetViewUp 0 1 0
camera SetFocalPoint 12 10.5 15
camera SetPosition -70 15 34
camera ComputeViewPlaneNormal
ren1 SetActiveCamera camera
# Create the reader for the data
#vtkStructuredPointsReader reader
vtkGaussianCubeReader reader
reader SetFileName "$VTK_DATA_ROOT/Data/m4_TotalDensity.cube"
reader SetHBScale 1.1
reader SetBScale 10
reader Update
set range [[[[reader GetGridOutput] GetPointData] GetScalars] GetRange]
set min [lindex $range 0]
set max [lindex $range 1]
vtkImageShiftScale readerSS
readerSS SetInput [reader GetGridOutput]
readerSS SetShift [expr $min * -1]
readerSS SetScale [expr 255 / ($max - $min)]
readerSS SetOutputScalarTypeToUnsignedChar
vtkOutlineFilter bounds
bounds SetInput [reader GetGridOutput]
vtkPolyDataMapper boundsMapper
boundsMapper SetInputConnection [bounds GetOutputPort]
vtkActor boundsActor
boundsActor SetMapper boundsMapper
[boundsActor GetProperty] SetColor 0 0 0
vtkContourFilter contour
contour SetInput [reader GetGridOutput]
eval contour GenerateValues 5 0 .05
vtkPolyDataMapper contourMapper
contourMapper SetInputConnection [contour GetOutputPort]
eval contourMapper SetScalarRange 0 .1
[contourMapper GetLookupTable] SetHueRange 0.32 0
vtkActor contourActor
contourActor SetMapper contourMapper
[contourActor GetProperty] SetOpacity .5
# Create transfer mapping scalar value to opacity
vtkPiecewiseFunction opacityTransferFunction
opacityTransferFunction AddPoint 0 0.01
opacityTransferFunction AddPoint 255 0.35
opacityTransferFunction ClampingOn
# Create transfer mapping scalar value to color
vtkColorTransferFunction colorTransferFunction
colorTransferFunction AddHSVPoint 0.0 0.66 1.0 1.0
colorTransferFunction AddHSVPoint 50.0 0.33 1.0 1.0
colorTransferFunction AddHSVPoint 100.0 0.00 1.0 1.0
# The property describes how the data will look
vtkVolumeProperty volumeProperty
volumeProperty SetColor colorTransferFunction
volumeProperty SetScalarOpacity opacityTransferFunction
volumeProperty SetInterpolationTypeToLinear
vtkVolumeProMapper volumeMapper
volumeMapper SetBlendModeToComposite
volumeMapper SetInputConnection [readerSS GetOutputPort]
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
ren1 AddVolume volume
#ren1 AddActor contourActor
ren1 AddActor boundsActor
######################################################################
vtkSphereSource Sphere
Sphere SetCenter 0 0 0
Sphere SetRadius 1
Sphere SetThetaResolution 16
Sphere SetStartTheta 0
Sphere SetEndTheta 360
Sphere SetPhiResolution 16
Sphere SetStartPhi 0
Sphere SetEndPhi 180
vtkGlyph3D Glyph
Glyph SetInputConnection [reader GetOutputPort]
Glyph SetOrient 1
Glyph SetColorMode 1
#Glyph ScalingOn
Glyph SetScaleMode 2
Glyph SetScaleFactor .6
Glyph SetSource [Sphere GetOutput]
vtkPolyDataMapper AtomsMapper
AtomsMapper SetInputConnection [Glyph GetOutputPort]
AtomsMapper SetImmediateModeRendering 1
AtomsMapper UseLookupTableScalarRangeOff
AtomsMapper SetScalarVisibility 1
AtomsMapper SetScalarModeToDefault
vtkActor Atoms
Atoms SetMapper AtomsMapper
[Atoms GetProperty] SetRepresentationToSurface
[Atoms GetProperty] SetInterpolationToGouraud
[Atoms GetProperty] SetAmbient 0.15
[Atoms GetProperty] SetDiffuse 0.85
[Atoms GetProperty] SetSpecular 0.1
[Atoms GetProperty] SetSpecularPower 100
[Atoms GetProperty] SetSpecularColor 1 1 1
[Atoms GetProperty] SetColor 1 1 1
vtkTubeFilter Tube
Tube SetInputConnection [reader GetOutputPort]
Tube SetNumberOfSides 16
Tube SetCapping 0
Tube SetRadius 0.2
Tube SetVaryRadius 0
Tube SetRadiusFactor 10
vtkPolyDataMapper BondsMapper
BondsMapper SetInputConnection [Tube GetOutputPort]
BondsMapper SetImmediateModeRendering 1
BondsMapper UseLookupTableScalarRangeOff
BondsMapper SetScalarVisibility 1
BondsMapper SetScalarModeToDefault
vtkActor Bonds
Bonds SetMapper BondsMapper
[Bonds GetProperty] SetRepresentationToSurface
[Bonds GetProperty] SetInterpolationToGouraud
[Bonds GetProperty] SetAmbient 0.15
[Bonds GetProperty] SetDiffuse 0.85
[Bonds GetProperty] SetSpecular 0.1
[Bonds GetProperty] SetSpecularPower 100
[Bonds GetProperty] SetSpecularColor 1 1 1
[Bonds GetProperty] SetColor 1 1 1
ren1 AddActor Bonds
ren1 AddActor Atoms
####################################################
ren1 SetBackground 1 1 1
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 .
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
# Create transfer functions for opacity and color
vtkPiecewiseFunction opacityTransferFunction
opacityTransferFunction AddPoint 600 0.0
opacityTransferFunction AddPoint 2000 1.0
vtkColorTransferFunction colorTransferFunction
colorTransferFunction ClampingOff
colorTransferFunction AddHSVPoint 0.0 0.01 1.0 1.0
colorTransferFunction AddHSVPoint 1000.0 0.50 1.0 1.0
colorTransferFunction AddHSVPoint 2000.0 0.99 1.0 1.0
colorTransferFunction SetColorSpaceToHSV
# Create properties, mappers, volume actors, and ray cast function
vtkVolumeProperty volumeProperty
volumeProperty SetColor colorTransferFunction
volumeProperty SetScalarOpacity opacityTransferFunction
volumeProperty SetInterpolationTypeToLinear
vtkVolumeProMapper volumeMapper
volumeMapper SetInputConnection [reader GetOutputPort]
volumeMapper SetBlendModeToMaximumIntensity
volumeMapper CutPlaneOn
volumeMapper SetCutPlaneEquation -1 0 0 57
volumeMapper SetCutPlaneThickness 20