← Back to Lab

Imaging Lab

Simulated microscopy with exact ground truth — the forward model behind quantitative digital microscopy, in the browser.

v0.2.0·Updated 2026-07-29
Module
Model & Assumptions Experimental
Model
Per-frame Gaussian steps under a choice of motion model — free Brownian, directed (drift + diffusion), confined in a reflecting corral, or hopping between the compartments of an underlying meshwork. Emitters are rendered with a Gaussian PSF (sigma = 0.21 lambda / NA), each contributing a photon-conserving spot, then Poisson shot noise and Gaussian read noise. A deliberately naive localizer (threshold, local maxima, weighted centroid) recovers the tracks, and their mean-square displacement gives back both the diffusion coefficient and the anomalous exponent α.
Assumptions
  • Overdamped 2D motion, isotropic D
  • No interparticle interaction or hydrodynamics
  • Thin sample; all emitters in the focal plane
  • Periodic boundaries: a particle leaving one edge re-enters at the opposite one (a confined particle never reaches them)
  • Corral and meshwork walls are hard and reflect specularly; the meshwork is a regular square grid with a single hop probability, not a disordered network
Validity
Dilute fields; per-frame step below the PSF width; photon budget above ~100 per frame. Checked live against your inputs below.
Limitations
  • No axial motion or defocus (a later module)
  • No photobleaching or blinking (a later module)
  • The motion models are the ones expressible through DeepTrack2’s own sequential-property mechanism. DeepTrack2 ships no diffusion models itself — it provides Feature.to_sequential(position=rule) and demonstrates free Brownian motion — so each model here is a per-frame update rule and is exported as one.
  • Continuous-time trapping and fractional Brownian motion are not included: both need the whole trajectory history rather than one step at a time
  • Gaussian PSF approximation, not pupil-based — no aberrations. Its FWHM is 3.9% narrower than an ideal Airy pattern at every NA, and 7–12% narrower than DeepTrack2’s numerically sampled pupil PSF; see the validation note below.
  • No motion-blur correction in the MSD fit (Berglund’s −4/3 D dt term is not applied)
References
  • B. Midtvedt, S. Helgadottir, A. Argun, J. Pineda, D. Midtvedt & G. Volpe, Quantitative digital microscopy with deep learning, Appl. Phys. Rev. 8, 011310 (2021), doi:10.1063/5.0034891 — the paper DeepTrack2 asks to be cited by.
  • DeepTrack2 (DeepTrackAI), MIT licence, https://github.com/DeepTrackAI/DeepTrack2 — the reference implementation this module was validated against and exports scripts for. No DeepTrack2 code is vendored here; the forward model is reimplemented in TypeScript.
  • R. E. Thompson, D. R. Larson & W. W. Webb, Precise nanometer localization analysis for individual fluorescent probes, Biophys. J. 82, 2775 (2002), doi:10.1016/S0006-3495(02)75618-X
  • B. Zhang, J. Zerubia & J.-C. Olivo-Marin, Gaussian approximations of fluorescence microscope point-spread function models, Appl. Opt. 46, 1819 (2007), doi:10.1364/AO.46.001819
Notes
Ground truth is exact — it is an input, not a fit. The dashed green markers are where the particles really are; the localizer never sees them. Boundaries are periodic, which is visible in the trajectory trails.

Parameters

Particle & dynamics
Number of independently diffusing emitters.
Diffusion coefficient. It sets the per-frame step, sqrt(2 D Δt) per axis.
How each particle moves. Free Brownian motion is the reference; directed adds a constant velocity; confined traps the particle in a corral; meshwork lets it diffuse freely inside a compartment and only rarely cross into the next one. Watch the anomalous exponent α change as you switch.
Constant velocity added on top of diffusion — flow, or active transport along a filament.
Heading of the drift, measured anticlockwise from the +x axis.
Side of the square corral each particle is trapped in. The MSD stops growing and flattens at L²/3, which is how confinement is recognised in real data.
Spacing of the underlying network — the compartment size set by a membrane skeleton or a crowded matrix. Rounded slightly so a whole number of compartments spans the field.
Chance that a particle meeting a mesh boundary crosses it instead of bouncing back. p = 1 is free diffusion, p = 0 seals every compartment; in between the particle looks free at short lag times and slower at long ones.
Total photons emitted per particle per frame, before detection.
Optics
Incoherent fluorescence imaging. Brightfield, darkfield, iSCAT and holography arrive in a later module.
Objective numerical aperture. It sets the PSF width, and with it the resolution.
Emission wavelength of the fluorophore.
Detector
Camera pixel size referred to the sample plane — the physical size one pixel covers on the sample.
Square field of view, in pixels.
Uniform background photons per pixel per frame — out-of-focus fluorescence and stray light.
Gaussian read-noise standard deviation added by the camera electronics.
Fraction of incident photons converted to photoelectrons.
Sequence
Number of frames in the movie.
Frame interval — the time between consecutive exposures.
Random seed. The same seed reproduces the run exactly, on any machine.
Presets

Crowded field, Fast diffusion and Nyquist-limited pixels deliberately break a validity check — that is the point. Hover a preset to see which one and why.

Setup drawn from the parameters
sample   objective   tube lens camera  

Simulated frame

t = 0.000 s
frame 1 / 100
Overlays

Ground truth is exact — it is an input, not a fit. The localizer never sees it.

Readouts

step per frame
px
PSF FWHM
px
SNR
σ localization
nm
D recovered
µm²/s
α exponent
Validity — checked against your current inputs
Nyquist sampling
Motion blur
Confinement scale
Linking density
Photon budget

Mean-square displacement

Export

PSF cross-section

Export

Localization precision

Export

Export

Run

The TIFF is 16-bit photoelectrons with no display stretch. The Python script reproduces this run in DeepTrack2 — it runs unmodified against a current deeptrack install (pip install deeptrack).

Notes

Ground truth is exact — it is an input, not a fit. The dashed green markers are where the particles really are; the localizer never sees them. Boundaries are periodic, which is visible in the trajectory trails.

Validation. One in-focus emitter rendered by this module was compared with the same emitter rendered by DeepTrack2's own pupil-based Fluorescence optics. The Gaussian approximation σ = 0.21 λ/NA has a FWHM 3.9% narrower than an ideal Airy pattern at every NA — inside the 5% target — while DeepTrack2's numerically sampled pupil sits 2.8% (NA 0.9) to 7.8% (NA 1.4) above that ideal, because it samples the pupil on the output grid. The two therefore differ by 7–12%, of which about 4% is the approximation and the rest is DeepTrack2's discretisation. The comparison runs in CI against a stored fixture.

Definitions. SNR is the peak-pixel ratio peak/√(peak + background + readNoise²). σloc is the Thompson–Larson–Webb estimate. MSD is fitted over the first five lags as 4Dτ + 4σloc², with no motion-blur correction.

References

  • [1]B. Midtvedt, S. Helgadottir, A. Argun, J. Pineda, D. Midtvedt & G. Volpe, Quantitative digital microscopy with deep learning, Appl. Phys. Rev. 8, 011310 (2021), doi:10.1063/5.0034891 — the paper DeepTrack2 asks to be cited by.
  • [2]DeepTrack2 (DeepTrackAI), MIT licence, https://github.com/DeepTrackAI/DeepTrack2 — the reference implementation this module was validated against and exports scripts for. No DeepTrack2 code is vendored here; the forward model is reimplemented in TypeScript.
  • [3]R. E. Thompson, D. R. Larson & W. W. Webb, Precise nanometer localization analysis for individual fluorescent probes, Biophys. J. 82, 2775 (2002), doi:10.1016/S0006-3495(02)75618-X
  • [4]B. Zhang, J. Zerubia & J.-C. Olivo-Marin, Gaussian approximations of fluorescence microscope point-spread function models, Appl. Opt. 46, 1819 (2007), doi:10.1364/AO.46.001819