changeset 270:082f35cb4459

test_bitbuck_issue_168
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 28 Feb 2020 13:12:40 +0100
parents b2d8582b9181
children d202bfcd7b96
files Database/Issue168.dcm GenerateConfigurationForTests.py Plugins/DicomWeb/Run.py
diffstat 3 files changed, 46 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
Binary file Database/Issue168.dcm has changed
--- a/GenerateConfigurationForTests.py	Wed Feb 26 13:21:50 2020 +0100
+++ b/GenerateConfigurationForTests.py	Fri Feb 28 13:12:40 2020 +0100
@@ -138,9 +138,13 @@
 config['Dictionary'] = {
     '00e1,10c2' : [ 'UI', 'PET-CT Multi Modality Name', 1, 1, 'ELSCINT1' ],
     '7053,1003' : [ 'ST', 'Original Image Filename', 1, 1, 'Philips PET Private Group' ],
-    '4321,1012' : [ 'LO', 'RadioButton3', 1, 1, 'RadioLogic' ],  # For issue 140
+    '4321,1012' : [ 'LO', 'RadioButton3', 1, 1, 'RadioLogic' ],     # For issue 140
+    '0009,1001' : [ 'DS', 'Abnormality score', 1, 1, 'Lunit' ],     # For issue 168
+    '0009,0010' : [ 'LO', 'Private data element', 1, 1, 'Lunit' ],  # For issue 168
 }
 
+config['DefaultPrivateCreator'] = 'Lunit'  # For issue 168
+
 config['DicomWeb'] = {
     'Servers' : {
         'sample' : [ 
--- a/Plugins/DicomWeb/Run.py	Wed Feb 26 13:21:50 2020 +0100
+++ b/Plugins/DicomWeb/Run.py	Fri Feb 28 13:12:40 2020 +0100
@@ -121,6 +121,8 @@
             import warnings
             warnings.simplefilter("ignore", ResourceWarning)
 
+        #print("In test: ", self._testMethodName)
+            
         DropOrthanc(ORTHANC)
 
     def test_wado_dicom(self):
@@ -977,15 +979,53 @@
         self.assertEqual(series, a[0]['0020000E']['Value'][0])
 
 
+    #@unittest.skip("Skip this test on GDCM 2.8.4")
     def test_bitbucket_issue_164(self):
+        # WARNING - This makes GDCM 2.8.4 crash
         # https://bitbucket.org/sjodogne/orthanc/issues/164
         UploadInstance(ORTHANC, 'Issue164.dcm')
 
         p = DoGetMultipart(ORTHANC, 'dicom-web/studies/1.2.276.0.26.1.1.1.2.2020.45.52293.1506048/series/1.2.276.0.26.1.1.1.2.2020.45.52293.6384450/instances/1.2.276.0.26.1.1.1.2.2020.45.52366.2551599.179568640/frames/5')
         self.assertEqual(1, len(p))
         self.assertEqual(743 * 975 * 3, len(p[0]))
+
+
+    def test_bitbuck_issue_168(self):
+        # "Plugins can't read private tags from the configuration file"
+        # This test will fail if DCMTK <= 3.6.1 (e.g. on Ubuntu 16.04)
+        # https://bitbucket.org/sjodogne/orthanc/issues/168/
+
+        UploadInstance(ORTHANC, 'Issue168.dcm')
+
+        a = DoGet(ORTHANC, '/dicom-web/studies')
+        self.assertEqual(1, len(a))
+        self.assertFalse('00090010' in a[0])
+        self.assertFalse('00091001' in a[0])
+        self.assertEqual('20170404', a[0]['00080020']['Value'][0])
+
+        a = DoGet(ORTHANC, '/dicom-web/studies?includefield=00091001')
+        self.assertEqual(1, len(a))
+        self.assertFalse('00090010' in a[0])
+        self.assertTrue('00091001' in a[0])
+        self.assertEqual('DS', a[0]['00091001']['vr'])
+        self.assertEqual(1, len(a[0]['00091001']['Value']))
+        self.assertAlmostEqual(98.41, a[0]['00091001']['Value'][0])
+
+        a = DoGet(ORTHANC, '/dicom-web/studies?00090010=Lunit&includefield=00091001')
+        self.assertEqual(1, len(a))
+        self.assertTrue('00090010' in a[0])
+        self.assertEqual('LO', a[0]['00090010']['vr'])
+        self.assertEqual(1, len(a[0]['00090010']['Value']))
+        self.assertEqual('Lunit', a[0]['00090010']['Value'][0])
+        self.assertTrue('00091001' in a[0])
+        self.assertEqual('DS', a[0]['00091001']['vr'])
+        self.assertEqual(1, len(a[0]['00091001']['Value']))
+        self.assertAlmostEqual(98.41, a[0]['00091001']['Value'][0])
         
-        
+        a = DoGet(ORTHANC, '/dicom-web/studies?00090010=Lunit2&includefield=00091001')
+        self.assertEqual(0, len(a))
+
+
 try:
     print('\nStarting the tests...')
     unittest.main(argv = [ sys.argv[0] ] + args.options)