comparison Plugins/DicomWeb/Run.py @ 321:3c8c6b41eec4

dealing with Content-Location in test_frames_transcoding of DICOMweb
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 Jul 2020 10:33:53 +0200
parents de6e73e4df60
children b7c2fb8e1b57
comparison
equal deleted inserted replaced
320:1f81f1d7d746 321:3c8c6b41eec4
1164 '1.2.840.10008.1.2.4.51' : 'multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.51', 1164 '1.2.840.10008.1.2.4.51' : 'multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.51',
1165 '1.2.840.10008.1.2.4.57' : 'multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.57', 1165 '1.2.840.10008.1.2.4.57' : 'multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.57',
1166 '1.2.840.10008.1.2.4.70' : 'multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.70', 1166 '1.2.840.10008.1.2.4.70' : 'multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.70',
1167 } 1167 }
1168 1168
1169 uri = '/dicom-web%s' % UploadAndGetWadoPath('TransferSyntaxes/1.2.840.10008.1.2.4.50.dcm') 1169 uri = 'dicom-web%s' % UploadAndGetWadoPath('TransferSyntaxes/1.2.840.10008.1.2.4.50.dcm')
1170 truth = Image.open(GetDatabasePath('TransferSyntaxes/1.2.840.10008.1.2.4.50.png')) 1170 truth = Image.open(GetDatabasePath('TransferSyntaxes/1.2.840.10008.1.2.4.50.png'))
1171 1171
1172 a = DoGetMultipart(ORTHANC, '%s/frames/1' % uri, 1172 a = DoGetMultipart(ORTHANC, '%s/frames/1' % uri,
1173 headers = { 'Accept' : ACCEPT['1.2.840.10008.1.2.4.50'] }, 1173 headers = { 'Accept' : ACCEPT['1.2.840.10008.1.2.4.50'] },
1174 returnHeaders = True) 1174 returnHeaders = True)
1175 self.assertEqual(1, len(a)) 1175 self.assertEqual(1, len(a))
1176 self.assertEqual(2, len(a[0])) 1176 self.assertEqual(2, len(a[0]))
1177 self.assertEqual('http://localhost:8042%s/frames/1' % uri, 1177 self.assertEqual('%s%s/frames/1' % (ORTHANC['Url'], uri),
1178 a[0][1]['Content-Location']) 1178 a[0][1]['Content-Location'])
1179 self.assertEqual(ACCEPT['1.2.840.10008.1.2.4.50'], 1179 self.assertEqual(ACCEPT['1.2.840.10008.1.2.4.50'],
1180 'multipart/related; type=%s' % a[0][1]['Content-Type']) 1180 'multipart/related; type=%s' % a[0][1]['Content-Type'])
1181 self.assertEqual(53476, len(a[0][0])) 1181 self.assertEqual(53476, len(a[0][0]))
1182 self.assertEqual('142fdb8a1dc2aa7e6b8952aa294a6e22', ComputeMD5(a[0][0])) 1182 self.assertEqual('142fdb8a1dc2aa7e6b8952aa294a6e22', ComputeMD5(a[0][0]))
1232 headers = { 'Accept' : ACCEPT2[syntax] }) 1232 headers = { 'Accept' : ACCEPT2[syntax] })
1233 self.assertEqual(1, len(a)) 1233 self.assertEqual(1, len(a))
1234 self.assertEqual(RESULTS[syntax], ComputeMD5(a[0])) 1234 self.assertEqual(RESULTS[syntax], ComputeMD5(a[0]))
1235 1235
1236 # Test transcoding to all the possible transfer syntaxes 1236 # Test transcoding to all the possible transfer syntaxes
1237 uri = '/dicom-web%s' % UploadAndGetWadoPath('KarstenHilbertRF.dcm') 1237 uri = 'dicom-web%s' % UploadAndGetWadoPath('KarstenHilbertRF.dcm')
1238 for syntax in ACCEPT2: 1238 for syntax in ACCEPT2:
1239 a = DoGetMultipart(ORTHANC, '%s/frames/1' % uri, 1239 a = DoGetMultipart(ORTHANC, '%s/frames/1' % uri,
1240 headers = { 'Accept' : ACCEPT2[syntax] }, 1240 headers = { 'Accept' : ACCEPT2[syntax] },
1241 returnHeaders = True) 1241 returnHeaders = True)
1242 self.assertEqual(1, len(a)) 1242 self.assertEqual(1, len(a))
1243 self.assertEqual(2, len(a[0])) 1243 self.assertEqual(2, len(a[0]))
1244 self.assertEqual('http://localhost:8042%s/frames/1' % uri, 1244 self.assertEqual('%s%s/frames/1' % (ORTHANC['Url'], uri),
1245 a[0][1]['Content-Location']) 1245 a[0][1]['Content-Location'])
1246 self.assertEqual(ACCEPT[syntax], 1246 self.assertEqual(ACCEPT[syntax],
1247 'multipart/related; type=%s' % a[0][1]['Content-Type']) 1247 'multipart/related; type=%s' % a[0][1]['Content-Type'])
1248 if IS_GDCM: 1248 if IS_GDCM:
1249 self.assertEqual({ 1249 self.assertEqual({