changeset 42:4fa03fcbff5e

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 12:09:47 +0200
parents 525a2f57ec94 (current diff) 8fb14554b27c (diff)
children 5f3bcdde2461
files
diffstat 1 files changed, 41 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Tue Aug 25 12:09:31 2015 +0200
+++ b/Tests/Tests.py	Tue Aug 25 12:09:47 2015 +0200
@@ -1222,6 +1222,10 @@
         png = GetImage(_REMOTE, '/instances/%s/preview' % i['ID'])
         self.assertEqual((5, 5), png.size)
 
+        j = DoGet(_REMOTE, i['Path'])
+        self.assertEqual('Instance', j['Type'])
+        self.assertEqual(j['ID'], i['ID'])
+
 
     def test_pilates(self):
         # "SCU failed error when accessing orthanc with osirix" by
@@ -2171,3 +2175,40 @@
         self.assertEqual(ComputeMD5(b), ComputeMD5(pdf))
 
         self.assertRaises(Exception, lambda: DoGet(_REMOTE, '/instances/%s/pdf' % brainixInstance))
+
+
+    def test_create_series(self):
+        i = DoPost(_REMOTE, '/tools/create-dicom',
+                   json.dumps({
+                    'Tags' : {
+                        'SpecificCharacterSet' : 'ISO_IR 100',
+                        'PatientName' : 'Sébastien Jodogne',
+                        'Modality' : 'CT',
+                        },
+                    'Content' : [
+                        {
+                            'Content': 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', # red dot in RGBA
+                            'Tags' : { 'ImageComments' : 'Tutu' }
+                            },
+                        'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAoUlEQVQ4jZ2SWw3EIBREjwUsYAELa2EtoAULFUCyXAtroRZqoRbox254BdLC/DZnZjoXWJFgCDg8egW2CBEhEnDzyRk+Ecxz2KP/0AL8S99T+jQccAVs22qKwAuPuq0uyNg9cPLh3am+pe/dkHLZtqJHj6vXJrZ7nvzvxxgemXgUwnGfXqpee09mUwp8m022OYP6bLF7mVuVe0y/umxinsAXRd9z0k1ubWsAAAAASUVORK5CYII=',
+                        ]
+                    }))
+
+        s = DoGet(_REMOTE, i['Path'])
+        self.assertEqual('Series', s['Type'])
+        self.assertEqual(s['ID'], i['ID'])
+        self.assertEqual(2, len(s['Instances']))
+        self.assertEqual(2, s['ExpectedNumberOfInstances'])
+        self.assertEqual('Complete', s['Status'])
+
+        a = DoGet(_REMOTE, '/instances/%s/tags?simplify' % s['Instances'][0])
+        b = DoGet(_REMOTE, '/instances/%s/tags?simplify' % s['Instances'][1])
+        self.assertTrue('ImageComments' in a or 'ImageComments' in b)
+        if 'ImageComments' in a:
+            self.assertEqual('Tutu', a['ImageComments'])
+        else:
+            self.assertEqual('Tutu', b['ImageComments'])
+
+        patient = DoGet(_REMOTE, '/instances/%s/patient' % s['Instances'][0])
+        self.assertEqual(patient['MainDicomTags']['PatientName'].encode('utf-8'),
+                         'Sébastien Jodogne')