4D Drift Correction - User Manual
Dragonfly Prototype Apps · Correct 4D Drift (Time-lapse)...
Version 1.0 · 2026-07-31
English Manual
Contents
1. Introduction
2. Reference: first frame or previous frame
3. Accuracy: sub-voxel, and two measured defaults
4. Shifting: interpolated or whole-voxel
5. Channel alignment (tab 2)
6. How to use it
7. Requirements and limits
1. Introduction
4D Drift Correction removes drift that accumulated while a time-lapse 3D image was acquired - stage creep, thermal expansion, specimen settling. Each time point is reduced to intensity projections, its shift relative to a reference frame is measured by phase correlation, and the volume is shifted back.
A projection along z gives the lateral (x, y) drift; a projection along y (or x) gives the axial (z) drift. Each projection contributes only the component it measures best.
This implements the METHOD of Fast4DReg (Pylvänäinen et al., J Cell Sci 2023, https://github.com/CellMigrationLab/Fast4DReg). The code is an independent implementation, not a port: that repository also ships NanoJ-Core (GPL-3.0) and its drift estimation historically derived from NanoJ, which is incompatible with how this plugin is distributed. Phase correlation itself is a textbook technique. Please cite Fast4DReg for the method.
2. Reference: first frame or previous frame
First time point (default): every frame is compared with frame 0. No error accumulation, but it fails once the specimen has drifted so far that it barely overlaps frame 0.
Previous time point: consecutive frames are compared and the per-step shifts are summed cumulatively. This tracks very large total drift, at the cost of accumulating each frame's small error.
Rule of thumb: total drift under a tenth of the field of view - use the first frame; the specimen visibly leaves its starting position - use the previous frame.
3. Accuracy: sub-voxel, and two measured defaults
Sub-voxel refinement defaults to 10, i.e. a tenth of a voxel - note that Fast4DReg is itself sub-pixel in BOTH estimation and application, so sub-voxel accuracy is NOT an advantage of this plugin over it; the advantage is running in-process inside Dragonfly on published Channels. Set it to 1 for whole-voxel estimates.
The axial projection uses MAXIMUM, not average, and that is a measured result: as the specimen drifts along z, structure leaves the volume through the top or bottom slice, which changes an average projection's amplitude and biases phase correlation low - a true 1.0 / 2.0 / 4.8-voxel drift came back as 0.2 / 2.3 / 4.6, while a maximum projection recovered 1.00 / 2.00 / 4.80 on the same data. With a pure wrap-around shift, where no data is lost, both are exact - which is how the bias was traced to content leaving the volume rather than to the estimator.
The axial estimate windows only the lateral axis: a Hann window along the short z axis costs accuracy even when no data is lost at all.
Smoothing is off by default. Drift is physically smooth, so smoothing suppresses estimation noise - but it equally removes genuine fast motion, which on a fast acquisition means silently degrading the data. You have to switch it on deliberately.
4. Shifting: interpolated or whole-voxel
By default a spline (linear or cubic) performs the sub-voxel shift, leaving the least residual drift - but interpolation slightly blurs the data and invents intermediate grey values that were not in the original.
Ticking whole-voxel shifts only rounds the drift to integers and moves whole voxels: every value is preserved exactly (safer for downstream quantification or segmentation), at the cost of up to half a voxel of residual drift. Prefer this for intensity quantification.
Either way, zero-filled margins appear at the edges - unavoidable, because the original data has no content there.
5. Channel alignment (tab 2)
Measures the constant offset between two channels (chromatic aberration, two-camera misalignment), from a calibration slide or from the data itself. It reports dz/dy/dx in voxels and world units, and can apply that offset to every time step of the channel and publish the aligned result.
Do this before any colocalisation analysis: even a single voxel of offset is enough to distort the result.
6. How to use it
1. Publish the time-lapse into the session (the plugin lists published objects only, and labels how many time steps each channel has).
2. Estimate without publishing first: untick "Publish the corrected channel". Look at the drift table and plot on tab 3 and confirm the magnitude is plausible (total drift should not exceed the field of view).
3. Isolated jumps in the curve usually mean those frames had poor signal. Switch the projection to maximum, or enable modest smoothing.
4. When it looks right, tick publish and run again. The corrected 4D channel is published as a new object, and an integer source stays integer instead of becoming float and doubling in size.
5. Tab 3 exports the drift table (voxels + world units, with both the raw and the as-applied drift, so it is always possible to check afterwards what was actually applied) and the plot.
6. Execute All Steps with Current Settings (the big button on tab 1) runs the workflow unattended: estimate and correct the drift, then save the drift table and the plot into the folder tab 3 shows - each step with the settings its own tab shows at the moment you press it. Correcting the drift writes to the session whenever "Publish the corrected channel" is ticked. Channel alignment is a separate tool over the same data, so it is a tick box in that group and is OFF by default. "Browse..." is never used by the run: it takes the output folder exactly as the box reads. No tab is ever disabled and no button is greyed out because an earlier step has not run - a step whose input is missing refuses at its own button and names the step to run first.
7. Requirements and limits
No GPU, no internet, no admin rights and nothing to install: everything runs inside Dragonfly on the bundled numpy/scipy/scikit-image.
Limits: the input must be a published Channel with a time axis (at least 2 time steps); time points are read one at a time, so peak memory is roughly two copies of the volume; only rigid translation is corrected - not rotation, scaling or deformation (that is non-rigid registration; see the Slice Registration plugin).