photon_mosaic.core.selectrois#

Classes

SelectRois(rois, roi_ids)

Class to select a subset of ROIs from an existing BaseRois object.

class photon_mosaic.core.selectrois.SelectRois(rois, roi_ids)[source]#

Class to select a subset of ROIs from an existing BaseRois object.

Methods

get_roi_image_masks([roi_ids])

Get the image mask for a specific ROI.

get_roi_image_masks(roi_ids=None)[source]#

Get the image mask for a specific ROI. The image mask can be binary or weighted and 2D (single plane) or 3D (multi-plane).

Subclasses may return either a dense np.ndarray or a sparse pydata/sparse array (e.g. sparse.GCXS). Each ROI typically occupies only a tiny fraction of the full imaging volume, so a sparse representation avoids the out-of-memory errors a dense array would cause once there are many ROIs over a large (e.g. volumetric) field of view – see photon-mosaic#103. Callers that need actual pixel values (e.g. for plotting) should call .todense() explicitly rather than assume a dense array.

Parameters:

roi_ids (list[int | str] | None) – The IDs of the ROIs.

Returns:

The image mask for the specified ROIs.

Return type:

ndarray