photon_mosaic.extractors.suite2prois#

Suite2p ROI extractor.

Suite2pRois exposes suite2p detection output as a BaseRois. It can be constructed two ways:

To reload the registered movie from the same folder, pair with Suite2pImaging.

Classes

Suite2pRois(folder_path[, sparse])

Suite2p ROIs loaded from a folder or wrapped from in-memory stats.

read_suite2p_rois

class photon_mosaic.extractors.suite2prois.Suite2pRois(folder_path, sparse=True)[source]#

Suite2p ROIs loaded from a folder or wrapped from in-memory stats.

Methods

from_stat(stats, shape, sampling_frequency)

Build ROIs directly from an in-memory suite2p stat list.

get_roi_image_masks([roi_ids])

Return binary image masks shaped (n_rois, H, W) or (n_rois, H, W, n_planes).

classmethod from_stat(stats, shape, sampling_frequency, plane_assignments=None, sparse=True)[source]#

Build ROIs directly from an in-memory suite2p stat list.

Parameters:
  • stats (Sequence[dict[str, Any]]) – Per-ROI stat dicts from suite2p detection. Each must contain ypix, xpix, and lam.

  • shape (tuple[int, int, int]) – Spatial shape (height, width, n_planes).

  • sampling_frequency (float) – Imaging sampling rate in Hz.

  • plane_assignments (NDArray[int64] | None) – Integer plane index for each ROI. Required when n_planes > 1.

  • sparse (bool) – Return image masks as a sparse sparse.GCXS array instead of a dense np.ndarray. See __init__().

Return type:

Suite2pRois

get_roi_image_masks(roi_ids=None)[source]#

Return binary image masks shaped (n_rois, H, W) or (n_rois, H, W, n_planes).

Returned as a sparse sparse.GCXS array by default, built directly from each ROI’s ypix/xpix pixel coordinates – suite2p detections can number in the tens of thousands over large (e.g. volumetric) fields of view, where a dense array would be far larger than the raw movie itself (see photon-mosaic#103). Pass sparse=False to the constructor for a plain np.ndarray instead.

Return type:

GCXS | NDArray

photon_mosaic.extractors.suite2prois.read_suite2p_rois#

alias of Suite2pRois