20 """ An example script showing how to modify the tags of a DICOM image with SimpleITK. """
24 import SimpleITK
as sitk
27 print(
"Usage: python " + __file__ +
" <input_image> <output_image>")
47 all_keys = image.GetMetaDataKeys()
49 mean_image.SetMetaData(key, image.GetMetaData(key))
50 mean_image.SetMetaData(
"0008|0008",
"DERIVED\\SECONDARY")
51 modification_time = time.strftime(
"%H%M%S")
52 modification_date = time.strftime(
"%Y%m%d")
53 mean_image.SetMetaData(
"0008|0031", modification_time)
54 mean_image.SetMetaData(
"0008|0021", modification_date)
66 modified_image.GetMetaData(
"0008|0008").replace(
" ",
"") !=
"DERIVED\\SECONDARY"
67 or modified_image.GetMetaData(
"0008|0031") != modification_time
68 or modified_image.GetMetaData(
"0008|0021") != modification_date