SimpleITK can not obtain the 0020|000D DICOM tag

I want to use SimpleITK to obtain the tag information, and the code is:


    reader = sitk.ImageFileReader()
    reader.SetFileName(fileName)
    reader.LoadPrivateTagsOn()
    reader.ReadImageInformation()
    if reader.HasMetaDataKey('0020|000D'):
        val = reader.GetMetaData(tag)
        Val[tag] = val
    else:
        Val[tag] = ''

and it return ‘’, which means the SimpleITK can not obtain the ‘0020|000D’ tag. However, I use radiant to open the dicom, and it can give the ‘0020|000D’ tag:

Is there any wrong with my SimpleITK code ?

Hello @zhang-qiang-github,

Minor issue with your code, uppercase, D, in tag instead of lowercase, d. Use ‘0020|000d’ to get the tag value.

2 Likes

@zivy Thank you very much ~~~

1 Like