Mercurial > hg > orthanc-tests
annotate Tests/GetPixelDataVR.py @ 660:2f6686a3cd16
conditional test
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Mon, 24 Jun 2024 18:32:13 +0200 |
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') |