Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restrict wsi_dir.glob to files #190

Merged
merged 2 commits into from
Sep 19, 2023
Merged

restrict wsi_dir.glob to files #190

merged 2 commits into from
Sep 19, 2023

Conversation

xalexalex
Copy link
Contributor

@xalexalex xalexalex commented Sep 16, 2023

fixes #189

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

@kaczmarj
Copy link
Member

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!

Copy link
Member

@kaczmarj kaczmarj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xalexalex - what do you think about checking for files in this way, with iterdir combined with is_file() ?

wsinfer/cli/infer.py Outdated Show resolved Hide resolved
wsinfer/modellib/run_inference.py Outdated Show resolved Hide resolved
wsinfer/patchlib/__init__.py Outdated Show resolved Hide resolved
wsinfer/wsi.py Outdated Show resolved Hide resolved
@kaczmarj kaczmarj merged commit 59c0f5c into SBU-BMI:main Sep 19, 2023
11 checks passed
@kaczmarj
Copy link
Member

thanks @xalexalex for the contribution!

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.

MIRAX (.mrxs) support
2 participants