photon_mosaic.core.imaging_ops#
Operations that derive one imaging object from another.
Every public callable here takes imaging object(s) and hands back a new lazy proxy: selecting or subdividing epochs, cutting out a frame range, or joining objects along the plane axis. Nothing copies pixels — the proxies pull from their parents on read.
Functions
|
Return a proxy with the epochs of each imaging object in list order. |
|
Return a single-epoch proxy joining all input epochs in order. |
|
Return a single-epoch proxy over |
|
Split one epoch of |
|
Return a proxy imaging object with only the requested epochs. |
|
Return a list of proxy imaging objects, each containing a single epoch. |
|
Stack imaging objects along the plane axis into one multi-plane volume. |
Classes
|
Imaging proxy whose epochs are those of each input, in list order. |
|
Imaging proxy joining all epochs of one or several input imaging objects into one epoch along time. |
|
Imaging proxy exposing one contiguous frame range of a parent epoch. |
|
Proxy imaging object exposing only selected epochs from a parent imaging. |
|
Imaging proxy that subdivides one epoch of a parent into several sub-epochs. |
|
Imaging proxy that stacks several imaging objects along the plane axis. |
- class photon_mosaic.core.imaging_ops.SelectEpochImaging(imaging, epoch_indices)[source]#
Proxy imaging object exposing only selected epochs from a parent imaging.
Methods
get_series([start_frame, end_frame, ...])Get a series of frames from the imaging data.
- get_series(start_frame=None, end_frame=None, plane_ids=None, epoch_index=None)[source]#
Get a series of frames from the imaging data.
- Parameters:
start_frame (
int|None) – The starting frame index (inclusive).end_frame (
int|None) – The ending frame index (exclusive).plane_ids (
list|ndarray|None) – The list of plane IDs to include. If None, all planes are included.epoch_index (
int|None) – The index of the imaging segment. If None and there is only one segment, it defaults to 0.
- Returns:
The requested series of frames as a NumPy array.
- Return type:
ndarray
- photon_mosaic.core.imaging_ops.split_epochs(imaging, epoch_indices)[source]#
Return a proxy imaging object with only the requested epochs.
- Return type:
- photon_mosaic.core.imaging_ops.split_imaging_by_epochs(imaging)[source]#
Return a list of proxy imaging objects, each containing a single epoch.
- Return type:
list[SelectEpochImaging]
- class photon_mosaic.core.imaging_ops.SplitEpochAtFramesImaging(imaging, epoch_index, frame_boundaries)[source]#
Imaging proxy that subdivides one epoch of a parent into several sub-epochs.
The frame boundaries are interpreted in the same way as
np.split: the boundaries split the parent epoch intolen(boundaries) + 1contiguous pieces, each exposed as its own epoch on the returned object. Pixels are pulled lazily from the parent — no data is copied.
- photon_mosaic.core.imaging_ops.split_epoch_at_frames(imaging, epoch_index, frame_boundaries)[source]#
Split one epoch of
imaginginto contiguous sub-epochs at the given frame boundaries.Convenience wrapper for
SplitEpochAtFramesImaging. Useful when an extractor exposes recorded files as a single concatenated epoch (e.g. suite2p’s per-planedata.binplusops['frames_per_file']) and you want each underlying file as its own epoch.- Return type:
- class photon_mosaic.core.imaging_ops.FrameSliceImaging(parent_imaging, start_frame=None, end_frame=None, epoch_index=None)[source]#
Imaging proxy exposing one contiguous frame range of a parent epoch.
The imaging counterpart of SpikeInterface’s
FrameSliceRecording: the way to cut a short stub out of a long video, whether for a test fixture, a quick look, or to hand something small to code that would choke on the whole recording. Pixels are pulled lazily from the parent.The result has exactly one epoch.
t_startstays on the parent’s timeline rather than being re-referenced to zero, so the stub keeps its place in the original recording.- Parameters:
parent_imaging (
BaseImaging) – The imaging object to slice.start_frame (
int|None) – First included frame, or 0 if None.end_frame (
int|None) – End frame, excluded as in ordinary python slicing; the parent epoch’s frame count if None.epoch_index (
int|None) – Which epoch of the parent to slice. If None and the parent has a single epoch it defaults to that one; a multi-epoch parent must name its epoch, as it must forBaseImaging.get_series(). SpikeInterface refuses a multi-segment parent outright; naming the epoch keeps that capability without letting an unnamed one be picked silently (see issue #129).
- photon_mosaic.core.imaging_ops.frame_slice(parent_imaging, start_frame=None, end_frame=None, epoch_index=None)[source]#
Return a single-epoch proxy over
[start_frame, end_frame)of one parent epoch.Convenience wrapper for
FrameSliceImaging.- Return type:
- class photon_mosaic.core.imaging_ops.ConcatenateImaging(imagings)[source]#
Imaging proxy joining all epochs of one or several input imaging objects into one epoch along time.
Epoch data is accessed lazily in input order;
t_startis the first epoch’s from the first input.
- photon_mosaic.core.imaging_ops.concatenate_epochs(imagings)[source]#
Return a single-epoch proxy joining all input epochs in order.
- Return type:
- class photon_mosaic.core.imaging_ops.AppendImaging(imagings)[source]#
Imaging proxy whose epochs are those of each input, in list order.
Inputs must share shape, sampling frequency and dtype. Nothing is copied.
- photon_mosaic.core.imaging_ops.append_imaging(imagings)[source]#
Return a proxy with the epochs of each imaging object in list order.
- Return type:
- class photon_mosaic.core.imaging_ops.StackPlanesImaging(imagings)[source]#
Imaging proxy that stacks several imaging objects along the plane axis.
All inputs must share the same epoch structure (number of epochs and the per-epoch frame counts), the same
(height, width), sampling frequency and dtype. The resulting object hassum(num_planes)planes and pulls pixels lazily from the inputs — no data is copied.- Parameters:
imagings (
Sequence[BaseImaging]) – Two or more imaging objects covering the same field of view at the same timestamps, each providing one or more planes.
- photon_mosaic.core.imaging_ops.stack_planes(*imagings)[source]#
Stack imaging objects along the plane axis into one multi-plane volume.
Accepts the objects either as separate arguments (
stack_planes(a, b)) or as a single sequence (stack_planes([a, b])).- Parameters:
*imagings (
BaseImaging) – Two or more imaging objects of the same FOV / timestamps; seeStackPlanesImaging.- Returns:
A lazy multi-plane view over the inputs.
- Return type: