20 """ A SimpleITK example demonstrating how to print a DICOM image's tags. """
23 import SimpleITK
as sitk
26 """ A SimpleITK script that prints a DICOM image's tags. """
28 print(
"Usage: DicomImagePrintTags <input_file>")
33 reader.SetFileName(args[1])
34 reader.LoadPrivateTagsOn()
36 reader.ReadImageInformation()
38 for k
in reader.GetMetaDataKeys():
39 v = reader.GetMetaData(k)
40 print(f
'({k}) = = "{v}"')
42 print(f
"Image Size: {reader.GetSize()}")
43 print(f
"Image PixelType: {sitk.GetPixelIDValueAsString(reader.GetPixelID())}")
46 if __name__ ==
"__main__":