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

Jothy jothybasu at gmail.com
Wed Dec 1 03:39:32 EST 2010


You are not using the correct mapper and I think your pipeline is also wrong
(correct me if I am wrong).

Have a look at the example at this link
http://www.cmake.org/Wiki/VTK/Examples/Cxx/VolumeRendering/MinIntensityRendering

Jothy

On Tue, Nov 30, 2010 at 9:06 PM, ankit.master at gmail.com <
ankit.master at gmail.com> wrote:

>
> 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.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101201/7f5db61e/attachment.htm>


More information about the vtkusers mailing list