diff Tests/GetPixelDataVR.py @ 547:7de5fd295025

testing instance metadata "PixelDataVR"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 22 Jun 2023 08:49:10 +0200
parents
children
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')