[vtkusers] vtkDICOMImageReader results,..

Mathieu Malaterre mathieu.malaterre at gmail.com
Fri Jul 27 09:22:11 EDT 2007

On 7/27/07, Miguel Angel Rodriguez Florido <marf at itccanarias.org> wrote:
>         Dear friends,
>         Today is the first time that I have used the vtkDICOMReader, however
> the results are not apparently good.
>         First I have used the vtkDICOMImageReader directly:
> vtkDICOMImageReader v16
>     v16 SetDirectoryName <path to data>
>         In this directory I have files following the pattern: DCT00*.dcm, but I
> got the result that you can see in the attached figure. I'm using
> vtkImagePlaneWidget and I can see data in 3D but with the same aspect,
> while the greyscale values seem good if I check it with a picker on the
> image.
>         First, I thought that vtkDicomReader is not getting well the image
> parameters, although the grayscale values and dimensions were apparently
> well. So, I force the parameters:
>     v16 SetDataSpacing 0.206 0.206 0.206
>     v16 SetDataOrigin 0 0 0.206
>     v16 SetDataExtent 0 608 0 608 0 320
>     v16 SetDataScalarTypeToShort
>     v16 SetDataByteOrderToLittleEndian
> but I'm getting the same bad result.
>         I don't have previous experience with the DicomReader. I can read and
> see it well under ITKReader, but not under VTK. I've tried to read
> different dicom datasets, and read the documentation but I got the same
> result.
>         Do I do something wrong?.
>         Is there any detail that I've to take in account?.
>         In general, any idea?.
>         Thank you very much in advance.

Hi Miguel,

  Thanks for sending me a copy of the image. Using vtkDICOMImageReader
from VTK CVS I can read the image perfectly.

>>> import vtk
>>> r = vtk.vtkDICOMImageReader()
>>> r.SetFileName('DCT0045.dcm')
>>> r.Update()
>>> r.GetOutput().GetScalarRange()
(-1023.0, 3072.0)
>>> w = vtk.vtkXMLImageDataWriter()
>>> w.SetFileName('/tmp/DCT0045.vti')
>>> w.SetInput(r.GetOutput())
>>> w.Write()

I can load the image fine paraview.

You should either use a more recent VTK version. Or switch to using
GDCM (same DICOM lib as ITK).


More information about the vtkusers mailing list