Hdf5ImagingExtractor#

class Hdf5ImagingExtractor(file_path: str | Path, mov_field: str = 'mov', sampling_frequency: float | None = None, start_time: float | None = None, metadata: dict | None = None, channel_names: _Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes] | None = None)[source]#

Bases: ImagingExtractor

An imaging extractor for HDF5.

Create an ImagingExtractor from an HDF5 file.

Parameters:
  • file_path (str or Path) – Path to the HDF5 file.

  • mov_field (str, optional) – Name of the dataset in the HDF5 file that contains the imaging data. The default is “mov”.

  • sampling_frequency (float, optional) – Sampling frequency of the video. The default is None.

  • start_time (float, optional) – Start time of the video. The default is None.

  • metadata (dict, optional) – Metadata dictionary. The default is None.

  • channel_names (array-like, optional) – List of channel names. The default is None.

__del__()[source]#

Close the HDF5 file.

get_series(start_sample=None, end_sample=None) ndarray[source]#

Get the series of samples.

Parameters:
  • start_sample (int, optional) – Start sample index (inclusive).

  • end_sample (int, optional) – End sample index (exclusive).

Returns:

series – The series of samples.

Return type:

numpy.ndarray

Notes

Importantly, we follow the convention that the dimensions of the array are returned in their matrix order, More specifically: (time, height, width)

Which is equivalent to: (samples, rows, columns)

For volumetric data, the dimensions are: (time, height, width, planes)

Which is equivalent to: (samples, rows, columns, planes)

Note that this does not match the cartesian convention: (t, x, y)

Where x is the columns width or and y is the rows or height.

get_image_shape() tuple[int, int][source]#

Get the shape of the video frame (num_rows, num_columns).

Returns:

image_shape – Shape of the video frame (num_rows, num_columns).

Return type:

tuple

get_num_samples()[source]#

Get the number of samples in the video.

Returns:

num_samples – Number of samples in the video.

Return type:

int

get_sampling_frequency()[source]#

Get the sampling frequency in Hz.

Returns:

sampling_frequency – Sampling frequency in Hz.

Return type:

float

get_native_timestamps(start_sample: int | None = None, end_sample: int | None = None) ndarray | None[source]#

Retrieve the original unaltered timestamps for the data in this interface.

Returns:

timestamps – The timestamps for the data stream, or None if native timestamps are not available.

Return type:

numpy.ndarray or None