[vtkusers] help with reading dicom files as a volume and rendering it in vtk

ankit.master at gmail.com ankit.master at gmail.com
Tue Nov 30 16:06:10 EST 2010


Hello ,

Kindly pardon my question here. I know this has been asked several times in
the past and yet ask it again. I am trying to read dicom files and view it
interactively using windowInteractor. My ulitmate goal is to be able to pump
this image through the volume rendering algorithm.

However, when I run the following script (python script), I only get to see
one slice as opposed to the entire volume. Could
someone please help me trouble shoot this.


#! /usr/bin/env python

import vtk as v
from vtk.libvtkGraphicsPython import*
from vtk.libvtkCommonPython import*

reader=v.vtkDICOMImageReader()
reader.SetDirectoryName('$DICOM DIR')
reader.Update()

slope=1
shift=0

shifter=v.vtkImageShiftScale()
shifter.SetShift(shift)
shifter.SetScale(slope)
shifter.SetOutputScalarTypeToUnsignedChar()
shifter.SetInput(reader.GetOutput())
shifter.Update()

voxeldata=v.vtkImageData()
voxeldata=shifter.GetOutput()
voxeldata.AllocateScalars()


actor=v.vtkImageActor()
actor.SetInput(voxeldata)

ren=v.vtkRenderer()
renWin = v.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.SetSize(300,300)

iren = v.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren.AddActor(actor)
iren.Initialize()
iren.Start()

Thank you
Sincerely,
Ankit 
-- 
View this message in context: http://vtk.1045678.n5.nabble.com/help-with-reading-dicom-files-as-a-volume-and-rendering-it-in-vtk-tp3286769p3286769.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list