[ITK] [ITK-users] Access DICOM private tags using SimpleITK

Lowekamp, Bradley (NIH/NLM/LHC) [C] blowekamp at mail.nih.gov
Fri May 27 16:08:31 EDT 2016


Hi,

Sorry that didn’t work. I was able to get some dicom data with private tags. I have updated the patch with more commits in the topic:

http://review.source.kitware.com/#/q/status:open+project:SimpleITK+branch:master+topic:AddLoadPrivateTagsOptions

Now that I have tested it with data, I have merged it into the “next” branch.

What are these “error reports” with any command?

Brad


> On May 27, 2016, at 11:29 AM, Mathew Guilfoyle <mrguilfoyle at gmail.com> wrote:
> 
> Dear Brad
> 
> Thanks for the patch - I have successfully recompiled and the private tag functions are exposed in the R wrapping to SimpleITK.  For instance I can do the following:
> 
> reader = ImageFileReader()
> reader$LoadPrivateTagsOn()
> 
> or reader$SetLoadPrivateTags(TRUE)
> 
> However, neither of the above seem to have an effect i.e. a call to reader$GetLoadPrivateTags() returns FALSE after both of the above and the summary of my reader object has the 'loadPrivateTag' attribute at 0 irrespective.  If I execute the reader I get an image with only the 107 public tags I had before.  There are now errors reports with any of the commands.
> 
> Any ideas on how to get this working?
> 
> Cheers
> Mathew
> 
>> On 24 May 2016, at 14:44, Lowekamp, Bradley (NIH/NLM/LHC) [C] <blowekamp at mail.nih.gov> wrote:
>> 
>> Hello,
>> 
>> Please find a patch here in Gerrit [1], which adds the option to load these private data tags. You should be able to download and compile to get the feature. Also note that itk::GDCMImageIO loads the private tags and encodes the with Base64 into strings [2]. I am working on finding some test data to verify behavior and write some tests and documentation.
>> 
>> HTH,
>> Brad
>> 
>> [1] http://review.source.kitware.com/#/c/21160/
>> [2] https://github.com/InsightSoftwareConsortium/ITK/blob/bf3f02c6b75a26da3987afc296af140259215e85/Modules/IO/GDCM/src/itkGDCMImageIO.cxx#L567-L587
>> 
>>> On May 23, 2016, at 3:59 PM, Mathew Guilfoyle <mrguilfoyle at gmail.com> wrote:
>>> 
>>> Thanks Brad - the trouble I'm having is that some of the keys are private/hidden.  
>>> 
>>> For instance, in my images when I use the image.GetMetaDataKeys() method it returns a list of 107 keys but the one I need is a private manufacturer-specific timing tag that is not part of the standard meta-data dictionary.  I know the tag I need because OsiriX viewer shows all the standard and private tags and it is in there with associated data.  However, if I run image.HasMetaDataKey(my_private_key) it returns FALSE.  
>>> 
>>> Reading various sources, including the ITK docs, it seems GDCM library has a setting that needs to be turned on to read private DICOM tags.  However, the only reference I can see to this setting in SimpleITK is as an argument to the GetGDCMSeriesFileNames method and I'm not clear what function it serves there as the list of files is the same irrespective.  What I need somehow is to tell ReadImage or ImageSeriesReader to parse the private tags...??
>>> 
>>> Thanks
>>> Mat
>>> 
>>>> On 23 May 2016, at 20:47, Lowekamp, Bradley (NIH/NLM/LHC) [C] <blowekamp at mail.nih.gov> wrote:
>>>> 
>>>> 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
>>>> 
>>> 
>> 
> 

_____________________________________
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 Community mailing list