Mercurial > hg > orthanc-book
comparison Sphinx/source/plugins/python/lookup-dictionary.py @ 708:cd70d23f34bc
Lookup DICOM dictionary in Python scripts
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 11 Jun 2021 14:09:21 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
707:daf07750e901 | 708:cd70d23f34bc |
---|---|
1 import json | |
2 import orthanc | |
3 | |
4 # Create a dictionary mapping the numeric values in enumeration | |
5 # "orthanc.ValueRepresentation" to the name of the corresponding VR | |
6 VR_NAMES = {} | |
7 for name in dir(orthanc.ValueRepresentation): | |
8 if not name.startswith('_'): | |
9 value = getattr(orthanc.ValueRepresentation, name) | |
10 VR_NAMES[value] = name | |
11 | |
12 entry = orthanc.LookupDictionary('PatientID') | |
13 | |
14 orthanc.LogWarning('Entry in the dictionary: %s' % | |
15 json.dumps(entry, indent = 4, sort_keys = True)) | |
16 | |
17 orthanc.LogWarning('Name of the value representation: %s' % | |
18 VR_NAMES[entry['ValueRepresentation']]) |