You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if raw.tag in _LUT_DESCRIPTOR_TAGS and value[0] < 0:
results in
TypeError: 'NoneType' object is not subscriptable
Expected behavior
Given that I discovered this by parsing what seems to be a set of faulty DICOMs (mangled pixel data), I'm not sure if an error should be raised if the colour attribute value is not provided.
However, given that value can be None for other tags, the simple fix is
try:
ifraw.tagin_LUT_DESCRIPTOR_TAGSandvalue[0] <0:
# We only fix the first value as the third value is 8 or 16value[0] +=65536exceptTypeError:
pass
(or test if value is iterable).
Your environment
Darwin-19.3.0-x86_64-i386-64bit
Python 3.7.6 | packaged by conda-forge | (default, Jan 7 2020, 22:05:27)
[Clang 9.0.1 ]
pydicom 1.4.1
Many thanks!
The text was updated successfully, but these errors were encountered:
LUT Descriptor and the Red/Green/Blue Palette Color LUT Descriptor elements are all type 1 or 1C, so nope they're not supposed to be empty. But I should've known better than to assume conformance...
Describe the bug
I have a DICOM image with the following tag (copied from ImageJ)
which corresponds to the raw data element, produced by
DataElement_from_raw
:Because this tag is matched by the LUT Descriptor tags and the value is empty (
None
), the following line:results in
Expected behavior
Given that I discovered this by parsing what seems to be a set of faulty DICOMs (mangled pixel data), I'm not sure if an error should be raised if the colour attribute value is not provided.
However, given that
value
can beNone
for other tags, the simple fix is(or test if
value
is iterable).Your environment
Many thanks!
The text was updated successfully, but these errors were encountered: