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 located in the side bar on the left-hand side of the screen under the dSTORM analysis button, marked below:


  • When to apply drift correction

  • Inputs

  • Outputs

    • View and interpret results

    • Save results

When to apply drift correction

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. Usually, particularly bright spots will show the drift most clearly, as these tend to encompass a greater number of fluorophore blinking events across the acquisition and therefore will spread out over a large number of frames.

To visualise drift in this way select frameIndex in the list of options to color the channel by, 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.


The widget has two sides. The front side has the following buttons:

  • On/Off: Turn DC on or off for comparison (available after DC has been run or a previous DC execution has been loaded)

  • Run: Run a new DC execution with selected parameters

  • Load: Load a previously run DC execution

  • Revert: Go back to default settings for DC

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) and Redundant cross-correlation (RCC) use cross correlation between sets of points accumulated over frames that have been discretised into images.


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 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 results can be loaded and viewed. 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

      Tool view Purpose of the tool CODI Apps operate within a new analysis ecosystem, an enhanced version of the platform. Each App contains a set of powerful analysis tools that enable scientists to create, save and run end-to-end batch analysis ...
    • 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: 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, ...
    • How to guide: Visualization panel

      Tool view Note: the visualisation panel is visible in all current CODI widgets on the left hand side of the screen.   Purpose of tool Enables the user to customise the main view of the dSTORM acquisition. Contents 2D options 3D options Channel ...