Skip to content

Combine a filter line starting with || or + with the lines before it - #311

Open
vamsibvv wants to merge 1 commit into
pydicom:masterfrom
vamsibvv:fix/filter-line-or
Open

vamsibvv wants to merge 1 commit into
pydicom:masterfrom
vamsibvv:fix/filter-line-or

Conversation

@vamsibvv

@vamsibvv vamsibvv commented Nov 8, 2026

Copy link
Copy Markdown

Description

Related issues: follow-up to #279 (#278)

Since #279 each filter line is evaluated on its own, but the line results are then ANDed and each line's leading operator is dropped. So a line starting with || is ANDed with the lines before it, while recipe-filters.md says

contains ImageType SAVE
  || contains Manufacturer GE

means SAVE or GE. In the default recipe, the "Burned In Annotation" (CTP) label (contains ImageType SAVE, + contains Modality CT|MR, || contains BurnedInAnnotation YES, ...) only flags an image that matches every line, so an image with BurnedInAnnotation YES is not flagged. Of the deid-data images, ultrasounds/ultrasound-multiframe.dcm (BurnedInAnnotation YES) is the one that changes: not flagged on master, flagged with this change.

The fix puts each line's + / || operator between the line results, so lines are evaluated left to right the same way as operators within a line: A + B || C is (A and B) or C. A line without an operator is still ANDed, as before, and labels made only of + lines (like the Stanford ones) give the same result as before.

Added test_has_burned_pixels_single_lines_with_or with a small recipe in tests/resources; it fails on master. The other tests pass, apart from two that also fail on master on my Windows machine (temp file still open). CHANGELOG line and version bump to 0.4.14 are included; #308 bumps to the same version, so I'll rebase whichever goes second.

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • My code follows the style guidelines of this project

Open questions

recipe-filters.md describes a line without an operator as starting a second check ("First check ... Second check"), but such lines are ANDed. I left that alone, since changing it would change what current recipes flag.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant