This capsule combines cellpose and suite2p to perform cell detection and signal extraction.
All parameters are passed to extraction.py using python extraction.py [parameters]
.
All parameters are defined in main using argparse. The most important one is
'input-dir' which should point to a directory that includes an hdf5 file with a 'data' 3D array
of the registered (or, in the case of multi-plane imaging, decrosstalked) movie.
The main output is the extraction.h5
file.
For QC, the figures detected_ROIs.png
and detected_ROIs_withIDs.png
display contours of the detected ROIs over a selection of summary images.
If the capsule is run with the --contour_video
argument, a 10x sped-up video is also created, showing ROI contours overlaid on the raw data, along with ROI activity and the remainder.
The extraction.h5
file contains three groups: traces
, rois
, and cellpose
, with the latter only present if Cellpose is used for detection (--anatomical_only ≠ 0).
traces
:
corrected
: Neuropil-corrected fluorescence tracesroi
: Neuropil-corrupted raw fluorescence traces of each ROIneuropil
: Neuropil fluorescence tracesneuropil_rcoef
: Coefficients used for neuropil correctionraw_neuropil_rcoef_mutualinfo
: Raw coefficients for neuropil correction (minimizing mutual information between corrected and neuropil trace)skew
: Skewness of neuropil-corrected fluorescence tracesstd
: Standard deviation of neuropil-corrected fluorescence traces
rois
:
data
: Values of the (weighted) ROIscoords
: Index locations of everydata
valueshape
: Shape of the ROI array, # neurons x height of FOV (in pixels) x width of FOV (in pixels)neuropil_coords
: Index locations of neuropil masksaspect_ratio
,compact
,footprint
,med
,mrs
,mrs0
,npix
,npix_norm
,npix_norm_no_crop
,npix_soma
,overlap
,radius
,solidity
,soma_crop
: Additional ROI stats, see suite2p documentation
cellpose
:
masks
: Labeled image, where 0=no masks; 1,2,…=mask labels.flows_in_hsv
: XY flow in HSV 0-255flows
: XY flows at each pixelcellprob
: Cell probability at each pixelfinal_locations
: Final pixel locations after Euler integrationstyles
: Style vector summarizing each image
Additional datasets at the root of extraction.h5
are:
iscell
: Specifies whether a ROI is a cell, first column is 0/1, and second column is probability that the ROI is a cell based on the default classifiermeanImg
: The mean image of the movie over timemaxImg
: The maximum intensity projection of the movie over time