NwbSegmentationExtractor#

class NwbSegmentationExtractor(file_path: str | Path)[source]#

Bases: SegmentationExtractor

An segmentation extractor for NWB files.

Create NwbSegmentationExtractor object from nwb file.

Parameters:

file_path (PathType) – .nwb file location

__del__()[source]#

Close the NWB file.

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

get_images_dict()[source]#

Return traces as a dictionary with key as the name of the ROIResponseSeries.

Returns:

images_dict – dictionary with key, values representing different types of Images used in segmentation: Mean, Correlation image

Return type:

dict

get_roi_locations(roi_ids: Iterable[int] | None = None) ndarray[source]#

Return the locations of the Regions of Interest (ROIs).

Parameters:

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

Returns:

roi_locs – 2-D array: 2 X no_ROIs. The pixel ids (x,y) where the centroid of the ROI is.

Return type:

numpy.ndarray

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_image_shape()[source]#

Get the shape of the video frame (num_rows, num_columns).

Returns:

image_shape – Shape of the video frame (num_rows, num_columns).

Return type:

tuple

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