roiextractors.extractors.caiman package#

Submodules#

roiextractors.extractors.caiman.caimansegmentationextractor module#

A SegmentationExtractor for CaImAn.

Classes#

CaimanSegmentationExtractor

A class for extracting segmentation from CaImAn output.

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

Bases: SegmentationExtractor

A SegmentationExtractor for CaImAn.

This class inherits from the SegmentationExtractor class, having all its functionality specifically applied to the dataset output from the ‘CaImAn’ ROI segmentation method.

Initialize a CaimanSegmentationExtractor instance.

Parameters:

file_path (str) – The location of the folder containing caiman *.hdf5 output file.

extractor_name = 'CaimanSegmentation'#
installed = True#
is_writable = True#
mode = 'file'#
installation_mesg = 'To use the CaimanSegmentationExtractor install h5py and scipy: \n\n pip install scipy/h5py\n\n'#
__del__()[source]#

Close the h5py file when the object is deleted.

_file_extractor_read()[source]#

Read the h5py file.

Returns:

The h5py file object specified by self.file_path.

Return type:

h5py.File

_image_mask_sparse_read()[source]#

Read the image masks from the h5py file.

Returns:

image_masks – The image masks for each ROI.

Return type:

numpy.ndarray

_background_image_mask_read()[source]#

Read the image masks from the h5py file.

Returns:

image_masks – The image masks for each background components.

Return type:

numpy.ndarray

_trace_extractor_read(field)[source]#

Read the traces specified by the field from the estimates dataset of the h5py file.

Parameters:

field (str) – The field to read from the estimates object.

Returns:

The traces specified by the field.

Return type:

lazy_ops.DatasetView

_raw_trace_extractor_read()[source]#

Read the denoised trace and the residual trace from the h5py file and sum them to obtain the raw roi response trace.

Returns:

roi_response_raw – The raw roi response trace.

Return type:

numpy.ndarray

_correlation_image_read()[source]#

Read correlation image Cn.

_summary_image_read()[source]#

Read summary image mean.

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

static write_segmentation(segmentation_object, save_path, overwrite=True)[source]#

Write a segmentation object to a *.hdf5 or *.h5 file specified by save_path.

Parameters:
  • segmentation_object (SegmentationExtractor) – The segmentation object to be written to file.

  • save_path (str) – The path to the file to be written.

  • overwrite (bool) – If True, overwrite the file if it already exists.

Raises:

FileExistsError – If the file already exists and overwrite is False.

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>#

Module contents#

A Segmentation Extractor for Caiman.

Modules#

caimansegmentationextractor

A Segmentation Extractor for Caiman.

Classes#

CaimanSegmentationExtractor

A class for extracting segmentation from Caiman output.