comparison Plugins/DicomWeb/Run.py @ 223:f5aca0917d60

DICOMweb: test_bitbucket_issue_111
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 26 Feb 2019 17:58:07 +0100
parents 0f03ee6ffa80
children f5414254ccaa
comparison
equal deleted inserted replaced
222:0f03ee6ffa80 223:f5aca0917d60
328 self.assertTrue(brainix in b) 328 self.assertTrue(brainix in b)
329 self.assertTrue(knee in b) 329 self.assertTrue(knee in b)
330 330
331 331
332 def test_bitbucket_issue_111(self): 332 def test_bitbucket_issue_111(self):
333 # Wrong serialization of empty values
334 # https://bitbucket.org/sjodogne/orthanc/issues/111
335 # https://bitbucket.org/sjodogne/orthanc-dicomweb/issues/3/
336
333 # According to the standard, section F.2.5 337 # According to the standard, section F.2.5
334 # (http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_F.2.5.html), 338 # (http://dicom.nema.org/medical/dicom/current/output/chtml/part18/sect_F.2.5.html),
335 # null values behave as follows: If an attribute is present in 339 # null values behave as follows: If an attribute is present in
336 # DICOM but empty (i.e., Value Length is 0), it shall be 340 # DICOM but empty (i.e., Value Length is 0), it shall be
337 # preserved in the DICOM JSON attribute object containing no 341 # preserved in the DICOM JSON attribute object containing no
338 # "Value", "BulkDataURI" or "InlineBinary". 342 # "Value", "BulkDataURI" or "InlineBinary".
339 # https://bitbucket.org/sjodogne/orthanc/issues/111/qido-rs-wrong-serialization-of-empty 343 # https://bitbucket.org/sjodogne/orthanc/issues/111/qido-rs-wrong-serialization-of-empty
340 344
341 UploadInstance(ORTHANC, 'ColorTestMalaterre.dcm') 345 UploadInstance(ORTHANC, 'Issue111.dcm')
342 346
343 a = DoGet(ORTHANC, '/dicom-web/studies', 347 # Test WADO-RS
344 headers = { 'accept' : 'application/json' }) 348 a = DoGet(ORTHANC, '/dicom-web/studies/1.2.276.0.7230010.3.1.2.8323329.30185.1551199973.371589/metadata')
345 349 self.assertEqual(1, len(a))
350 self.assertTrue('00080050' in a[0]) # AccessionNumber is null
351 self.assertEqual(1, len(a[0]['00080050'])) # 'vr' is the only field to be present
352 self.assertEqual('SH', a[0]['00080050']['vr'])
353
354 # Test QIDO-RS
355 a = DoGet(ORTHANC, '/dicom-web/studies')
346 self.assertEqual(1, len(a)) 356 self.assertEqual(1, len(a))
347 self.assertTrue('00080050' in a[0]) # AccessionNumber is null 357 self.assertTrue('00080050' in a[0]) # AccessionNumber is null
348 self.assertEqual(1, len(a[0]['00080050'])) # 'vr' is the only field to be present 358 self.assertEqual(1, len(a[0]['00080050'])) # 'vr' is the only field to be present
349 self.assertEqual('SH', a[0]['00080050']['vr']) 359 self.assertEqual('SH', a[0]['00080050']['vr'])
350 360
408 self.assertEqual(1, len(c)) 418 self.assertEqual(1, len(c))
409 self.assertEqual(b, c[0]) 419 self.assertEqual(b, c[0])
410 420
411 421
412 def test_bitbucket_issue_112(self): 422 def test_bitbucket_issue_112(self):
413 # QIDO-RS: wrong serialization of number values 423 # Wrong serialization of number values
414 # https://bitbucket.org/sjodogne/orthanc/issues/112 424 # https://bitbucket.org/sjodogne/orthanc/issues/112
415 # https://bitbucket.org/sjodogne/orthanc-dicomweb/issues/4/ 425 # https://bitbucket.org/sjodogne/orthanc-dicomweb/issues/4/
416 426
417 UploadInstance(ORTHANC, 'DummyCT.dcm') 427 UploadInstance(ORTHANC, 'DummyCT.dcm')
418 study = '1.2.840.113619.2.176.2025.1499492.7391.1171285944.390' 428 study = '1.2.840.113619.2.176.2025.1499492.7391.1171285944.390'
432 self.assertEqual('IS', a[0]['00201208']['vr']) # Number of Study Related Instances 442 self.assertEqual('IS', a[0]['00201208']['vr']) # Number of Study Related Instances
433 443
434 b = a[0]['00201208']['Value'][0] 444 b = a[0]['00201208']['Value'][0]
435 self.assertTrue(isinstance(b, (int, long))) 445 self.assertTrue(isinstance(b, (int, long)))
436 self.assertEqual(1, b) 446 self.assertEqual(1, b)
437 447
438 448
439 449
440 try: 450 try:
441 print('\nStarting the tests...') 451 print('\nStarting the tests...')
442 unittest.main(argv = [ sys.argv[0] ] + args.options) 452 unittest.main(argv = [ sys.argv[0] ] + args.options)