This capsule uses a mix-and-match approach to combine Cellpose, Suite2p, and CaImAn for cell detection and signal extraction.
All parameters are passed to extraction.py using python extraction.py [parameters].
They are defined in parse_args() at the top of extraction.py 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 residual.
The extraction.h5 file contains three groups: traces, rois, and cellpose, with the latter only present if Cellpose is used for initialization (--init). The exact contents further depend on the used --neuropil method, with the bolded fields below always present.
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 everydatavalueshape: 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