comparison 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
comparison
equal deleted inserted replaced
546:2f101bb5c808 547:7de5fd295025
1 #!/usr/bin/env python3
2
3 import sys
4 import pydicom
5
6 if len(sys.argv) <= 1:
7 print('Print the VR of the pixel data of a set of DICOM files')
8 print('Usage: %s [list of DICOM files]' % sys.argv[0])
9 exit(-1)
10
11 for f in sys.argv[1:]:
12 try:
13 ds = pydicom.dcmread(f)
14 print(f, '=>', ds['PixelData'].VR)
15 except:
16 print(f, '=>', 'Unable to parse')