[ITK-users] Access DICOM private tags using SimpleITK

Lowekamp, Bradley (NIH/NLM/LHC) [C] blowekamp at mail.nih.gov
Mon May 23 15:47:28 EDT 2016


Hello,

To get all the tags from the dicom files you need to load them individually. Something along these lines, but iterating over the list generated by GetGDCMSeriesFileNames:

from __future__ import print_function

import SimpleITK as sitk
import sys, os

if len ( sys.argv ) < 2:
    print( "Usage: DicomImagePrintTags <input_file>" )
    sys.exit ( 1 )

inputImage = sitk.ReadImage( sys.argv[1] )

for k in inputImage.GetMetaDataKeys():
    v = inputImage.GetMetaData(k)
    print("({0}) = = \"{2}\"".format(k,v))


HTH,
Brad



> On May 23, 2016, at 3:31 PM, Mathew Guilfoyle <mrguilfoyle at gmail.com> wrote:
> 
> In ITK the GDCMSeriesFileNames class (equivalently the ImageSeriesReader$GetGDCMSeriesFileNames method from Simple ITK) can both take arguments to read private DICOM tags (typically manufacturer specific info that does not follow the general standard.)
> 
> I cannot figure out how to use this function to actually read in a series of images or a volume with the hidden tags (I know they are there as I can see them in Osirix!)
> 
> The list of filenames that the two methods above return as no different whether the 'loadPrivateTags'  attribute is set on or off.
> 
> Any ideas how I can access the private tags?
> 
> Cheers
> _____________________________________
> 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.php
> 
> 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://public.kitware.com/mailman/listinfo/insight-users



More information about the Insight-users mailing list