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

load_series #410

Open
RainerHeintzmann opened this issue Feb 23, 2025 · 3 comments
Open

load_series #410

RainerHeintzmann opened this issue Feb 23, 2025 · 3 comments

Comments

@RainerHeintzmann
Copy link

How about a load_series (and a save_series) command which is capable of loading (or saving) a series of files, all present in the same folder?
I tried writing something suitable. The filenames included in the loading process must follow a pattern which is specified by in the C-style printf convention (e.g. "myfilename_z%.3d_c%.2d.tif".) Currently only "%d" and "%.Nd" type notations are fully supported. For each such "%d" a dimension is added to the loaded data.

The code analyzes the content of a directory to automatically determine the final array sizes from the filenames and the dimensions of the first loaded image. Ranges and strides are also supported to only load parts of the available data, if needed.
I first intended to include it in MicroscopyTools.jl, but realized that, since it is based on load from the FileIO.jl toolbox, it might fit better here.

If of interest, should I make a pull request here?
It would add another dependency (Printf.jl) though.

@stemann
Copy link
Member

stemann commented Feb 23, 2025

You may want to take a peek at https://github.com/JuliaIO/MultifileArrays.jl

@stemann
Copy link
Member

stemann commented Feb 23, 2025

I don't think load_series, and save_series, are important enough to warrant adding a dependency to FileIO (even though Printf sounds pretty innocent - being a dependency of Dates etc.).

... it might also be hard to generalize to non-image file formats.

@RainerHeintzmann
Copy link
Author

Thanks for the hint about MultifileArrays.jl which I wasn't aware of. This would have saved me a day of work :-) I will have a closer look at it. The dependency on Printf can probably be removed, since currently only the%d and %.d functionality is supported anyway. One could also use core-julia formating ways instead. Anyway, it sounds like, if there is something extra to MultifileArrays.jl in my code, it should be added there. But it may be a great idea to get MultifileArrays.jl to be part of Images.jl then. At first glance on the documentation, it looks like reshaping the filenames into an array (as MultifileArrays.jl seems to require) could potentially be a bit annoying. I tried multiple uses of "*" in the same pattern but this does not seem to work yet.
Surprisingly MultifileArrays.jl is not (yet?) registered.

As for generalization to non-image file formats, one should probably get an Array of the loaded data in such cases.

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