changeset 547:7de5fd295025

testing instance metadata "PixelDataVR"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 22 Jun 2023 08:49:10 +0200
parents 2f101bb5c808
children 3933237d1958 bcd87bf59630
files Tests/GetPixelDataVR.py Tests/Tests.py
diffstat 2 files changed, 47 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tests/GetPixelDataVR.py	Thu Jun 22 08:49:10 2023 +0200
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+
+import sys
+import pydicom
+
+if len(sys.argv) <= 1:
+    print('Print the VR of the pixel data of a set of DICOM files')
+    print('Usage: %s [list of DICOM files]' % sys.argv[0])
+    exit(-1)
+
+for f in sys.argv[1:]:
+    try:
+        ds = pydicom.dcmread(f)
+        print(f, '=>', ds['PixelData'].VR)
+    except:
+        print(f, '=>', 'Unable to parse')
--- a/Tests/Tests.py	Wed Jun 21 13:31:36 2023 +0200
+++ b/Tests/Tests.py	Thu Jun 22 08:49:10 2023 +0200
@@ -1171,15 +1171,26 @@
         self.assertEqual(DoGet(_REMOTE, '/series/%s/metadata/RemoteAET' % series), '')  # None, received by REST API
 
         m = DoGet(_REMOTE, '/instances/%s/metadata' % i)
-        if IsOrthancVersionAbove(_REMOTE, 1, 11, 0):
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 1):
+            self.assertEqual(11, len(m))
+        elif IsOrthancVersionAbove(_REMOTE, 1, 11, 0):
             self.assertEqual(10, len(m))
-            self.assertTrue('MainDicomTagsSignature' in m)
         elif IsOrthancVersionAbove(_REMOTE, 1, 9, 1):
             self.assertEqual(9, len(m))
+        else:
+            self.assertEqual(8, len(m))
+
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 1):
+            # ./Tests/GetPixelDataVR.py ./Database/Knee/T1/IM-0001-0001.dcm
+            self.assertTrue('PixelDataVR' in m)  # New in Orthanc 1.12.1
+            self.assertEqual('OW', DoGet(_REMOTE, '/instances/%s/metadata/PixelDataVR' % i))
+
+        if IsOrthancVersionAbove(_REMOTE, 1, 11, 0):
+            self.assertTrue('MainDicomTagsSignature' in m)
+
+        if IsOrthancVersionAbove(_REMOTE, 1, 9, 1):
             self.assertTrue('PixelDataOffset' in m)  # New in Orthanc 1.9.1
             self.assertEqual(int(DoGet(_REMOTE, '/instances/%s/metadata/PixelDataOffset' % i)), 0x0c78)
-        else:
-            self.assertEqual(8, len(m))
 
         self.assertTrue('IndexInSeries' in m)
         self.assertTrue('ReceptionDate' in m)
@@ -1382,15 +1393,27 @@
         self.assertEqual(1, len(i))
         m = DoGet(_REMOTE, '/instances/%s/metadata' % i[0])
 
-        if IsOrthancVersionAbove(_REMOTE, 1, 11, 0):
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 1):
+            self.assertEqual(11, len(m))
+        elif IsOrthancVersionAbove(_REMOTE, 1, 11, 0):
             self.assertEqual(10, len(m))
-            self.assertTrue('MainDicomTagsSignature' in m)  # New in Orthanc 1.11.0
         elif IsOrthancVersionAbove(_REMOTE, 1, 9, 1):
             self.assertEqual(9, len(m))
-            self.assertTrue('PixelDataOffset' in m)  # New in Orthanc 1.9.1
         else:
             self.assertEqual(8, len(m))
-            
+
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 1):
+            # ./Tests/GetPixelDataVR.py ./Database/ColorTestImageJ.dcm
+            self.assertTrue('PixelDataVR' in m)  # New in Orthanc 1.12.1
+            self.assertEqual('OB', DoGet(_REMOTE, '/instances/%s/metadata/PixelDataVR' % i[0]))
+
+        if IsOrthancVersionAbove(_REMOTE, 1, 11, 0):
+            self.assertTrue('MainDicomTagsSignature' in m)  # New in Orthanc 1.11.0
+
+        if IsOrthancVersionAbove(_REMOTE, 1, 9, 1):
+            self.assertTrue('PixelDataOffset' in m)  # New in Orthanc 1.9.1
+            self.assertEqual(2242, DoGet(_REMOTE, '/instances/%s/metadata/PixelDataOffset' % i[0]))
+
         self.assertTrue('IndexInSeries' in m)
         self.assertTrue('ReceptionDate' in m)
         self.assertTrue('RemoteAET' in m)