SBU-BMI / wsinfer

🔥 🚀 Blazingly fast pipeline for patch-based classification in whole slide images
https://wsinfer.readthedocs.io
Apache License 2.0
55 stars 9 forks source link

restrict wsi_dir.glob to files #190

Closed xalexalex closed 10 months ago

xalexalex commented 10 months ago

fixes #189

this could also be done differently, e.g. glob("*") or iterdir + checking if is_dir

kaczmarj commented 10 months ago

thanks @xalexalex for your contribution! instead of globbing with .* to get files, could we use a combination of iterdir and is_file()? for example, my concern is that this might capture hidden files. and while unlikely, it's possible that a file might not have an extension and therefore no . character.

i am thinking of something like this:

from pathlib import Path
files_in_wsi_dir =[p for p in wsi_dir.iterdir() if p.is_file()]

thanks for bringing up the MRXS use case!

kaczmarj commented 10 months ago

thanks @xalexalex for the contribution!