Text from the interactive explanation
Defocus-Insensitive Microscopy via Spatial Phase Modulation Using End-to-End Learning
Panu Hildén, Sebastian Kalt, Markus Nyman, Sami Hamriti, Martin Wegener, Carsten Rockstuhl, Andriy Shevchenko
A phase mask about 15 µm deep, printed with a laser and placed inside a microscope, makes the blur look the same at every depth, so one fixed recipe can undo it. Slide the sample through ±10 mm and watch three cameras.
In focus, all three cameras show the smile.
Simulated The three cameras are computed live in your browser from the paper’s diffraction model and its published mask design, with photon shot noise and the paper’s restoration algorithm. The real camera frames are further down, in In the lab.
A needle of light from a ring of zero slope
Every image is assembled from the image of a single point, the point spread function (PSF). In an ordinary microscope that spot is tiny in focus and balloons as the point moves away. Its size and its shape change, so blur at different depths cannot be undone with one recipe. The mask fixes this geometrically.
The mask is a transparent disc 2 mm across whose thickness changes with radius. It sits in the microscope’s Fourier plane , where each radius carries light leaving the sample at one particular angle. Where the surface slopes, light is tilted; the steeper the slope, the bigger the tilt.
The surface is steep almost everywhere except one ring, 0.68 mm from the centre, where it is flat: a stationary point of the phase. Defocus adds a gentle bowl-shaped tilt of its own, and the flat ring simply slides, from radius 0.71 to 0.65 over the whole ±10 mm.
Light through that ring reaches the camera from all around a circle at one common angle. Waves meeting like that form a Bessel beam : a thin bright core with faint rings that stays the same over a long distance. Most of the remaining light is thrown far out as a faint haze.
The price, in this model: with the mask only about 1% of a point’s light lands inside the radius of an in-focus spot, and the rest spreads into rings. An ordinary microscope puts 84% there in focus, but about 5% at 4 mm and under 1% at 10 mm. Masked frames look hazy, but equally hazy at every depth, and that is what makes them restorable.
Measured, too
To measure the real PSF, the team imaged a 5 µm pinhole lit from behind and moved it along the axis in 0.5 mm steps. With the printed mask in place, the measured PSF has the expected Bessel-like line, confirming the extended depth of field. The inset shows the measurement without the mask: a short spot. The small brightness ripple along the line comes from interference between light through the flat ring and light diffracted at the mask’s edge; it is slightly shifted relative to theory but averages out in the restoration.
MeasuredFig. 3b of Hildén et al., ACS Photonics 2026, CC BY 4.0; cropped.
Design the mask and the recipe together
Which mask is best? Judging the PSF alone does not say whether the final image suffers more from a weak response to fine detail or from blur that still changes with depth. So the authors simulated the whole chain, from blur and shot noise to restoration, on thousands of images and tuned the mask and the restoration settings together to make restored images match the originals. Here is a miniature version you can steer by hand.
mean error —
Mask height profile
Light from one point vs depth
Restored test pattern at five depths, and its error
Error L is the paper’s loss (Eq. 16): half the mean pixel difference plus half of one minus the structural similarity (SSIM). Lower is better; 0 is a perfect match. Flat bars mean the mask works equally well at every depth.
Miniature model: 128 × 128 images of one test pattern, 5 restoration iterations (as in the paper’s training), fixed restoration settings and equal depth weights. The paper optimized 20 polynomial coefficients jointly with the restoration parameters on 3,200 ImageNet-Sketch images, with the ADAM optimizer in TensorFlow (111 epochs for the mask, then 74 epochs jointly).
Undo the blur without knowing the depth
Richardson–Lucy deconvolution sharpens images degraded by shot noise , the graininess of counting individual photons. Each round blurs the current guess with a model PSF, compares it with the camera frame and corrects the guess. Here the model PSF is the same at every depth: the average of the system’s blur over the whole ±10 mm range.
The speed-up comes from the Wiener–Butterworth back projector: it boosts the mid and fine details the blur suppressed and then rolls off before noise takes over.
Measured tiles: Hildén et al., ACS Photonics 2026, Fig. 4c,d, CC BY 4.0; cropped and rearranged. Restoration on this page uses α = 10⁻², β = 10⁻³, γ = 10 with equal depth weights. The paper starts from α = β = 10⁻³, γ = 10 and optimizes them, but does not list the final values.
Printed with two photons
The mask is a transparent landscape 2 mm wide. Its height has to follow the design to a fraction of a wavelength across a 15 µm range. It was 3D-printed by two-photon grayscale lithography (2GL) on a Nanoscribe Quantum X.
A femtosecond laser is focused into a liquid photoresist (IP-S). The resin hardens only where it absorbs two photons at once, which happens only in the tiny, intensely bright focal spot. The focus therefore writes solid material point by point, in three dimensions.
The part is cut into 1 µm slices, and each slice is filled with back-and-forth hatch lines 0.2 µm apart, scanned at 20 cm/s. In grayscale mode the laser power changes on the fly, here between 8 and 50 mW. More power hardens a taller voxel, so the surface can end between slice planes instead of in 1 µm terraces. The 2 mm disc is larger than one print field, so neighbouring fields are stitched together.
Print, measure, correct, print again
Printing leaves small systematic deviations from the designed height. The team measured the printed surface, fed those deviations back into the design (precompensation) and printed again, then repeated the loop a second time.
After two rounds the surface deviates from the design by 118.9 nm on average (standard deviation 190.1 nm), far below the 633 nm wavelength. In optical terms, 119 nm of resin with refractive index ≈ 1.5 delays the light by about a tenth of a wavelength.
In the lab
The real microscope (objective f₁ = 45 mm, tube lens f₂ = 200 mm, 633 nm LED) imaging smile patterns etched into a thin aluminium film on glass. The sample rides a translation stage through ±10 mm.
Left: (b) no mask, centre fiber in focus. Right: (e) with the mask, restored.
What it buys, what it costs
The paper reports a working, practical route to defocus-insensitive microscopes, along with the price paid and the knobs that change it.
Depth for detail
Only spatial frequencies up to about 0.7 of the diffraction limit pass, because the flat ring sets an effective aperture of s·NA. The demonstrator’s low numerical aperture (≈ 0.022) also makes restored lines wider than in the high-resolution reference.
Haze, not loss
A phase mask absorbs no light. It redistributes it: brightness that would form a sharp spot is spread into rings, so raw frames look hazy and need restoration. Because the haze barely changes with depth, one restoration fits all depths.
Real time is within reach
Each iteration is dominated by FFTs of a 2048 × 2048 padded image, about 10 ms each on an ordinary laptop, and quality stopped improving after about 15 iterations.
Round, on purpose
A circularly symmetric mask gives a real-valued optical transfer function. Radially asymmetric masks can also flatten the blur’s strength over depth, but their transfer function’s phase varies and leaves artifacts in restored images.
All visible colours
The Bessel-like PSF was shown at 633 nm, and the authors observed that it holds across the whole visible spectrum, as the theory and the resist’s optical properties predict.
Next
The same end-to-end framework could train a neural network for restoration. And since the cutoff frequency shifts linearly with defocus, the Fourier transform of an image could reveal how far away the object is.
Scale it up
±10 mm is far more depth than most microscopy needs. A higher-NA objective gives finer detail but shrinks the window, since defocus enters as u = k₀·Δz·NA²/2 (Eq. 3). The gain over an ordinary microscope stays the same (paper’s conclusion).
The paper
Defocus-Insensitive Microscopy via Spatial Phase Modulation Using End-to-End Learning. Panu Hildén, Sebastian Kalt, Markus Nyman, Sami Hamriti, Martin Wegener, Carsten Rockstuhl, Andriy Shevchenko. ACS Photonics (2026). doi:10.1021/acsphotonics.6c01233. Open access under CC BY 4.0.
Measured
Figures 3a, 3b, 4a–d and 5 are the authors’ measurements, reproduced under CC BY 4.0. They are cropped and, for Fig. 4, cut into individual tiles and rearranged into a stepper and comparison strips.
Simulated
Live images are this page’s re-implementation of the paper’s Fresnel PSF (Eq. 4), shot-noise model (Eq. 10), Richardson–Lucy restoration with a Wiener–Butterworth back projector (Eqs. 11–15) and loss (Eq. 16), using the 20 published mask coefficients. Simplifications: 256² or 128² images, fixed restoration settings with equal depth weights, refractive index of IP-S taken as ≈ 1.5. Fig. 4e is the authors’ own simulation.
Illustration
The optical-bench rail, the ray sketch and the printing animation are schematics, not to scale. The test patterns in the simulations imitate the paper’s smile targets and fibers; their sizes are read from the figure scale bars.
Typefaces: Instrument Serif and IBM Plex (SIL Open Font License).
Topics in this iPaper
Physics
using the Fresnel diffraction integral, the shape of the PSF
Results and Discussion, Defocus-Insensitive Microscope, page C, Eq. 4
Engineering
The phase mask printing was performed with a Nanoscribe Quantum X system
Results and Discussion, Experiments, page E
Computer science
The optimization is implemented in Python using the TensorFlow package.
Results and Discussion, Optimization Procedure, page E
optical microscopy
In optical microscopy, high spatial resolution comes at the cost of a short depth of field.
Abstract, page A
depth of field
the measured PSF exhibits the expected Bessel-like structure, confirming the extended depth of field
Results and Discussion, Experiments, page F
phase masks
contains a circularly symmetric phase mask designed to enable deconvolution-based image restoration
Introduction, page B
two photon grayscale lithography
the phase mask was manufactured using two-photon grayscale lithography (2GL)
Results and Discussion, Experiments, page E
image deconvolution
restored using a Richardson-Lucy deconvolution algorithm accelerated by a Wiener-Butterworth back projector
Conclusions, page G
end to end learning
We leverage end-to-end machine learning tools to design this phase mask
Abstract, page A
bessel beams
This results in a PSF resembling a Bessel beam
Figure 1 caption, page B