18 python ManipulateFile.py input.dcm output.dcm
21 GDCM 1.2.x would create incorrect Multiframes MR Image Storage file. Try to recover from
22 the issues to recreate a MultiframeGrayscaleByteSecondaryCaptureImageStorage file.
25 python ManipulateFile.py Insight/Testing/Temporary/itkGDCMImageIOTest5-j2k.dcm manipulated.dcm
31 if __name__ ==
"__main__":
37 r.SetFileName( file1 )
42 ano.SetFile( r.GetFile() )
43 ano.RemovePrivateTags()
44 ano.Remove(
gdcm.Tag(0x0032,0x1030) )
67 ano.Replace(
gdcm.Tag(0x0008,0x0018), g.Generate() )
68 ano.Replace(
gdcm.Tag(0x0020,0x00d), g.Generate() )
69 ano.Replace(
gdcm.Tag(0x0020,0x00e), g.Generate() )
70 ano.Replace(
gdcm.Tag(0x0020,0x052), g.Generate() )
73 ano.Remove( gdcm.Tag(0x0018,0x0020) ) # ScanningSequence
74 ano.Remove( gdcm.Tag(0x0018,0x0021) ) # SequenceVariant
75 ano.Remove( gdcm.Tag(0x0018,0x0022) ) # ScanOptions
76 ano.Remove( gdcm.Tag(0x0018,0x0023) ) # MRAcquisitionType
77 ano.Remove( gdcm.Tag(0x0018,0x0050) ) # SliceThickness
78 ano.Remove( gdcm.Tag(0x0018,0x0080) ) # RepetitionTime
79 ano.Remove( gdcm.Tag(0x0018,0x0081) ) # EchoTime
80 ano.Remove( gdcm.Tag(0x0018,0x0088) ) # SpacingBetweenSlices
81 ano.Remove( gdcm.Tag(0x0018,0x0091) ) # EchoTrainLength
82 ano.Remove( gdcm.Tag(0x0018,0x1164) ) # ImagerPixelSpacing
84 ano.Remove( gdcm.Tag(0x0020,0x0032) ) # Image Position (Patient)
85 ano.Remove( gdcm.Tag(0x0020,0x0037) ) # Image Orientation (Patient)
86 ano.Remove( gdcm.Tag(0x0020,0x0052) ) # Frame of Reference UID
87 ano.Remove( gdcm.Tag(0x0020,0x1040) ) # Position Reference Indicator
89 ano.Replace( gdcm.Tag(0x0028,0x0301), "NO" ) # Burned In Annotation
91 ano.Empty( gdcm.Tag(0x0020,0x0020) )
93 ano.Remove( gdcm.Tag(0x7fe0,0x0000) )
95 #ano.Empty( gdcm.Tag(0x0028,0x0009) ) # Frame Increment Pointer
97 #ano.Empty( gdcm.Tag(0x0028,0x1052) ) #<entry group="0028" element="1052" vr="DS" vm="1" name="Rescale Intercept"/>
98 #ano.Empty( gdcm.Tag(0x0028,0x1053) ) #<entry group="0028" element="1053" vr="DS" vm="1" name="Rescale Slope"/>
99 #ano.Replace( gdcm.Tag(0x0028,0x1054), "US" ) #<entry group="0028" element="1054" vr="LO" vm="1" name="Rescale Type"/>
101 ano.Replace( gdcm.Tag(0x2050, 0x0020), "IDENTITY")
105 w.SetFile( ano.GetFile() )
106 w.SetFileName( file2 )