Commit 5f5a5d7d7314f4a5de9ba0f2dc3ae78af181b5b4
1 parent
bb1d8e5f
Exists in
beta4
and in
1 other branch
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 | ... | ... |