[Insight-users] wrap_itk, python, and dicom

Mario Ceresa mrceresa at gmail.com
Mon Apr 26 05:55:53 EDT 2010


Hello David,

Which kind of information do you need to extract from the dicom header?

Basic info such as the dimensions or spacing are already available in
the getter methods of the image object (ex. image.GetSpacing() ).

To access the full dictionary my first thought was something like:

------------------------------------------------
import itk

reader = itk.ImageFileReader.ISS3.New(FileName='test_image.dcm')
reader.Update()

metad = reader.GetMetaDataDictionary()

print "List of all the key in the dictionary:"
print [str(key) for key in metad.GetKeys()]

print "Print the dictionary"
metad.Print(itk.cout)
------------------------------------------------

I can see the list of all the keys, but instead of printing their
value, the last method only shows:

[UNKNOWN_PRINT_CHARACTERISTICS]

Then I realized that gdcm comes with python binding itself. It might
be easier to read the dicom tag using directly those bindings.

Hope this helps,

Mario


On 22 April 2010 18:15, David Fuentes <fuentesdt at gmail.com> wrote:
>
> Hello,
>
> Is there an example python script showing how to extract header information
> from a dicom file using the wrapper functions ?
>
>
> thank you,
> David
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list