Suite2pSegmentationExtractor#

class Suite2pSegmentationExtractor(folder_path: str | Path, channel_name: str | None = None, plane_name: str | None = None)[source]#

Bases: SegmentationExtractor

A segmentation extractor for Suite2p.

Create SegmentationExtractor object out of suite 2p data type.

Parameters:
  • folder_path (str or Path) – The path to the ‘suite2p’ folder.

  • channel_name (str, optional) – The name of the channel to load, to determine what channels are available use Suite2pSegmentationExtractor.get_available_channels(folder_path).

  • plane_name (str, optional) – The name of the plane to load, to determine what planes are available use Suite2pSegmentationExtractor.get_available_planes(folder_path).

classmethod get_available_channels(folder_path: str | Path) list[str][source]#

Get the available channel names from the folder paths produced by Suite2p.

Parameters:

folder_path (PathType) – Path to Suite2p output path.

Returns:

channel_names – List of channel names.

Return type:

list

classmethod get_available_planes(folder_path: str | Path) list[str][source]#

Get the available plane names from the folder produced by Suite2p.

Parameters:

folder_path (PathType) – Path to Suite2p output path.

Returns:

plane_names – List of plane names.

Return type:

list

get_num_samples() int[source]#

Get the number of samples in the recording (duration of recording).

Returns:

num_samples – Number of samples in the recording.

Return type:

int

get_accepted_list() list[source]#

Get a list of accepted ROI ids.

Returns:

accepted_list – List of accepted ROI ids.

Return type:

list

get_rejected_list() list[source]#

Get a list of rejected ROI ids.

Returns:

rejected_list – List of rejected ROI ids.

Return type:

list

property roi_locations: ndarray#

Returns the center locations (x, y) of each ROI.

get_roi_pixel_masks(roi_ids=None) list[ndarray][source]#

Get the weights applied to each of the pixels of the mask.

Parameters:

roi_ids (array_like) – A list or 1D array of ids of the ROIs. Length is the number of ROIs requested.

Returns:

pixel_masks – List of length number of rois, each element is a 2-D array with shape (number_of_non_zero_pixels, 3). Columns 1 and 2 are the x and y coordinates of the pixel, while the third column represents the weight of the pixel.

Return type:

list

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

Get frame size of movie (height, width).

Returns:

frame_shape – 2-D array: image height x image width

Return type:

array_like

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

Get the original timestamps from the data source.

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

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

Returns:

timestamps – The original timestamps in seconds, or None if not available.

Return type:

np.ndarray or None