[vtkusers] vtkImageReslice and scaling through vtkTransform.

Dean Inglis dean.inglis at camris.ca
Tue Aug 15 10:52:11 EDT 2006


Hi Anna,

add
  slicer->AutoCropOutputOn();

see small tcl script below.

regards,
Dean

package require vtk

vtkDICOMImageReader readerG
#
# insert your dcm file here
#
readerG SetFileName
"c://Builder//Developer//Tcl//2.16.124.113531.4.5.1098803017.28707.dcm"
readerG Update

# Center the image so that our scaling is uniform.
vtkImageChangeInformation imageChangeInformation
imageChangeInformation SetInput [ readerG GetOutput ]
imageChangeInformation CenterImageOn

# Scale the image to double the size
vtkTransform transform
transform Identity
#transform Scale 0.5 0.5 0.5
#transform Scale 2 2 2

# VTK reslicer
vtkImageReslice  slicer
slicer SetResliceTransform transform
slicer AutoCropOutputOn

# VTK resampler : comment out the previous 3 lines and uncomment
# the next 3 lines to see that the two are equivalent

#vtkImageResample  slicer
#slicer SetAxisMagnificationFactor 0 0.5
#slicer SetAxisMagnificationFactor 1 0.5

slicer SetInput [ imageChangeInformation GetOutput ]
slicer SetOutputDimensionality  2
slicer InterpolateOn
slicer SetInterpolationModeToCubic

vtkImageViewer2  view
view SetInput [ slicer GetOutput ]

vtkOutlineFilter outline
outline SetInput [ slicer GetOutput ]

vtkPolyDataMapper mapper
mapper SetInput [ outline GetOutput ]
mapper SetResolveCoincidentTopologyToPolygonOffset

vtkActor outlineA
outlineA SetMapper mapper

[ outlineA GetProperty ] SetColor 1 0 0

vtkRenderWindowInteractor viewInt
[ view GetRenderer ] SetBackground .5 .7 .8
[ view GetRenderer ] AddViewProp outlineA

view SetupInteractor viewInt
view Render






More information about the vtkusers mailing list