NumpySegmentationExtractor#
- class NumpySegmentationExtractor(image_masks, raw=None, dff=None, deconvolved=None, neuropil=None, mean_image=None, correlation_image=None, roi_ids=None, roi_locations=None, sampling_frequency=None, rejected_list=None, channel_names=None, movie_dims=None, accepted_list=None)[source]#
Bases:
SegmentationExtractorA Segmentation extractor specified by image masks and traces .npy files.
NumpySegmentationExtractor objects are built to contain all data coming from a file format for which there is currently no support. To construct this, all data must be entered manually as arguments.
Create a NumpySegmentationExtractor from a .npy file.
- Parameters:
image_masks (np.ndarray) – Binary image for each of the regions of interest
raw (np.ndarray) – Fluorescence response of each of the ROI in time
dff (np.ndarray) – DfOverF response of each of the ROI in time
deconvolved (np.ndarray) – deconvolved response of each of the ROI in time
neuropil (np.ndarray) – neuropil response of each of the ROI in time
mean_image (np.ndarray) – Mean image
correlation_image (np.ndarray) – correlation image
roi_ids (int list) – Unique ids of the ROIs if any
roi_locations (np.ndarray) – x and y location representative of ROI mask
sampling_frequency (float) – Frame rate of the movie
rejected_list (list) – list of ROI ids that are rejected manually or via automated rejection
channel_names (list) – list of strings representing channel names
movie_dims (tuple) – height x width of the movie
- property image_dims#
Return the dimensions of the image.
- Returns:
image_dims – The dimensions of the image (num_rois, num_rows, num_columns).
- Return type:
list
- 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#
Returns the center locations (x, y) of each ROI.
- get_roi_ids()[source]#
Get the list of ROI ids.
- Returns:
roi_ids – List of roi ids.
- Return type:
list
- get_frame_shape()[source]#
Get the shape of the video frame (num_rows, num_columns).
- Returns:
frame_shape – Shape of the video frame (num_rows, num_columns).
- Return type:
tuple
- get_num_samples()[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_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