changeset 663:7a6996b9b9ee

added specific c-find test
author Alain Mazy <am@orthanc.team>
date Fri, 05 Jul 2024 19:19:02 +0200
parents b31aa560210d
children 854640df43d3
files Database/WithEmptyPatientComments.dcm Tests/Tests.py
diffstat 2 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
Binary file Database/WithEmptyPatientComments.dcm has changed
--- a/Tests/Tests.py	Thu Jul 04 18:29:08 2024 +0200
+++ b/Tests/Tests.py	Fri Jul 05 19:19:02 2024 +0200
@@ -10412,3 +10412,36 @@
         self.assertEqual(1, int(a['RequestedTags']['NumberOfPatientRelatedStudies']))
         self.assertEqual(2, int(a['RequestedTags']['NumberOfPatientRelatedSeries']))
         self.assertEqual(4, int(a['RequestedTags']['NumberOfPatientRelatedInstances']))
+
+    def test_computed_tags_and_patient_comments(self):
+        UploadInstance(_REMOTE, 'WithEmptyPatientComments.dcm')
+
+        # without requesting PatientComments, we get the computed tags
+        i = CallFindScu([ '-k', 'PatientID=WITH_COMMENTS',  '-k', 'QueryRetrieveLevel=Study', '-k', 'ModalitiesInStudy', '-k', 'NumberOfStudyRelatedSeries', '-k', 'NumberOfStudyRelatedInstances' ])
+        modalitiesInStudy = re.findall('\(0008,0061\).*?\[(.*?)\]', i)
+        self.assertEqual(1, len(modalitiesInStudy))
+        self.assertEqual('CT', modalitiesInStudy[0])
+
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 4):
+            # when requesting PatientComments, with 1.12.4, we did not get the computed tags
+            i = CallFindScu([ '-k', 'PatientID=WITH_COMMENTS',  '-k', 'QueryRetrieveLevel=Study', '-k', 'ModalitiesInStudy', '-k', 'NumberOfStudyRelatedSeries', '-k', 'NumberOfStudyRelatedInstances', '-k', 'PatientComments' ])
+            modalitiesInStudy = re.findall('\(0008,0061\).*?\[(.*?)\]', i)
+            self.assertEqual(1, len(modalitiesInStudy))
+            self.assertEqual('CT', modalitiesInStudy[0])
+            numberOfStudyRelatedSeries = re.findall('\(0020,1206\).*?\[(.*?)\]', i)
+            self.assertEqual(1, len(numberOfStudyRelatedSeries))
+            self.assertEqual(1, int(numberOfStudyRelatedSeries[0]))
+            numberOfStudyRelatedInstances = re.findall('\(0020,1208\).*?\[(.*?)\]', i)
+            self.assertEqual(1, len(numberOfStudyRelatedInstances))
+            self.assertEqual(1, int(numberOfStudyRelatedInstances[0]))
+
+        a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Study',
+                                             'Expand': True,
+                                             'Query' : { 'PatientID' : 'WITH_COMMENTS'},
+                                             'RequestedTags': ['ModalitiesInStudy', 'NumberOfStudyRelatedSeries', 'NumberOfStudyRelatedInstances', 'PatientComments']})
+
+        self.assertEqual(4, len(a[0]['RequestedTags'].keys()))
+        self.assertEqual(1, int(a[0]['RequestedTags']['NumberOfStudyRelatedSeries']))
+        self.assertEqual(1, int(a[0]['RequestedTags']['NumberOfStudyRelatedInstances']))
+        self.assertEqual('CT', a[0]['RequestedTags']['ModalitiesInStudy'])
+        self.assertEqual('', a[0]['RequestedTags']['PatientComments'])