annotate Tests/GetPixelDataVR.py @ 735:be8f174d3c9d find-refactoring tip

tools/find: Limit and Since are now forbidden when filtering on DICOM tags that are not stored in DB
author Alain Mazy <am@orthanc.team>
date Thu, 24 Oct 2024 15:08:59 +0200
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')