Mercurial > hg > orthanc-tests
annotate Tests/GetPixelDataVR.py @ 631:3bf3ea08efde
typo
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 05 Mar 2024 09:13:02 +0100 |
parents | 7de5fd295025 |
children |
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') |