Last active
February 28, 2017 20:21
-
-
Save nbassler/031317b70765d0969d3b7e07a7afd2c8 to your computer and use it in GitHub Desktop.
Make a nice formatted diff on two dicoms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytrip as pt | |
#dcmf = "/local/dicom/pinnacle3-9.9-phantom-imrt" | |
dcmf = "/local/dicom/xio-4.33.02-phantom-chest/" | |
dcm = pt.dicomhelper.read_dicom_folder(dcmf) | |
dcmf2 = "chestdcm" | |
dcm2 = pt.dicomhelper.read_dicom_folder(dcmf2) | |
c1 = dcm['images'] | |
c2 = dcm2['images'] | |
v1 = dcm['rtss'] | |
v2 = dcm2['rtss'] | |
d1 = v1 #c1[0] | |
d2 = v2 #c2[0] | |
clist = [] | |
for item in d1: | |
t1 = item.tag | |
n1 = str(item.name) | |
v1 = str(item.value).strip() | |
t2 = '' | |
n2 = '' | |
v2 = '' | |
if t1 in d2: | |
t2 = d2[t1].tag | |
v2 = str(d2[t1].value).strip() | |
n2 = str(d2[t1].name) | |
clist.append((t1,n1,v1, | |
t2,n2,v2)) | |
for item in d2: | |
t1 = '' | |
n1 = '' | |
v1 = '' | |
t2 = item.tag | |
v2 = str(item.value).strip() | |
n2 = str(item.name) | |
if t2 not in d1: | |
clist.append((t1,n1,v1, | |
t2,n2,v2)) | |
for item in clist: | |
print("{:16}{:30.30}{:80.80}|{:16}{:30.30}{:80.80}".format(str(item[0]),item[1],item[2], | |
str(item[3]),item[4],item[5])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment