changeset 661:763e2ccbd0df

added test_computed_tags
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Jul 2024 18:03:48 +0200
parents 2f6686a3cd16
children b31aa560210d
files Tests/Tests.py
diffstat 1 files changed, 33 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Mon Jun 24 18:32:13 2024 +0200
+++ b/Tests/Tests.py	Thu Jul 04 18:03:48 2024 +0200
@@ -10374,3 +10374,36 @@
         self.assertEqual(9, len(a))
         CheckInstanceContent(a)
         CheckRequestedTags(a)
+
+
+    def test_computed_tags(self):
+        UploadInstance(_REMOTE, 'Comunix/Ct/IM-0001-0001.dcm')
+        UploadInstance(_REMOTE, 'Comunix/Ct/IM-0001-0002.dcm')
+        UploadInstance(_REMOTE, 'Comunix/Pet/IM-0001-0001.dcm')
+        UploadInstance(_REMOTE, 'Comunix/Pet/IM-0001-0002.dcm')
+
+        instance = 'ee693caa-9786a685-4f0f9fb0-4411cc8b-988f5574'
+        series = '318603c5-03e8cffc-a82b6ee1-3ccd3c1e-18d7e3bb'
+        study = '6c65289b-db2fcb71-7eaf73f4-8e12470c-a4d6d7cf'
+        patient = '0946fcb6-cf12ab43-bad958c1-bf057ad5-0fc6f54c'
+
+        a = DoGet(_REMOTE, '/instances/%s?requested-tags=0008,0056' % instance)
+        self.assertEqual(1, len(a['RequestedTags']))
+        self.assertEqual('ONLINE', a['RequestedTags']['InstanceAvailability'])
+
+        a = DoGet(_REMOTE, '/series/%s?requested-tags=0020,1209' % series)
+        self.assertEqual(1, len(a['RequestedTags']))
+        self.assertEqual(2, int(a['RequestedTags']['NumberOfSeriesRelatedInstances']))
+
+        a = DoGet(_REMOTE, '/studies/%s?requested-tags=0008,0061;0008,0062;0020,1206;0020,1208' % study)
+        self.assertEqual(4, len(a['RequestedTags']))
+        self.assertEqual('CT\\PT', a['RequestedTags']['ModalitiesInStudy'])
+        self.assertEqual('1.2.840.10008.5.1.4.1.1.128\\1.2.840.10008.5.1.4.1.1.2', a['RequestedTags']['SOPClassesInStudy'])
+        self.assertEqual(2, int(a['RequestedTags']['NumberOfStudyRelatedSeries']))
+        self.assertEqual(4, int(a['RequestedTags']['NumberOfStudyRelatedInstances']))
+
+        a = DoGet(_REMOTE, '/patients/%s?requested-tags=0020,1200;0020,1202;0020,1204' % patient)
+        self.assertEqual(3, len(a['RequestedTags']))
+        self.assertEqual(1, int(a['RequestedTags']['NumberOfPatientRelatedStudies']))
+        self.assertEqual(2, int(a['RequestedTags']['NumberOfPatientRelatedSeries']))
+        self.assertEqual(4, int(a['RequestedTags']['NumberOfPatientRelatedInstances']))