From d6c1e202d55ad87d88dd7271f386a202a186a834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20POIRET?= Date: Fri, 29 Mar 2024 10:42:54 +0100 Subject: [PATCH] fix: warnings in mri filtering --- hsf/factory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hsf/factory.py b/hsf/factory.py index 037f9a8..f906943 100644 --- a/hsf/factory.py +++ b/hsf/factory.py @@ -159,7 +159,7 @@ def filter_mris(mris: List[PosixPath], overwrite: bool) -> List[PosixPath]: def _get_segmentations(mri: PosixPath) -> List[PosixPath]: extensions = "".join(mri.suffixes) stem = mri.name.replace(extensions, "") - segmentations = mri.parent.glob(f"{stem}*_hippocampus_seg.nii.gz") + segmentations = list(mri.parent.glob(f"{stem}*_hippocampus_seg.nii.gz")) if len(segmentations) > 2: log.warning( @@ -173,7 +173,7 @@ def _get_segmentations(mri: PosixPath) -> List[PosixPath]: "Skipping segmentation. If you want to overwrite, set overwrite=True." ) - return list(segmentations) + return segmentations mris = [mri for mri in mris if not mri.name.endswith("_seg.nii.gz")] if overwrite: