@@ -55,15 +55,15 @@ def handler(environ):
55
55
def index (environ ):
56
56
patients = {}
57
57
for s in dft .get_studies (base_dir ):
58
- patients .setdefault (s .patient_name , []).append (s )
58
+ patients .setdefault (s .patient_name_or_uid () , []).append (s )
59
59
output = ''
60
60
output += '<html><head><title>data</title></head>\n '
61
61
output += '<body>\n '
62
62
output += 'Home\n '
63
63
output += '<br />\n '
64
64
output += '<br />\n '
65
65
for p in sorted (patients ):
66
- output += 'Patient name : <a href="%s/">%s</a>\n ' % (urllib .quote (p .encode ('utf-8' )), html_unicode (p ))
66
+ output += 'Patient: <a href="%s/">%s</a>\n ' % (urllib .quote (p .encode ('utf-8' )), html_unicode (p ))
67
67
output += '<br />\n '
68
68
if len (patients [p ]) == 1 :
69
69
output += '1 study\n '
@@ -89,14 +89,14 @@ def html_unicode(u):
89
89
return cgi .escape (u .encode ('utf-8' ))
90
90
91
91
def patient (patient ):
92
- studies = [ s for s in dft .get_studies () if s .patient_name == patient ]
92
+ studies = [ s for s in dft .get_studies () if s .patient_name_or_uid () == patient ]
93
93
if len (studies ) == 0 :
94
94
raise HandlerError ('404 Not Found' , 'patient %s not found\n ' % patient )
95
95
studies .sort (study_cmp )
96
96
output = ''
97
97
output += '<html><head><title>data</title></head>\n '
98
98
output += '<body>\n '
99
- output += '<a href="../">Home</a> -> Patient %s\n ' % html_unicode (studies [0 ].patient_name )
99
+ output += '<a href="../">Home</a> -> Patient %s\n ' % html_unicode (studies [0 ].patient_name_or_uid () )
100
100
output += '<br />\n '
101
101
output += '<br />\n '
102
102
output += 'Patient name: %s\n ' % html_unicode (studies [0 ].patient_name )
@@ -123,7 +123,7 @@ def patient(patient):
123
123
def patient_date_time (patient , date_time ):
124
124
study = None
125
125
for s in dft .get_studies ():
126
- if s .patient_name != patient :
126
+ if s .patient_name_or_uid () != patient :
127
127
continue
128
128
if date_time != '%s_%s' % (s .date , s .time ):
129
129
continue
@@ -134,10 +134,10 @@ def patient_date_time(patient, date_time):
134
134
output = ''
135
135
output += '<html><head><title>data</title></head>\n '
136
136
output += '<body>\n '
137
- output += '<a href="../../">Home</a> -> <a href="../../%s/">Patient %s</a> -> Study %s %s\n ' % (urllib .quote (study .patient_name ) , html_unicode (study .patient_name ), html_unicode (study .date ), html_unicode (study .time ))
137
+ output += '<a href="../../">Home</a> -> <a href="../../%s/">Patient %s</a> -> Study %s %s\n ' % (urllib .quote (study .patient_name_or_uid ()) , html_unicode (study .patient_name_or_uid () ), html_unicode (study .date ), html_unicode (study .time ))
138
138
output += '<br />\n '
139
139
output += '<br />\n '
140
- output += 'Patient name: <a href="/../%s/">%s</a>\n ' % (urllib .quote (study .patient_name ), html_unicode (study .patient_name ))
140
+ output += 'Patient name: <a href="/../%s/">%s</a>\n ' % (urllib .quote (study .patient_name_or_uid () ), html_unicode (study .patient_name ))
141
141
output += '<br />\n '
142
142
output += 'Study UID: %s\n ' % html_unicode (study .uid )
143
143
output += '<br />\n '
@@ -167,7 +167,7 @@ def patient_date_time(patient, date_time):
167
167
def nifti (patient , date_time , scan ):
168
168
study = None
169
169
for s in dft .get_studies ():
170
- if s .patient_name != patient :
170
+ if s .patient_name_or_uid () != patient :
171
171
continue
172
172
if date_time != '%s_%s' % (s .date , s .time ):
173
173
continue
@@ -188,7 +188,7 @@ def nifti(patient, date_time, scan):
188
188
def png (patient , date_time , scan ):
189
189
study = None
190
190
for s in dft .get_studies ():
191
- if s .patient_name != patient :
191
+ if s .patient_name_or_uid () != patient :
192
192
continue
193
193
if date_time != '%s_%s' % (s .date , s .time ):
194
194
continue
@@ -209,7 +209,6 @@ def png(patient, date_time, scan):
209
209
210
210
if __name__ == '__main__' :
211
211
import wsgiref .simple_server
212
- server_prefix = ''
213
212
httpd = wsgiref .simple_server .make_server ('' , 8080 , application )
214
213
httpd .serve_forever ()
215
214
0 commit comments