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 compressed tifs for read/write #239

Open
freeman-lab opened this issue Dec 10, 2015 · 3 comments
Open

Support compressed tifs for read/write #239

freeman-lab opened this issue Dec 10, 2015 · 3 comments

Comments

@freeman-lab
Copy link
Member

In the refactor currently underway (#237) we'll add a totif method that saves an Images object to tif files. @d-v-b can you post here the code snippet that adds optional compression when using sklearn.external.tifffile?

@d-v-b
Copy link
Contributor

d-v-b commented Dec 10, 2015

compression is passed as an integer kwarg to the imsave() function, e.g. imsave(im_path, image, compress=1). The default, compress = 0 means no compression, and increasing values of compress above 1 increase the level of compression, which I think is done via zlib.

More generally, there are other kwargs that people might want to use when saving tifs, since there's plenty of metadata that can be set in the tif format. How possible is it to completely wrap the functionality of tiffffile in thunder?

@freeman-lab
Copy link
Member Author

Ok great thanks @d-v-b ! Generally it'd be easy to add whatever kwargs we want, because the thunder.images totif method is more or less just calling the tifffile imsave method on every record. One option is to list them and pass them along explicitly, the other is to just to pass all extra kwargs from totif to imave . I sort of prefer the former because it can be more explicitly documented.

@d-v-b
Copy link
Contributor

d-v-b commented Dec 10, 2015

Agreed @freeman-lab. What do you think about more complex cases of thunder wrapping some function from another module that has kwargs? timeSeries.normalize(baseline=window-fast) comes to mind, where scipy.ndimage.filters.percentile_filter is called with mode = nearest, but the user might want something else... (mode = nearest causes strong edge effects). How should this kind of case be handled?

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

No branches or pull requests

2 participants