Skip to content

Deidentification Exception in Filters #256

Description

@wetzelj

When adding a filter rule which targeted a non-string field (DICOM VR - DS) the empty() function in filter.py throws an exception - "'DSfloat' object has no attribute 'value'".

Filter rule:

LABEL Check for Empty RepetitionTime
  empty RepetitionTime

Root cause:
Currently in filter.py - line 155 we assume that if the content (returned from pydicom.DataSet.get()) is not a string, it's a DataElement. With this assumption we then attempt to get the value property of the content object. Depending on the parameter passed into get(), the returned value will either be the value from the tag or a DataElement. In the case of our filter rule above, the value returned from get() was of type DSfloat (not string), and threw an exception/

Proposed fix (Pull request coming shortly)
Instead of checking content is not string, reverse the logic and instead explicitly check for content being an instance of DataElement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions