How to guide: Drift correction

How to guide: Drift correction

Tool view


Purpose of tool

This tool attempts to correct for the drift that occurs during an acquisition. Without this correction the resolution of the sample is degraded which will affect visual quality as well as downstream analysis.

The drift correction (DC) tool is usually the first icon located on the left-hand side of the screen.

When to apply drift correction

It is always good to run drift correction on every single molecule localisation microscopy acquisition. 

When the drift is very large, it can be easy to spot as the image appears smeared in the visualiser. When this is not the case, it can be useful to visualise the localisations coloured by frame index as shown in the image below. 

To visualise drift in this way select  Frame in the list of options to colour the channel, this will automatically select the Rainbow colour map. It is worth checking for drift on even relatively small length scales (sub-100nm), as the algorithm is often able to correct even for this if density is sufficient, and can improve analysis results if the experiment is sensitive to such length scales. In certain edge cases (particularly for sparse datasets) drift correction may fail. Always make sure to validate the results visually before continuing the analysis.

How to run the drift correction

Click on the Run button to start the Drift Correction. 

The Run button will then spin and the tool turn blue during the analysis

Once finished the run button will turn into a checkmark and the tool will be green. 

You can load settings from a specific App that you have run before. While this may seem unnecessary because no parameters have been set, the three dots next to it will show the back panel where some parameters of the drift correction can be changed. 

The back panel of the widget allows the user to choose which type of algorithm they would like to use. Currently there are three methods, Drift correction at minimum entropy (DME) is an entropy minimization method inspired by this paper from Cnossen et al. Direct cross-correlation (DCC), which is the method used in NimOS, and Redundant cross-correlation (RCC) use cross correlation between sets of points accumulated over frames that have been discretised into images. RCC is available as a Python script for NimOS. 

Note that DME is the default method and performs the best across datasets we have tested. DME does not require any parameters to be set. The main reason why DCC and RCC are present is for continuity with how the data could have been analysed in NimOS. 
The number of windows parameter only applies to the cross correlation methods (RCC and DCC).

Between the cross correlation methods it is worth noting that RCC is considered to be a more robust; however, it takes longer to run and processing time scales quadratically with the number of windows used in the algorithm.

The selection of the number of windows can be set automatically or selected manually.

  • If set to auto, the algorithm will keep adding frames together into a single window until 400,000 localisations have accumulated, and then perform a cross correlation between the windows using either DCC or RCC. There is also a minimum cutoff in the number of windows such that if there are less than 800,000 points (the minimum required to create two windows of 400,000 points each), the algorithm will simply use 2 windows and split up the number of points equally in each window .

  • If set to manual, the user can input the number of windows they would like to use manually and the algorithm will split the points equally into that number of windows.

Some experimentation with the number of windows may be needed to find an optimal result, the optimal number of windows can vary greatly depending on the density of the dataset and nature of the drift. Typically, if the drift is highly non-linear across the acquisition, a larger number of windows will be required to correct it. If the drift is linear over the acquisition, with the drift artifacts presenting as straight lines with smoothly varying frame index, a smaller number of windows can give better results.


View and interpret results

Once a drift correction execution has been successfully run, the  Visualising drift corrected points  toggle allows the user to see the data with and without drift correction applied. When corrected, the individual points in the visualiser will have their positions corrected and the value of the drift in the x and y dimensions is shown in the chart on the front side of the widget.

The axes of the plots can be changed using the symbol shown below

Download results

The plots from DC can be downloaded in several formats as shown below.


  • SVG and PNG are image formats that download the plots

  • JSON and CSV contains the drift per frame in x and y in text formats

For continued analysis on CODI, it is not necessary to download the drift correction results. Instead, subsequent tools will automatically detect any drift correction loaded at the time of execution.  

    • Related Articles

    • How to guide: CODI Apps and Batch Analysis

      Welcome to CODI Apps and Batch Analysis CODI Apps and Batch Analysis is an enhanced version of the CODI platform that unlocks faster and more customized analysis pipelines. Each App contains a set of powerful analysis widgets that enable scientists ...
    • How to guide: Counting tool

      Tool view Purpose of tool Counts the number of localisations or ‘bins’ by channel around a set of centre points - currently the centroids of a clustering result. Contents Inputs Results Outputs Inputs The centre points for counting come from a loaded ...
    • How to guide: Visualization panel

      For the moment CODI is only able to display super-resolution microscopy data, meaning images create from localizations of blinking event. For the visualisation or analysis of raw images, such as brightfield, widefield or tracking, please us NimOS or ...
    • How-to-guide: Temporal grouping tool

      Tool view Purpose of tool  In localisations-based super-resolution microscopy, each fluorescent molecule can emit ("blink") multiple times, depending on its properties and the super-resolution technique used. Those blinking events are localized ...
    • How-to-guide: How to share and organize your data

      Tool View Purpose of tool CODI is a Collaborative Discovery platform to share your data and analyses with colleagues and the public, opening up new possibilities for cross dataset insights. Using our tool Collaborations you will be able to organize, ...