/usr/lib/python2.7/dist-packages/dicom/examples/DicomDiff.py is in python-dicom 0.9.9-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | # DicomDiff.py
"""Show the difference between two dicom files.
"""
# Copyright (c) 2008-2012 Darcy Mason
# This file is part of pydicom, relased under an MIT license.
# See the file license.txt included with this distribution, also
# available at http://pydicom.googlecode.com
from __future__ import print_function
usage = """
Usage:
python DicomDiff.py file1 file2
Results printed in python difflib form - indicated by start of each line:
' ' blank means lines the same
'-' means in file1 but "removed" in file2
'+' means not in file1, but "added" in file2
('?' lines from difflib removed - no use here)
"""
import sys
import dicom
import difflib
# only used as a script
if len(sys.argv) != 3:
print(usage)
sys.exit()
datasets = (dicom.read_file(sys.argv[1], force=True),
dicom.read_file(sys.argv[2], force=True))
# diflib compare functions require a list of lines, each terminated with newline character
# massage the string representation of each dicom dataset into this form:
rep = []
for dataset in datasets:
lines = str(dataset).split("\n")
lines = [line + "\n" for line in lines] # add the newline to end
rep.append(lines)
diff = difflib.Differ()
for line in diff.compare(rep[0], rep[1]):
if line[0] != "?":
print(line)
|