florin.io¶
I/O functions for loading and saving data in a variety of formats.
Functions¶
- load
- Load image(s) from a file.
- load_hdf5
- Load data from an HDF5 file.
- load_image
- Load an image file.
- load_images
- Load a directory of image files.
- load_npy
- Load data from a numpy array file.
- load_tiff
- Load a TIFF stack.
- save
- Save image(s) in a variety of formats.
- save_hdf5
- Save an image to HDF5 format.
- save_image
- Save an image.
- save_images
- Save a sequence of images.
- save_npy
- Save an image to a numpy array file.
- save_tiff
- Save an image to TIFF format.
Functions
load (path, \*\*kwargs) |
Load images from a file. |
load_hdf5 (path[, key]) |
Load data from an HDF5 file. |
load_image (path) |
Load an image file. |
load_images (path[, ext]) |
Load a directory of image files. |
load_npy (path) |
Load data from a numpy array file. |
load_tiff (path) |
Load a TIFF stack. |
save (img, path, \*\*kwargs) |
Save image(s) in a variety of formats. |
save_hdf5 (img, path[, key]) |
Save an image to HDF5 format. |
save_image (img, path) |
Save an image. |
save_images (img, path[, ext]) |
Save a sequence of images. |
save_npy (img, path) |
Save an image to a numpy array file. |
save_tiff (img, path) |
Save an image to TIFF format. |
-
florin.io.
load
(path, **kwargs)[source]¶ Load images from a file.
Generic loader function that uses the file extension to determine how to load the data.
Parameters: path (str) – Path to the image file(s) to load. Other Parameters: key – Key to load data from when working with key/value stores (e.g. HDF5, npz, etc.) Returns: data Return type: numpy.ndarray
-
florin.io.
load_hdf5
(path, key='stack')[source]¶ Load data from an HDF5 file.
Parameters: - path (str) – Path to the HDF5 file to load.
- key – Key to load data from.
Returns: data
Return type: h5py.Dataset
-
florin.io.
load_image
(path)[source]¶ Load an image file.
Parameters: path (str) – Path to the image file to load. Returns: data Return type: numpy.ndarray
-
florin.io.
load_images
(path, ext='png')[source]¶ Load a directory of image files.
Parameters: - path (str) – Path to the image file(s) to load.
- ext (str) – The file extension to match. Only files with this extension will be loaded. Default: ‘png’
Returns: data
Return type: numpy.ndarray
-
florin.io.
load_npy
(path)[source]¶ Load data from a numpy array file.
Parameters: path (str) – Path to the array file to load. Returns: data Return type: numpy.ndarray
-
florin.io.
load_tiff
(path)[source]¶ Load a TIFF stack.
Parameters: path (str) – Path to the TIFF stack to load. Returns: data Return type: numpy.ndarray
-
florin.io.
save
(img, path, **kwargs)[source]¶ Save image(s) in a variety of formats.
Parameters: - img (array_like) – The image/volume to save.
- path (str) – The filepath to save the data to. This path determines which format the data will be saved as.
Returns: The unaltered image/volume.
Return type: img
Other Parameters: - See ``save_hdf5``, ``save_image``, ``save_images``, ``save_npy``, and
- ``save_tiff`` for filetype-specific arguments.
Notes
The filetype passed as
path
will determine the format of the saved file. If no extension is found, 3D arrays will automatically be saved as numbered PNG files in a directory created atpath
and 2D arrays will be saved topath
directly as a PNG.
-
florin.io.
save_hdf5
(img, path, key='stack')[source]¶ Save an image to HDF5 format.
Parameters: - img (array_like) – The image/volume to save.
- path (str) – The filepath to save the data to.
-
florin.io.
save_image
(img, path)[source]¶ Save an image.
Parameters: - img (array_like) – The image/volume to save.
- path (str) – The filepath to save the data to.
-
florin.io.
save_images
(img, path, ext='png')[source]¶ Save a sequence of images.
Parameters: - img (array_like) – The image/volume to save.
- path (str) – The filepath to save the data to.
- ext (str) – The file extension to save each image with.