Fast4DReg is a Fiji macro for drift correction for 2D and 3D video and is able to correct drift in all x-, y- and/or z-directions. Fast4DReg creates intensity projections along both axes and estimates their drift using cross-correlation based drift correction, and then translates the video frame by frame (Figure 1). Additionally, Fast4DReg can be used for aligning multi-channel 2D or 3D images which is particularly useful for instruments that suffer from a misalignment of channels.
Check-out a Napari plugin created by Marcel Issler based on Fast4DReg here
Fast4DReg consists of four scripts, and two sub-menus. The Legacy 2D menu stores estimate and apply functions used in the script. These function are macro callable. NanoJTable IO menu stores functions for opening and saving the NanoJ tables, also macro callable.
time_estimate+apply: This script estimates drift in a 2D or 3D video and applies the correction to the same dataset. Correction can be performed for a single or multiple 2D and/or 3D videos in batch. The script will also output a settings.csv file with relevant script parameters and file paths. This file can be use to correct a similar drift in another dataset, for example another channel.
time_apply: This script will apply a drift correction from settings.csv a to another video with same frame number.
channel_estimate+apply: This script estimates misalignement of channels in a 2D or 3D dataset and applies the correction to the same dataset. Correction can be performed for a single or multiple 2D and/or 3D videos in batch. The script will also output a settings.csv file with relevant script parameters and file paths. This file can be use to correct a similar drift in another dataset.
channel_apply: This script will apply a drift correction from settings.csv a to another multi-channel image.
xy-correction (2D and 3D)
z-correction (3D only)
If using multichannel images, the channels need to be split. The drift will be estimated according to the channel that has more stable structures (for example endothelium instead of migrating cancer cells). The drift correction can then be applied to the second (or more) channels by using the time_apply script.
Figure 1: Fast4DReg pipeline. Fast4DReg corrects for drift in x-y direction by first creating intensity projections to create 2D videos. Then it estimates the linear x-y drift between two images by calculating their cross-correlation matrix and applying the correction to the stack. To correct the drift in the z-direction Fast4DReg creates frontal intensity and corrects the drift as described above. Lateral and axial drift corrections can also be used independently. Fast4DReg outputs a folder containing the corrected images, drift plots, a drift table and a settings file that can be applied to correct another image with the same settings.
Fast4DReg is easy to istall by enabling the Fast4DReg update site:
Fast4DReg is dependent on Bio-Formats, which can be installed through the Fiji update site:
Before starting
Prepare your image to have one channel. If you have multiple channels they can all be in the same folder as separate files.
Running the script
Figure 2: Estimate and apply user interface
In the user interface
Click ok. The script will run.
When the script has completed the process, you will have the following files in a new folder:
The folder will have an unique identifier: fileName + date + experiment number. If you plan to apply the correction to another channel, make sure not to move these files to another folder.
Figure 3: Apply user interface
Select the path to the file to be corrected: Navigate to your image by using Add files.. or drag and drop into the white box. The files can be located in different folders.
Select the settings file (csv.): Navigate to your settings file (called settings.csv).
Select where to save the corrected images: All corrected images will be saved to this folder.
Done!
Importance of file locations
Make sure not to move the drift table from the results folder as the path to the drift table is hardcoded to the settings.csv file.
Result images are black
Try disabling time averaging (1).
Operating system specificity
If you create a settings file with the estimate+apply -script and use it to correct other image by using the apply-script, make sure you use the same operating system (i.g PC, Mac, Linux).
Laine, R. F., Tosheva, K. L., Gustafsson, N., Gray, R., Almada, P., Albrecht, D., Risa, G. T., Hurtig, F., Lindås, A. C., Baum, B., Mercer, J., Leterrier, C., Pereira, P. M., Culley, S., & Henriques, R. (2019). NanoJ: a high-performance open-source super-resolution microscopy toolbox. Journal of physics D: Applied physics, 52(16), 163001. https://doi.org/10.1088/1361-6463/ab0261
Joanna W. Pylvänäinen, Romain F. Laine, Bruno M. S. Saraiva, Sujan Ghimire, Gautier Follain, Ricardo Henriques, Guillaume Jacquemet; Fast4DReg – fast registration of 4D microscopy datasets. J Cell Sci 15 February 2023; 136 (4): jcs260728. doi: https://doi.org/10.1242/jcs.260728
230923 Version 2.1 (the clean 'n fast dimensionalist)
Made compatible with headless execution.
230112 Version 2.1 (the clean 'n fast dimensionalist)
Fast4Dreg code has been cleaned and the RAM saving mode improved. The RAM saving mode now runs significantly faster than before.
221014 Version 2.0 (the dimensionalist)
Fast4DReg runs now independent of NanoJ and is able to correct drift in both, 2D and 3D images.
220222 Version 1.0 (pre-print)
All four scripts have been tested and work well. Ready for pre-print.