[vtkusers] vtk + DICOM (call for Sebastien Barre)

Sebastien BARRE seb-ml-vtk at barre.nom.fr
Wed Feb 28 12:57:40 EST 2001

At 21/02/2001 19:08, Eric Boix wrote:
>     Dear Marcelo (and hopefuly dear Sebastien Barre :-),

Sorry, I was away 10 days, attending to both the SPIE Medical Imaging 
meeting and the San Francisco 4.4 earthquake :)

>   To my knowledge vtkImageReader has a few format specific derived classes
>(vtkBMPReader, vtkTIFFReader, vtkPNMReader) but none of which being
>related to Dicom formats. Nevetheless vtkImageReader has all the required
>parameters that enables this class to read Dicom Images. BUT in order
>to use it, it will require some extra (outside of vtk) knowledge of
>the fairly complicated Dicom format....

Exactly. The fact is that vtkImageReader might do fine to read DICOM files 
directly, *provided* that  :
         - you know the structure of the image (size, bit depth),
         - the pixel data is at the end of the DICOM file. The DICOM 
protocol does not guarantee that DICOM files should end with the pixel 
data, but it's the case most of the time.

Hence, you need the structure of the image, which is easy to get with tools 
like mine (dicom2, see TEXT conversion in the ), or dicom3tools, etc :

>More precisely you will need to be able to explore the Dicom header
>file by other means :
>   like CTN see http://www.erl.wustl.edu/DICOM/ctn.html
>   or dcmtk see
>   http://www.offis.uni-oldenburg.de/projekte/dicom/soft-docs/soft01_e.html)
>Then plug the results (like the size of image, how it is represented,
>the size of the header that needs to be skipped when you have multiple
>images in one file....) into vtkImageReader.

You get it right Eric.

>    I would be delighted to hear Sebastien Barre's point of view on this
>specialised subject since he has a deep understanding of BOTH vtk and
>Dicom :
>  * see http://www.barre.nom.fr/vtk/links.html for his VTK link page.
>  * see http://www.barre.nom.fr/medical/dicom2/index.html for his
>    free dicom2 utility toolkit.

Your summary is accurate. Either use the vtkImageReader directly using 
information extracted from your one of your DICOM file :
         http://www.barre.nom.fr/medical/dicom2/how-to.html#List DICOM tags

or convert all your dicom files to the RAW format for a safer result :

>    [ Alas his dicom2 toolkit is not opensource (Sebastien, please flame me if
>      I'm wrong on this point). Hence, since sources are not available,
>      it will be of no help to you for exploring the Dicom headers. You 
> won't be
>      able to wrap in it Python or Tcl and then call vtkImageReader with the
>      results obtained... I once failed poorly in using Swig on Dcmtk header
>      files (heavy duty C++). ]

Sorry, it is free, but not open source for the moment (I'm just not 
satisfied by the current code). I'll soon or later write a new version, 
that will be wrapped for Tcl, Python, etc. For the moment, you can try to 
call "dicom2" from Python or Tcl and parse the text output by the -t1 option :)

Hope this helps.

More information about the vtkusers mailing list