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

Support pathlib Path input in dask_image.imread.imread() #139

Closed
GenevieveBuckley opened this issue May 29, 2020 · 11 comments
Closed

Support pathlib Path input in dask_image.imread.imread() #139

GenevieveBuckley opened this issue May 29, 2020 · 11 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@GenevieveBuckley
Copy link
Collaborator

It would be good if we supported pathlib Path inputs into the dask-image imread() function. I don't think it should be too complicated to add, so this could be a good first issue for contributors to dask-image.

@GenevieveBuckley GenevieveBuckley added enhancement New feature or request good first issue Good for newcomers labels May 29, 2020
@martindurant
Copy link
Member

If dask-image uses fsspec.open_files, then you could achieve this easily by calling stringify_path in the first line of open_files

@martindurant
Copy link
Member

(feel free to use stringify_path even if you don't otherwise depend on fsspec, of course :) )

@tlambert03
Copy link

there's also os.fspath ... but that's probably not worth dropping support for py3.5? :)

@martindurant
Copy link
Member

os.fspath is almost identical to isinstance(urlpath, Path); then again, pathlib only appeared in py34.

Does dask-image support remote reading at all?

@GenevieveBuckley
Copy link
Collaborator Author

Hi @martindurant, dask-image does not use fsspec, we use pims. I do like stringify_path though, thanks for mentioning it!

Currently there isn't support for remote reading of files in dask-image. Pims does have support for remotely reading data via pims.ImageSequence(), but the more generalized pims.open() (which dask-image uses) does not share the same support. You can read a discussion about this at soft-matter/pims#310 and the work John did towards a solution at soft-matter/pims#316.

@martindurant
Copy link
Member

cc @danielballan , who worked on PIMS and we talked about this a little.
(@jakirkham , you are also maybe interested in this)

@jakirkham
Copy link
Member

Supporting pathlib seems sensible.

FWIW Dan started working on a prototype for PIMS 2. Maybe these would be good suggestions for that prototype? Dask-image really relies on other libraries to do the heavy lifting (and doesn't try to get too involved itself).

@GenevieveBuckley
Copy link
Collaborator Author

FWIW Dan started working on a prototype for PIMS 2. Maybe these would be good suggestions for that prototype?

Ok, done

Dask-image really relies on other libraries to do the heavy lifting (and doesn't try to get too involved itself).

When I say "support" from dask-image, I think that should just mean try coercing any Paths to strings for convenience, at least as long as we're calling out to a library that only accepts strings.

@jakirkham
Copy link
Member

Yeah that’s what I figured you meant by support as well. That’s what I was trying to respond to in the first line. So yeah let’s support pathlib.

Was trying to say more involved solutions are probably something we want to handle in a proper image reading library.

@GenevieveBuckley
Copy link
Collaborator Author

One thing to double check when working on this is whether we currently support passing lists of filenames, as well as just a single string. (I can't remember if this is true or not). If it is true, the solution to this issue will also need to work in that situation as well.

@GenevieveBuckley
Copy link
Collaborator Author

Closed via #174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants