annotate Tests/GetPixelDataVR.py @ 611:09fc76fbd46d

Added tag Orthanc-1.12.3 for changeset ec657d1a62a6
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 31 Jan 2024 13:51:40 +0100
parents 7de5fd295025
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
547
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python3
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 import sys
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 import pydicom
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 if len(sys.argv) <= 1:
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 print('Print the VR of the pixel data of a set of DICOM files')
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 print('Usage: %s [list of DICOM files]' % sys.argv[0])
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 exit(-1)
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 for f in sys.argv[1:]:
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 try:
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 ds = pydicom.dcmread(f)
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 print(f, '=>', ds['PixelData'].VR)
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 except:
7de5fd295025 testing instance metadata "PixelDataVR"
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 print(f, '=>', 'Unable to parse')