[vtk-developers] Exporting a DICOM image into BMP with respect to window, level, etc.

tom fogal tfogal at sci.utah.edu
Tue Feb 1 12:09:45 EST 2011


iono sphere wrote:
> I am looking for a procedure to extract DICOM image from all DICOM files in
> a directory into a more common image format. (BMP, etc.) I have tried
> another program called "DICOM2", but when it extracted the images out, it
> didn't apply window, level, and other DICOM processing to the image,
> resulting in original image. This isn't what I want. In GDCM, I have
> successfully acquired the window and level values, but if I am to use VTK
> and GDCM to extract DICOM image from all DICOM files in a directory, what
> are some of the functions I should be looking for?

I don't know about doing this through code, but I had to do this 
semi-recently.  I used `dcmp2pgm', which I think comes from the OFFIS 
DICOM toolkit ("dcmtk" in my package manager), as well as GraphicsMagick.

I attached a python script I used to convert all DICOMs to PNGs.  It 
will not work out of the box for you, but it is short && should be easy 
to modify.

Moving from there: "dcmdump +P <field>" (or +L?  Both?  I forget) will 
let you pull out an arbitrary DICOM field.  I used this, GraphicsMagick 
again, some scripting, and a little bit of duct tape to create time 
series && annotate each frame with the current time.

HTH,

-tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gen-png.py
Type: text/x-python
Size: 953 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20110201/8b8092a6/attachment-0001.py>


More information about the vtk-developers mailing list