roiextractors.extractors.suite2p package#
Submodules#
roiextractors.extractors.suite2p.suite2psegmentationextractor module#
A segmentation extractor for Suite2p.
Classes#
- Suite2pSegmentationExtractor
A segmentation extractor for Suite2p.
- class Suite2pSegmentationExtractor(folder_path: str | Path, channel_name: str | None = None, plane_name: str | None = None, combined: bool | None = None, plane_no: int | 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).
- extractor_name = 'Suite2pSegmentationExtractor'#
- installed = True#
- is_writable = False#
- mode = 'folder'#
- installation_mesg = ''#
- classmethod get_available_channels(folder_path: str | Path)[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)[source]#
Get the available plane names from the folder produced by Suite2p.
- Parameters:
file_path (PathType) – Path to Suite2p output path.
- Returns:
plane_names – List of plane names.
- Return type:
list
- _load_npy(file_name: str, mmap_mode=None, transpose: bool = False)[source]#
Load a .npy file with specified filename. Returns None if file is missing.
- Parameters:
file_name (str) – The name of the .npy file to load.
mmap_mode (str) – The mode to use for memory mapping. See numpy.load for details.
transpose (bool, optional) – Whether to transpose the loaded array.
- Return type:
The loaded .npy file.
- get_num_frames() int [source]#
Get the number of frames in the recording (duration of recording).
- Returns:
num_frames – Number of frames in the recording.
- Return type:
int
- get_accepted_list()[source]#
Get a list of accepted ROI ids.
- Returns:
accepted_list – List of accepted ROI ids.
- Return type:
list
- get_rejected_list()[source]#
Get a list of rejected ROI ids.
- Returns:
rejected_list – List of rejected ROI ids.
- Return type:
list
- _correlation_image_read()[source]#
Read correlation image from ops (settings) dict.
- Returns:
img – The correlation image.
- Return type:
numpy.ndarray | None
- property roi_locations#
Returns the center locations (x, y) of each ROI.
- get_roi_pixel_masks(roi_ids=None)[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_image_size()[source]#
Get frame size of movie (height, width).
- Returns:
no_rois – 2-D array: image height x image width
- Return type:
array_like
- _abc_impl = <_abc._abc_data object>#
- static write_segmentation(segmentation_object: SegmentationExtractor, save_path: str | Path, overwrite=True)[source]#
Write a SegmentationExtractor to a folder specified by save_path.
- Parameters:
segmentation_object (SegmentationExtractor) – The SegmentationExtractor object to be written.
save_path (str or Path) – The folder path where to write the segmentation.
overwrite (bool) – If True, overwrite the folder if it already exists.
- Raises:
AssertionError – If save_path is not a folder.
FileExistsError – If the folder already exists and overwrite is False.
Notes
The folder structure is as follows: save_path └── plane<plane_num>
├── F.npy ├── Fneu.npy ├── spks.npy ├── stat.npy ├── iscell.npy └── ops.npy
Module contents#
A segmentation extractor for Suite2p.
Modules#
- suite2psegmentationextractor
A segmentation extractor for Suite2p.
Classes#
- Suite2pSegmentationExtractor
A segmentation extractor for Suite2p.