comparison Tests/Toolbox.py @ 249:24e5c8ca9440 Orthanc-1.5.7

DICOMweb: test_rendered
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Jun 2019 15:35:41 +0200
parents 8980bd19e31d
children 943166deebcb
comparison
equal deleted inserted replaced
248:26c3a1ed935a 249:24e5c8ca9440
195 def ComputeMD5(data): 195 def ComputeMD5(data):
196 m = hashlib.md5() 196 m = hashlib.md5()
197 m.update(data) 197 m.update(data)
198 return m.hexdigest() 198 return m.hexdigest()
199 199
200 def UncompressImage(data):
201 if (sys.version_info >= (3, 0)):
202 return Image.open(BytesIO(data))
203 else:
204 return Image.open(StringIO(data))
205
200 def GetImage(orthanc, uri, headers = {}): 206 def GetImage(orthanc, uri, headers = {}):
201 # http://www.pythonware.com/library/pil/handbook/introduction.htm 207 # http://www.pythonware.com/library/pil/handbook/introduction.htm
202 data = DoGet(orthanc, uri, headers = headers) 208 return UncompressImage(DoGet(orthanc, uri, headers = headers))
203 if (sys.version_info >= (3, 0)):
204 return Image.open(BytesIO(data))
205 else:
206 return Image.open(StringIO(data))
207 209
208 def GetArchive(orthanc, uri): 210 def GetArchive(orthanc, uri):
209 # http://stackoverflow.com/a/1313868/881731 211 # http://stackoverflow.com/a/1313868/881731
210 s = DoGet(orthanc, uri) 212 s = DoGet(orthanc, uri)
211 213