comparison Plugins/DicomWeb/Run.py @ 318:bac7cc80f240

dicomweb: test_wado_transcoding
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 22 Jun 2020 16:15:31 +0200
parents 59e8a50bef00
children de6e73e4df60
comparison
equal deleted inserted replaced
317:5ea07ecade93 318:bac7cc80f240
1154 # This line is the issue 1154 # This line is the issue
1155 self.assertEqual(1, len(DoGet(ORTHANC, u'/dicom-web/studies?PatientName=гусева*', 1155 self.assertEqual(1, len(DoGet(ORTHANC, u'/dicom-web/studies?PatientName=гусева*',
1156 headers = { 'accept' : 'application/json' }))) 1156 headers = { 'accept' : 'application/json' })))
1157 1157
1158 1158
1159 def test_transcoding(self): 1159 def test_frames_transcoding(self):
1160 ACCEPT = { 1160 ACCEPT = {
1161 '1.2.840.10008.1.2' : 'multipart/related; type=application/octet-stream; transfer-syntax=1.2.840.10008.1.2', 1161 '1.2.840.10008.1.2' : 'multipart/related; type=application/octet-stream; transfer-syntax=1.2.840.10008.1.2',
1162 '1.2.840.10008.1.2.1' : 'multipart/related; type=application/octet-stream; transfer-syntax=1.2.840.10008.1.2.1', 1162 '1.2.840.10008.1.2.1' : 'multipart/related; type=application/octet-stream; transfer-syntax=1.2.840.10008.1.2.1',
1163 '1.2.840.10008.1.2.4.50' : 'multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.50', 1163 '1.2.840.10008.1.2.4.50' : 'multipart/related; type=image/jpeg; transfer-syntax=1.2.840.10008.1.2.4.50',
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',
1283 headers = { 'Accept' : ACCEPT['1.2.840.10008.1.2.4.50'] }) 1283 headers = { 'Accept' : ACCEPT['1.2.840.10008.1.2.4.50'] })
1284 self.assertEqual(2, len(b)) 1284 self.assertEqual(2, len(b))
1285 self.assertEqual(a[0], b[0]) 1285 self.assertEqual(a[0], b[0])
1286 self.assertEqual(a[0], b[1]) 1286 self.assertEqual(a[0], b[1])
1287 1287
1288 1288
1289 def test_wado_transcoding(self):
1290 uri = '/dicom-web%s' % UploadAndGetWadoPath('TransferSyntaxes/1.2.840.10008.1.2.4.50.dcm')
1291
1292 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s' % uri,
1293 headers = { 'Accept' : 'nope' }))
1294
1295 a = DoGetMultipart(ORTHANC, '%s' % uri,
1296 headers = { })
1297 self.assertEqual(1, len(a))
1298 self.assertEqual('1.2.840.10008.1.2.4.50', GetTransferSyntax(a[0]))
1299 s = len(a[0])
1300
1301 a = DoGetMultipart(ORTHANC, '%s' % uri,
1302 headers = { 'Accept' : 'multipart/related' })
1303 self.assertEqual(1, len(a))
1304 self.assertEqual('1.2.840.10008.1.2.4.50', GetTransferSyntax(a[0]))
1305
1306 a = DoGetMultipart(ORTHANC, '%s' % uri,
1307 headers = { 'Accept' : 'multipart/related; type=application/dicom' })
1308 self.assertEqual(1, len(a))
1309 self.assertEqual('1.2.840.10008.1.2.4.50', GetTransferSyntax(a[0]))
1310
1311 a = DoGetMultipart(ORTHANC, '%s' % uri,
1312 headers = { 'Accept' : 'multipart/related; type=application/dicom; transfer-syntax=*' })
1313 self.assertEqual(1, len(a))
1314 self.assertEqual('1.2.840.10008.1.2.4.50', GetTransferSyntax(a[0]))
1315 self.assertEqual(s, len(a[0]))
1316
1317 a = DoGetMultipart(ORTHANC, '%s' % uri,
1318 headers = { 'Accept' : 'multipart/related; type=application/dicom; transfer-syntax=1.2.840.10008.1.2.4.50' })
1319 self.assertEqual(1, len(a))
1320 self.assertEqual('1.2.840.10008.1.2.4.50', GetTransferSyntax(a[0]))
1321
1322 a = DoGetMultipart(ORTHANC, '%s' % uri,
1323 headers = { 'Accept' : 'multipart/related; type=application/dicom; transfer-syntax=1.2.840.10008.1.2.1' })
1324 self.assertEqual(1, len(a))
1325 self.assertEqual('1.2.840.10008.1.2.1', GetTransferSyntax(a[0]))
1326 self.assertTrue(10 * s < len(a[0]))
1289 1327
1290 try: 1328 try:
1291 print('\nStarting the tests...') 1329 print('\nStarting the tests...')
1292 unittest.main(argv = [ sys.argv[0] ] + args.options) 1330 unittest.main(argv = [ sys.argv[0] ] + args.options)
1293 1331