changeset 488:e904b2282b0e

Added support for RGBA64 images in tools/create-dicom and /preview (Contribution from James Manners - Pliny)
author Alain Mazy <am@osimis.io>
date Fri, 08 Jul 2022 15:27:27 +0200
parents 18f2d55182fd
children 2078cb20a560
files Database/Png16RBGATest.png Database/README.txt Tests/Tests.py
diffstat 3 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
Binary file Database/Png16RBGATest.png has changed
--- a/Database/README.txt	Wed Jun 29 11:23:33 2022 +0200
+++ b/Database/README.txt	Fri Jul 08 15:27:27 2022 +0200
@@ -93,6 +93,7 @@
 - Multiframe.dcm : From GDCM, "images_of_interest/PHILIPS_Integris_H-8-MONO2-Multiframe.dcm"
 - Phenix/* : From OsiriX, "PHENIX" (sample of uncompressed data).
 - PilatesArgenturGEUltrasoundOsiriX.dcm: From https://groups.google.com/d/msg/orthanc-users/m3zQLyl_jNc/TUrR462UKSMJ
+- PNG16RGBATest.png : From http://www.schaik.com/pngsuite/#basic, License http://www.schaik.com/pngsuite/PngSuite.LICENSE
 - PrivateMDNTags.dcm : From University Hospital of Liege
 - PrivateTags.dcm : From GDCM, "images_of_interest/494APG9K.dcm"
 - SignedCT.dcm : From Sébastien Jodogne.
--- a/Tests/Tests.py	Wed Jun 29 11:23:33 2022 +0200
+++ b/Tests/Tests.py	Fri Jul 08 15:27:27 2022 +0200
@@ -8821,3 +8821,28 @@
                   headers = { 'Accept' : 'application/dicom+json' })
         self.assertEqual(b['0020000D']['Value'][0], '1.2.276.0.7230010.3.1.2.2358427580.3460.1646695830.793')
         self.assertEqual(b['0020000E']['Value'][0], '1.2.276.0.7230010.3.1.3.2358427580.3460.1646695830.794')
+    
+    def test_create_png16RBGA(self):
+        with open(GetDatabasePath('Png16RBGATest.png'), 'rb') as f:
+            png = f.read()
+
+        i = DoPost(_REMOTE, '/tools/create-dicom',
+                   json.dumps({
+                    'PatientName' : 'Jodogne',
+                    'Modality' : 'CT',
+                    'SOPClassUID' : '1.2.840.10008.5.1.4.1.1.1',
+                    'PixelData' : 'data:image/png;base64,' + base64.b64encode(png)
+                    }))
+
+        self.assertEqual('Jodogne', DoGet(_REMOTE, '/instances/%s/content/PatientName' % i['ID']).strip())
+        self.assertEqual('CT', DoGet(_REMOTE, '/instances/%s/content/Modality' % i['ID']).strip())
+
+        png = GetImage(_REMOTE, '/instances/%s/preview' % i['ID'])
+        self.assertEqual((32, 32), png.size)
+
+        png = GetImage(_REMOTE, '/instances/%s/rendered' % i['ID'])
+        self.assertEqual((32, 32), png.size)
+
+        j = DoGet(_REMOTE, i['Path'])
+        self.assertEqual('Instance', j['Type'])
+        self.assertEqual(j['ID'], i['ID'])