photon_mosaic.core.zarrimaging#

Functions

add_imaging_to_zarr_group(imaging, zarr_group)

Adds an Imaging object to a zarr group.

Classes

ZarrImaging(folder_path[, storage_options, ...])

An Imaging object that is backed by a zarr array on disk.

ZarrImagingEpoch(root, dataset_name, ...)

class photon_mosaic.core.zarrimaging.ZarrImaging(folder_path, storage_options=None, load_compression_ratio=False)[source]#

An Imaging object that is backed by a zarr array on disk. This allows for memory efficient access to large imaging datasets that do not fit in memory.

Parameters:
  • folder_path (str | Path) – The path to the folder containing the zarr group with the imaging data.

  • storage_options (dict | None) – Optional storage options for opening the zarr group.

Methods

write_imaging(imaging, folder_path[, verbose])

Write imaging data to a Zarr folder.

static write_imaging(imaging, folder_path, verbose=False, **kwargs)[source]#

Write imaging data to a Zarr folder.

Parameters:
  • imaging (BaseImaging) – Imaging object to write.

  • folder_path (str) – Destination folder path for the Zarr store.

  • verbose (bool, default: False) – Whether to print verbose output during writing.

  • **kwargs – Additional keyword arguments, including storage_options.

Returns:

A ZarrImaging instance opened from folder_path.

Return type:

ZarrImaging

Notes

Implemented as a static method so it can be called by BaseImaging.save() without instantiating ZarrImaging.

This is its only intended use.

class photon_mosaic.core.zarrimaging.ZarrImagingEpoch(root, dataset_name, **time_kwargs)[source]#

Methods

get_num_samples()

Returns the number of samples in this signal block

get_series(start_frame, end_frame[, ...])

Return the raw series, optionally for a subset of samples

get_num_samples()[source]#

Returns the number of samples in this signal block

Returns:

Number of samples in the signal block

Return type:

int

get_series(start_frame, end_frame, plane_indices=None)[source]#

Return the raw series, optionally for a subset of samples

Parameters:
  • start_frame (int) – start sample index, or zero if None

  • end_frame (int) – end_sample, or number of samples if None

  • plane_indices (slice | ndarray | None) – List of plane indices to include, or all planes if None

Returns:

series – Array of series, num_samples x height x width

Return type:

ndarray

photon_mosaic.core.zarrimaging.add_imaging_to_zarr_group(imaging, zarr_group, verbose=False, dtype=None, **kwargs)[source]#

Adds an Imaging object to a zarr group.

Parameters:
  • imaging (BaseImaging) – The Imaging object to add to the zarr group.

  • zarr_group (Group) – The zarr group to which the imaging data should be added.

  • verbose (bool) – Whether to print verbose output during the writing process.

  • dtype (np.dtype | None) – The dtype to use for the video datasets. If None, the dtype of the imaging data will be used.

  • **kwargs – Additional keyword arguments to pass to the _write_time_series_to_zarr function. This can include zarr-specific arguments (e.g., compressor, filters) as well as job-related arguments (e.g., n_jobs).