Commit 54759b5dcabc0b57cb0df24121f6cc66a83f773a
1 parent
04381202
Exists in
master
and in
63 other branches
Handling KeyError exception on dicom_reader to dicom with nonstandard encoding
Some dicom files have encoding names that do not follow the standard, in these cases a default dicom encoding (ISO_IR 100) is used.
Showing
1 changed file
with
4 additions
and
1 deletions
Show diff stats
invesalius/reader/dicom_reader.py
... | ... | @@ -124,7 +124,10 @@ class LoadDicom: |
124 | 124 | if encoding_value.startswith("Loaded"): |
125 | 125 | encoding = "ISO_IR 100" |
126 | 126 | else: |
127 | - encoding = const.DICOM_ENCODING_TO_PYTHON[encoding_value] | |
127 | + try: | |
128 | + encoding = const.DICOM_ENCODING_TO_PYTHON[encoding_value] | |
129 | + except KeyError: | |
130 | + encoding = 'ISO_IR 100' | |
128 | 131 | else: |
129 | 132 | encoding = "ISO_IR 100" |
130 | 133 | ... | ... |