Skip to content

End-to-End CNMF-E

Compute Credits

This tool uses 2.0 compute credits per hour.

The CNMF-E workflow can be used to perform automated source extraction from microendoscopic calcium imaging movies. The workflow consists of several processing steps that aim to retrieve the spatial location and temporal dynamics of neurons in a fluorescent 1-photon calcium imaging movie along with the corresponding neural events.

Inputs

Parameter Required? Default Description
Input Movie Files True N/A path to the input isxd movie files
Temporal Downsample Factor True 2 Factor by which the movie is to be temporally downsampled
Spatial Downsample Factor True 2 Factor by which the movie is to be spatially downsampled
Reference Image False N/A path to the reference image
Cropping Vertices False N/A A list of 4 values representing the coordinates of the top-left corner, width, and height of the area to crop: [top_left_x, top_left_y, width, height].
Fix Defective Pixels True True If True, check for defective pixels and correct them
Trim Early Frames True True If True, remove early frames that are usually dark or dim
Low Cutoff False 0.005 Low cutoff frequency of the spatial filter. If left blank, no low cutoff frequency is used
High Cutoff False 0.5 High cutoff frequency of the spatial filter. If left blank, no high cutoff frequency is used
Retain Mean True False If True, retain the mean pixel intensity for each frame (the DC component)
Subtract Global Minimum True True If True, each frame is subtracted from the global minimum pixel intensity computed across the entire movie. By doing this, all pixel intensities will stay positive valued
Max Translation True 20 The maximum translation allowed by motion correction in pixels.
Low Bandpass Cutoff False N/A Boolean values; If not None, the low cutoff of the spatial filter is applied to each frame prior to motion estimation
High Bandpass Cutoff False N/A If not None, the high cutoff of the spatial filter is applied to each frame prior to motion estimation
ROI False N/A ROI vertices for motion estimation. Input should be a Nx2 array enclosed within a string, where N is the number of vertices. For example “[[23,45],[34,95],[120,234],[250,334]]”. The (0,0) coordinate is the top-left corner of the input movie. If input is empty, the algorithm will use the entire frame
Global Registration Weight True 1 When set to 1, only the reference frame is used for motion estimation. When less than 1, the previous frame is also used for motion estimation. The closer to 0, the more the previous frame is used and the less the reference frame is used.
Cell Diameter True 7 Average cell diameter of a representative cell in pixels
Minimum Correlation True 0.8 Minimum correlation of a pixel with its immediate neighbors when searching for new cell centers
Minimum Peak-to-Noise Ratio True 10 Minimum peak-to-noise ratio of a pixel when searching for new cell centers.
Background Spatial Subsampling True 2 Spatial downsampling factor to use when estimating the background activity
Ring Size Factor True 1.4 Multiple of the average cell diameter to use for computing the radius of the ring model used for estimating the background activity
Gaussian Kernel Size True 0 Width in pixels of the Gaussian kernel used for spatial filtering of the movie before cell initialization (automatically estimated when the value provided is smaller than 3)
Closing Kernel Size True 0 Size in pixels of the morphological closing kernel used for removing small disconnected components and connecting small cracks within individual cell footprints (automatically estimated when the value provided is smaller than 3)
Merge Threshold True 0.7 Temporal correlation threshold for merging cells that are spatially close
Processing Mode True parallel_patches Processing mode for CNMF-E
Number of Threads True 4 Number of threads to be used for running the CNMF-E algorithm
Patch Size True 80 Side length of an individual square patch within the field of view in pixels
Patch Overlap True 20 Amount of overlap between adjacent patches in pixels
Output Unit Type True df_over_noise Units of the output temporal traces
Threshold True 5 The threshold in median-absolute-deviations that the trace has to cross to be considered an event.
Tau True 0.3 The minimum time in seconds that an event has to last in order to be considered.
Event Time Reference True beginning The temporal reference that defines the event time.
Ignore Negative Transients True True A boolean parameter that dictates whether to include or exclude negative transients for event detection

File Inputs

Source Parameter File Type File Format
Input Movie Files miniscope_movie isxd
Reference Image miniscope_image isxd

Below is a summary of the processing stages used in the CNMF-E workflow along with recommended processing settings.

Step 1: Preprocess

It is recommended that data be downsampled temporally to 10 Hz or below and spatially downsampled by a factor of 2 to 4. The current implementation of CNMF-E performs deconvolution of temporal dynamics using the OASIS algorithm with an autoregressive model of order 1, which is appropriate for data recorded at up to 10 Hz. Higher-frequency data may not be adequately deconvolved using low-order models in noisy regimes. Spatial downsampling of the data will help blur away minor spatial fluctuations and significantly reduce processing time and memory usage.

Step 2: Spatial Bandpass Filter

It is recommended to apply spatial bandpass filtering with global mean subtraction to remove low spatial frequency content and out-of-focus cells. The removal of high spatial frequencies will reduce noise by smoothing the movie images.

Step 3: Motion Correct

No changes to the typical settings are necessary for motion correction when using CNMF-E. The removal of motion artifacts will help ensure that the spatial location of cells identified by CNMF-E is confined to their precise positions as opposed to the pixels visited by their respective cell body over time. This will in turn ensure that the temporal dynamics extracted for each cell are due to fluctuations in the fluorescent reporter and not cellular displacements.

Step 4: CNMF-E

Our Parameter Setting Tips page can be consulted to gain insights and tips to fine-tune CNMF-E parameters to optimize performance.

Step 5: Detect Events