HDF5
This module contains HDF5Writer for writing HDF5 datasets.
- morphocut.hdf5.HDF5Writer(file_name: str, data: Mapping[str, Any | Variable[Any]], *, file_mode='w', dataset_mode: Literal['create', 'append', 'extend'] | Variable[Literal['create', 'append', 'extend']] = 'create', compression=None, chunk_size: int | None = None)[source]
Write arrays to a HDF5 file.
- Parameters:
file_name (str) – Location of the output file.
data (Mapping or Variable) – Data to write (name => array).
file_mode (str, optional) – Opening mode of the HDF5 file.
dataset_mode (str, optional) – Dataset behavior.
- “append”: Append an array of shape \((*)\) to a dataset of shape \((N,*)\).
The data must have the same shape as the existing data, without the first dimension.
- “extend”: Extend a dataset of shape \((N,*)\) with an array of shape \((M,*)\).
The data must have the same shape as the existing data, except in the first dimension.
compression – Compression strategy. See
h5py.Group.create_dataset().chunk_size – Chunk size. See
h5py.Group.create_dataset().
Example
with Pipeline() as pipeline: image_fn = ... image = ImageReader(image_fn) HDF5Writer("path/to/file.h5", {image_fn: image}) pipeline.transform_stream()