Signal extraction

ImagingDataset.extract(rois=None, signal_channel=0, label=None, remove_overlap=True, n_processes=1, demix_channel=None, save_summary=True)

Extracts imaging data from the current dataset using the supplied ROIs file.

Parameters:
  • rois (sima.ROI.ROIList, optional) – ROIList of rois to extract
  • signal_channel (string or int, optional) – Channel containing the signal to be extracted, either an integer index or a name in self.channel_names.
  • label (string or None, optional) – Text label to describe this extraction, if None defaults to a timestamp.
  • remove_overlap (bool, optional) – If True, remove any pixels that overlap between masks.
  • n_processes (int, optional) – Number of processes to farm out the extraction across. Should be at least 1 and at most one less then the number of CPUs in the computer. Defaults to 1.
  • demix_channel (string or int, optional) – Channel to demix from the signal channel, either an integer index or a name in self.channel_names If None, do not demix signals.
  • save_summary (bool, optional) – If True, additionally save a summary of the extracted ROIs.
Returns:

signals – The extracted signals along with parameters and values calculated during extraction. Contains the following keys:

raw, demixed_raw : list of arrays

The raw/demixed extracted signal. List of length num_sequences, each element is an array of shape (num_ROIs, num_frames).

mean_frame : array

Time-averaged mean frame of entire dataset.

overlap : tuple of arrays

Tuple of (rows, cols) such that zip(overlap) returns row, col pairs of pixel coordinates that are in more than one mask. Note: coordinates are for the **flattened* image, so ‘rows’ is always 0s.

signal_channel : int

The index of the channel that was extracted.

rois : list of dict

All the ROIs used for the extraction with the order matched to the order of the rows in ‘raw’. See sima.ROI.todict for details of dictionary format.

timestamp : string

Date and time of extraction in ‘%Y-%m-%d-%Hh%Mm%Ss’ format

Return type:

dict

Details

Methods used to extract signals from an ImagingDataset.