Skip to content

NoRMCorre

Compute Credits

This tool uses 2.0 compute credits per hour.

Overview

NoRMCorre1 (Non-Rigid Motion Correction) is a motion correction algorithm that can be used to perform rigid or piecewise rigid motion correction based on template matching. The code is open source and available as part of the CaImAn2 computational toolbox.

Inputs

The workflow supports individual movies and movie series. Once the input movie is selected, an optional parameter file may be selected and used to override the parameters specified in the analysis table. The input files and processing parameters are listed in the table below.

Parameters

Parameter Required? Default Description
Movie(s) True N/A Single movie file or movie series (isxd, tif, tiff, avi)
Optional Parameters File False N/A JSON file containing CaImAn processing parameters
Overwrite Analysis Table Parameters True False If True and a parameters file has been selected, the analysis table columns will be overwritten by the values contained in the parameters file.
fr False auto Imaging rate in frames per second. If set to 'auto', the frame rate will be automatically determined based on file metadata. If no such metadata is available, CaImAn will default to 30 frames per second.
min_mov False auto Estimated minimum pixel value in the input movie. When set to 'auto', it will automatically be estimated using the first 400 frames. This value will be used to construct a non-negative output.
shifts_opencv False True If True, bicubic interpolation will be used for correcting motion. If False, Fourier transform interpolation will be used.
nonneg_movie False True If True, 'min_mov' will be removed from the data to produce an output movie and template that are mostly non-negative.
gSig_filt False N/A Size of the kernel used for high-pass spatial filtering of the data. If unspecified, no spatial filtering will be performed during motion correction. Applying a high-pass spatial filter may improve performance on 1P data by delineating edges and sharpening the images. Such filtering may not be needed for 2P data and could be left unspecified.
border_nan False copy Strategy for handling NaN values along the boundaries. 'True' will allow NaN values along the boundaries, 'False' will replace any NaN with 0, 'copy' will replace any NaN with the value of the nearest data point, and 'min' will replace any NaN with the minimum value in the image.
num_frames_split False 80 Number of frames in each batch when splitting the movie for parallel processing
is3D False False Set to True if the input data consists of a 3D recording
max_shifts False 6 Maximum rigid shift per dimension in pixels
niter_rig False 1 Maximum number of iterations during rigid motion correction. If set to 0, it will quickly initialize a template with the first frame of the movie.
splits_rig False 14 Number of temporal chunks to use for parallelizing rigid motion correction
num_splits_to_process_rig False N/A Specifies the number of temporal chunks to process in each iteration. If left unspecified, all chunks will be processed at once.
pw_rigid False True If True, piecewise-rigid motion correction will be performed. If False, rigid motion correction will be performed.
strides False 48 The stride controls the shift in pixels between patches of the field of view during piecewise-rigid registration
overlaps False 24 Overlap between patches in pixels during piecewise-rigid motion correction
splits_els False 14 Number of temporal chunks to use for parallelizing piecewise-rigid motion correction
upsample_factor_grid False 4 Upsampling factor to use for per-patch shifts to avoid smearing when merging patches
max_deviation_rigid False 3 Maximum deviation in pixels between rigid shifts and shifts of individual patches
n_processes False 7 Number of processes used to analyze patches in parallel
Output Movie Format False auto File format to use when saving the output motion-corrected movie. If set to 'auto', the file format will match the input files.

Optional Parameters File Format

A json file may be uploaded to IDEAS and used to specify CaImAn's processing parameters. To override the analysis table parameters with the parameters specified in the json file supplied, the Overwrite Analysis Table Parameters parameter must be set to True. A sample parameter file is included below for reference.

Sample Parameters File

normcorre_parameters.json

{
    "data": {
        "fr": 10
    },
    "motion": {
        "pw_rigid": true,
        "max_shifts": [5, 5],
        "gSig_filt": [3, 3],
        "strides": [48, 48],
        "overlaps": [24, 24],
        "max_deviation_rigid": 3,
        "border_nan": "copy"
    }
}

Outputs

Motion-Corrected Movie

Output movie in the format specified via the Output Movie Format parameter (isxd, tiff, avi).

Motion Correction Quality Assessment

A single .csv file containing rigid and piecewise rigid shifts measurements.

Sample

First 5 rows of the motion correction quality assessment data.

Column Description

Column Name Description
movie_index 0-based index corresponding to the movie file
movie_frame_index 0-based index corresponding to the frame number within a given movie file
series_frame_index 0-based index corresponding to the frame number within the series when considering frames across all input files
x_shifts_rig Rigid shift in pixels along the x-axis
y_shifts_rig Rigid shift in pixels along the y-axis
x_shifts_els Rigid shift in pixels along the x-axis within each patch of the field of view
y_shifts_els Rigid shift in pixels along the y-axis within each patch of the field of view

Note that the columns x_shifts_els and y_shifts_els will only be present when piecewise rigid motion correction is performed, i.e. when the parameter pw_rigid is set to True.

Previews

Rigid shifts of the entire field of view detected by NorMCorre along the x-axis (top, blue) and y-axis (bottom, orange).
Piecewise rigid shifts detected by NorMCorre along the x-axis (top) and y-axis (bottom). Each color represents the shifts within a given patch of the field of view.

Next Steps

After motion correction has completed, cell identification can be performed. If you wish to use CNMF-E for cell identification, you may apply the algorithm directly to the motion-corrected data. If you wish to use PCA-ICA for cell identification, the motion-corrected movie will first need to be normalized using the ΔF/F tool.