[vtkusers] 16 bit MIP rendering
Hugo Gratama van Andel
h.a.gratamavanandel at amc.uva.nl
Mon Mar 27 08:10:09 EST 2006
Hello Everybody,
I would like to create 16 bit MIP images of my CT-datasets. I use a
script as shown below with a vtkVolumeRayCastMIPFunction. If I capture
my images with vtkWindowToImageFilter I will end up with 8-bit images
(or 24-bit RGB). What should I do to create 16-bit MIP images (native,
so without any upcasting). Should I set an option in
vtkVolume(Property), or in vtkColorTransferFunction or some where else?
Or is is it just impossible?
with regards,
Hugo Gratama van Andel
--------begin MIP tcl-script------
package require vtkinteraction
# Create the renderer, the render window, and the interactor. The
# renderer draws into the render window, the interactor enables mouse-
# and keyboard-based interaction with the scene.
vtkRenderer aRenderer
vtkRenderWindow renWin
renWin AddRenderer aRenderer
vtkRenderWindowInteractor iren
vtkInteractorStyleTrackballCamera aTrackBallCamera
iren SetInteractorStyle aTrackBallCamera
iren SetRenderWindow renWin
vtkImageReader reader
reader SetDataByteOrderToLittleEndian
reader SetDataScalarTypeToUnsignedShort
reader SetDataExtent 0 511 0 511 0 373
reader SetDataSpacing 0.29 0.29 0.5
reader SetFileDimensionality 3
reader SetFileName "C:/temp/patient.raw"
# Adding the volume renderer (ray caster)
vtkPiecewiseFunction opacityTransferFunction
opacityTransferFunction AddPoint 1100 0
opacityTransferFunction AddPoint 1500 1.0
vtkColorTransferFunction colorTransferFunction
colorTransferFunction AddRGBPoint 0.0 0.0 0.0 0.0
colorTransferFunction AddRGBPoint 255.0 1.0 1.0 1.0
vtkVolumeProperty volumeProperty
volumeProperty SetColor colorTransferFunction
volumeProperty SetScalarOpacity opacityTransferFunction
vtkVolumeRayCastMIPFunction MIP
vtkVolumeRayCastMapper volumeMapper
volumeMapper SetVolumeRayCastFunction MIP
volumeMapper SetInputConnection [reader GetOutputPort]
vtkVolume volume
volume SetMapper volumeMapper
volume SetProperty volumeProperty
volume VisibilityOn
volume Update
# Bounding box.
vtkOutlineFilter outlineData
outlineData SetInputConnection [reader GetOutputPort]
vtkPolyDataMapper mapOutline
mapOutline SetInputConnection [outlineData GetOutputPort]
vtkActor outline
outline SetMapper mapOutline
[outline GetProperty] SetColor 0 1 0
# Actors are added to the renderer.
aRenderer AddActor outline
aRenderer AddVolume volume
vtkCamera aCamera
aRenderer SetActiveCamera aCamera
# Setting the color and size of the renderwindow,
#initializing the camera position
aCamera SetViewUp 0 0 -1
aCamera SetPosition -2 -2 -2
aCamera SetFocalPoint 0 0 0
aCamera ComputeViewPlaneNormal
aRenderer ResetCamera
aRenderer ResetCameraClippingRange
aRenderer SetBackground 0.2 0.2 0.2
renWin SetSize 640 480
# Set up a callback (using command/observer) to bring up the Tcl
# command GUI when the keypress-u (UserEvent) key is pressed.
iren AddObserver UserEvent {wm deiconify .vtkInteract}
# Here we go!
iren Initialize
#renWin Render
#iren Start
wm withdraw .
----------end mip TCl script-----------
More information about the vtkusers
mailing list