bhklab / med-imagetools

Transparent and reproducible medical image processing pipelines in Python.
https://bhklab.github.io/med-imagetools/devel
MIT License
36 stars 9 forks source link

fix: find-dicoms utility to check valid dicom after filtering #149

Open jjjermiah opened 16 hours ago

jjjermiah commented 16 hours ago
    files = (
        file.absolute()
        for file in glob_method(pattern)
        if _is_valid_dicom(file, check_header)
        and (not search_input or all(term in str(file.as_posix()) for term in search_input))
    )

in https://github.com/bhklab/med-imagetools/blob/07a41fe073f9ce6a88aaa032caf69a7fb6086314/src/imgtools/dicom/utils.py#L37-L151

jjjermiah commented 16 hours ago

rationale:

if provided search input to filter by, then it doesnt make sense to check if _is_valid_dicom first for efficiency