Seminar 5 — Superresolution Techniques

Introduction

This seminar explores advanced microscopy techniques that break the diffraction limit. You will work through confocal microscopy, STED, localization microscopy (PALM/STORM), SIM, and two-photon microscopy.


Problem 1: Confocal PSF and Resolution Improvement

Problem Statement:

In confocal microscopy, the point-spread function (PSF) is the product of the excitation PSF and the detection PSF (after the pinhole):

\[\text{PSF}_{\text{confocal}}(r) = \text{PSF}_{\text{exc}}(r) \cdot \text{PSF}_{\text{det}}(r)\]

Assuming both PSFs are Gaussian with the same standard deviation \(\sigma_0\), show that the confocal PSF has standard deviation \(\sigma_c = \sigma_0/\sqrt{2}\).

a) Derive the expression for \(\sigma_c\) in terms of \(\sigma_0\).

b) Calculate the resolution improvement factor: how much better is confocal resolution compared to wide-field microscopy?

c) If the excitation wavelength is λ = 405 nm, NA = 1.4, and wide-field FWHM ≈ 0.51λ/NA, calculate the confocal FWHM.


Problem 2: STED Resolution

Problem Statement:

In Stimulated Emission Depletion (STED) microscopy, fluorophores in the periphery of the excitation spot are driven to the dark state by a high-intensity depletion laser. The effective PSF is narrowed:

\[d = \frac{d_0}{\sqrt{1 + I/I_{\text{sat}}}}\]

where \(d_0\) is the diffraction-limited FWHM, \(I\) is the depletion intensity, and \(I_{\text{sat}}\) is the saturation intensity.

a) Calculate the effective FWHM for depletion intensities \(I/I_{\text{sat}} = 1, 10, 100\).

b) Plot \(d\) vs. \(I/I_{\text{sat}}\) (log-log scale) to visualize how resolution improves with depletion power.

c) Assume \(d_0 = 250\) nm. What depletion intensity ratio is needed to achieve 50 nm resolution?

Code
# STED resolution calculation
d0 = 250  # nm, diffraction-limited FWHM

# Depletion intensity ratios
I_ratio = np.array([1, 10, 100])
d_sted = d0 / np.sqrt(1 + I_ratio)

print("STED Resolution vs. Depletion Intensity")
print("=" * 50)
for ir, d in zip(I_ratio, d_sted):
    print(f"I/I_sat = {ir:3d}  →  d = {d:.1f} nm")

# Part c): find I/I_sat for d = 50 nm
d_target = 50  # nm
I_ratio_target = (d0 / d_target)**2 - 1
print(f"\nFor d = {d_target} nm: I/I_sat = {I_ratio_target:.1f}")
STED Resolution vs. Depletion Intensity
==================================================
I/I_sat =   1  →  d = 176.8 nm
I/I_sat =  10  →  d = 75.4 nm
I/I_sat = 100  →  d = 24.9 nm

For d = 50 nm: I/I_sat = 24.0

Now plot the full curve:

Code
# Generate continuous curve for plotting
I_ratio_plot = np.logspace(0, 3, 100)  # 1 to 1000
d_plot = d0 / np.sqrt(1 + I_ratio_plot)

fig, ax = plt.subplots(figsize=get_size(12, 8))
ax.loglog(I_ratio_plot, d_plot, 'b-', linewidth=2, label='STED resolution')
ax.loglog(I_ratio, d_sted, 'ro', markersize=7, label='Calculated points')
ax.axhline(y=50, color='g', linestyle='--', alpha=0.7, label='Target: 50 nm')
ax.grid(True, which='both', alpha=0.3)
ax.set_xlabel(r'Depletion intensity $I/I_{\mathrm{sat}}$')
ax.set_ylabel(r'Effective FWHM $d$ (nm)')
ax.legend(fontsize=8)

plt.savefig('img/sted_resolution.png', dpi=150, bbox_inches='tight')
plt.close()
print("Figure saved to img/sted_resolution.png")
Figure saved to img/sted_resolution.png

Problem 3: Localization Precision (Thompson Formula)

Problem Statement:

The fundamental limit to localization precision in single-molecule microscopy is given by the Thompson formula:

\[\sigma = \frac{s}{\sqrt{N}} + \frac{a^2}{12N}\]

where \(s\) is the PSF standard deviation, \(N\) is the number of detected photons, and \(a\) is the pixel size. The first term dominates for large \(N\).

a) Derive why photon shot noise leads to an uncertainty proportional to \(1/\sqrt{N}\).

b) For a 250 nm PSF (\(s = 250/2.355 \approx 106\) nm) and pixel size \(a = 100\) nm, calculate how many photons are needed for 10 nm localization precision.

c) Modern single-molecule experiments detect \(N \approx 1000\) photons. What precision is achievable?

Code
# Thompson formula
s = 106  # nm, PSF std dev (250 nm FWHM / 2.355)
a = 100  # nm, pixel size
sigma_target = 10  # nm, target precision

# Part b): solve for N
# sigma = s/sqrt(N) + a²/(12N), assume first term dominates
N_needed = (s / sigma_target)**2

print("Localization Precision Calculation")
print("=" * 50)
print(f"PSF std dev s = {s} nm")
print(f"Pixel size a = {a} nm")
print(f"Target precision σ = {sigma_target} nm")
print(f"\nPhotons needed for {sigma_target} nm precision:")
print(f"  N ≥ {N_needed:.0f} photons")

# Part c): N = 1000
N_typical = 1000
sigma_typical = np.sqrt((s**2 / N_typical) + (a**2 / (12 * N_typical)))
print(f"\nWith N = {N_typical} photons:")
print(f"  σ = {sigma_typical:.1f} nm")
Localization Precision Calculation
==================================================
PSF std dev s = 106 nm
Pixel size a = 100 nm
Target precision σ = 10 nm

Photons needed for 10 nm precision:
  N ≥ 112 photons

With N = 1000 photons:
  σ = 3.5 nm

Problem 4: Monte Carlo PALM/STORM Simulation

Problem Statement:

Implement a simplified PALM/STORM simulation:

  1. Generate random fluorophore positions in a region
  2. In each frame, only ~1% of fluorophores are in the “ON” state (blinking)
  3. For each ON fluorophore, simulate detected photon shot noise
  4. Fit a 2D Gaussian to localize each detected photon cluster
  5. Reconstruct the superresolution image by plotting localized positions
  6. Compare with diffraction-limited image (convolved with PSF)
Code
from scipy.ndimage import gaussian_filter
from scipy.optimize import curve_fit

# Set random seed for reproducibility
np.random.seed(42)

# Simulation parameters
n_fluorophores = 200
n_frames = 500
n_photons_per_event = 800  # typical single-molecule event
on_fraction = 0.01  # 1% ON per frame
pixel_size = 10  # nm
psf_sigma = 106  # nm, corresponding to ~250 nm FWHM
image_size = 2000  # nm

print("PALM/STORM Simulation Setup")
print("=" * 50)
print(f"Number of fluorophores: {n_fluorophores}")
print(f"Number of frames: {n_frames}")
print(f"Image size: {image_size} × {image_size} nm²")
print(f"Pixel size: {pixel_size} nm")
print(f"PSF σ: {psf_sigma} nm")

# Generate random fluorophore positions
positions = np.random.uniform(0, image_size, (n_fluorophores, 2))

# Define 2D Gaussian for fitting
def gaussian_2d(xy, x0, y0, sigma, amplitude, bg):
    x, y = xy
    g = amplitude * np.exp(-((x - x0)**2 + (y - y0)**2) / (2 * sigma**2)) + bg
    return g.ravel()

# Simulate PALM/STORM
localized_positions = []

for frame in range(n_frames):
    # Decide which fluorophores are ON
    on_indices = np.where(np.random.rand(n_fluorophores) < on_fraction)[0]

    if len(on_indices) == 0:
        continue

    for idx in on_indices:
        x_true, y_true = positions[idx]

        # Draw photon count with Poisson noise
        n_photons = np.random.poisson(n_photons_per_event)
        if n_photons < 50:
            continue  # Skip events with too few photons

        # Simulate localization: add shot noise to position
        sigma_shot = pixel_size * psf_sigma / np.sqrt(n_photons)
        x_measured = x_true + np.random.normal(0, sigma_shot)
        y_measured = y_true + np.random.normal(0, sigma_shot)

        localized_positions.append([x_measured, y_measured])

localized_positions = np.array(localized_positions)
print(f"\nTotal localized events: {len(localized_positions)}")
print(f"Average events per fluorophore: {len(localized_positions) / n_fluorophores:.1f}")
PALM/STORM Simulation Setup
==================================================
Number of fluorophores: 200
Number of frames: 500
Image size: 2000 × 2000 nm²
Pixel size: 10 nm
PSF σ: 106 nm

Total localized events: 1008
Average events per fluorophore: 5.0

Now visualize the reconstruction:

Code
# Create superresolution image from localized positions
sr_image = np.zeros((image_size // pixel_size, image_size // pixel_size))
for pos in localized_positions:
    x_idx = int(pos[0] / pixel_size)
    y_idx = int(pos[1] / pixel_size)
    if 0 <= x_idx < sr_image.shape[0] and 0 <= y_idx < sr_image.shape[1]:
        sr_image[y_idx, x_idx] += 1

# Create diffraction-limited image (ground truth convolved with PSF)
gt_image = np.zeros((image_size // pixel_size, image_size // pixel_size))
for pos in positions:
    x_idx = int(pos[0] / pixel_size)
    y_idx = int(pos[1] / pixel_size)
    if 0 <= x_idx < gt_image.shape[0] and 0 <= y_idx < gt_image.shape[1]:
        gt_image[y_idx, x_idx] += 1

psf_sigma_pixels = psf_sigma / pixel_size
dl_image = gaussian_filter(gt_image, sigma=psf_sigma_pixels)

# Plot comparison
fig, axes = plt.subplots(1, 3, figsize=get_size(15, 5))

im0 = axes[0].imshow(gt_image, cmap='viridis', origin='lower')
axes[0].set_title('Ground truth positions')
axes[0].set_xlabel('x (pixels)')
axes[0].set_ylabel('y (pixels)')
plt.colorbar(im0, ax=axes[0])

im1 = axes[1].imshow(dl_image, cmap='viridis', origin='lower')
axes[1].set_title('Diffraction-limited image')
axes[1].set_xlabel('x (pixels)')
plt.colorbar(im1, ax=axes[1])

im2 = axes[2].imshow(sr_image, cmap='viridis', origin='lower')
axes[2].set_title('Superresolution reconstruction')
axes[2].set_xlabel('x (pixels)')
plt.colorbar(im2, ax=axes[2])

plt.tight_layout()
plt.savefig('img/palm_storm_reconstruction.png', dpi=150, bbox_inches='tight')
plt.close()
print("Figure saved to img/palm_storm_reconstruction.png")
Figure saved to img/palm_storm_reconstruction.png

Problem 5: Structured Illumination Microscopy (SIM)

Problem Statement:

In SIM, the sample is illuminated with a sinusoidal intensity pattern:

\[I(x) = I_0 [1 + m \cos(kx + \phi)]\]

where \(k = 2\pi/\Lambda\) is the pattern wavevector, \(\Lambda\) is the pattern period, \(m\) is the modulation depth, and \(\phi\) is the phase.

The fluorescence signal is modulated at harmonics of the spatial frequency. By varying \(\phi\) (typically 3 phases) and pattern orientation \(\theta\) (typically 3 or 5 orientations), high-frequency Fourier components are shifted into the passband, doubling the effective resolution.

a) Explain why illuminating with a pattern at spatial frequency \(k_\text{pat}\) allows detection of sample frequencies up to \(2k_\text{pat}\).

b) A wide-field microscope has resolution \(d_0 = 200\) nm (diffraction limit). In SIM with 3 pattern orientations and 3 phase shifts (9 raw images), what is the effective resolution \(d_\text{SIM}\)?

c) Why is SIM called a “super-resolution by orthogonal illumination” technique, and what are its advantages over STED?

Solution (sketch):

  • (a) The sample has Fourier components \(O(k_x, k_y)\) up to the diffraction limit. Illumination at spatial frequency \(k_\text{pat}\) shifts components: the observed intensity in Fourier space is \(O(k_x, k_y) \otimes [1 + e^{ik_\text{pat}x} + e^{-ik_\text{pat}x}]\), creating sidebands at \(\pm k_\text{pat}\). These shift frequencies that were previously blocked outside the passband back into view.

  • (b) SIM achieves a factor of ~2 improvement in resolution. With 3 orientations, the coverage is better (isotropic). Effective resolution: \(d_\text{SIM} \approx d_0 / 2 = 100\) nm.

  • (c) SIM requires no fluorophore photoswitching and no depletion beam—just patterned illumination. It is faster and more compatible with live-cell imaging. STED requires higher powers and phototoxicity; SIM distributes illumination.


Problem 6: Two-Photon Microscopy

Problem Statement:

In two-photon microscopy, fluorescence is excited by simultaneous absorption of two photons, each with half the energy of the single-photon transition.

a) Show that the fluorescence signal scales as the square of incident intensity: \(F \propto I^2\).

b) Why does this quadratic dependence provide optical sectioning without a pinhole? Compare with confocal microscopy.

c) For a typical two-photon microscope with NA = 1.0 and excitation wavelength λ = 800 nm, estimate the lateral and axial resolution and compare with confocal (λ = 405 nm, NA = 1.4).

Solution (sketch):

  • (a) Two-photon absorption rate: \(\Phi \propto I^2\) (a two-step nonlinear process). Fluorescence signal \(F = \eta \Phi \propto I^2\).

  • (b) Since fluorescence \(\propto I^2\), the signal is only appreciable near the focal point where intensity is highest (I ∝ 1/volume ∝ 1/(λ/NA)³). Off-focus regions contribute negligibly because \(I^2\) falls off rapidly. This gives automatic optical sectioning (~2 µm axial) without a pinhole. Confocal achieves sectioning with a physical pinhole that rejects out-of-focus light.

  • (c) Two-photon resolution:

    • Lateral: \(d_\text{2P} \approx 0.51 \cdot 800 / 1.0 \approx 410\) nm
    • Axial: \(d_z \approx 1.4 \cdot 800^2 / 1.0^2 \approx 890\) nm
    • Confocal (405 nm, NA 1.4):
      • Lateral: \(d_\text{conf} \approx 0.51 \cdot 405 / 1.4 \approx 148\) nm
      • Axial: \(d_z \approx 0.88 \cdot 405^2 / 1.4^2 \approx 85\) nm
    • Confocal is better (shorter wavelength). Two-photon is better for deep tissue (less scattering at 800 nm, longer working distance).

Summary

You have explored the key superresolution techniques: - Confocal: improves resolution by ~√2 with a pinhole - STED: continuous improvement with depletion intensity, reaching <50 nm routinely - PALM/STORM: reconstruction of diffraction-limited shots, <10 nm lateral precision - SIM: linear improvement (×2) without photoswitching, fast - Two-photon: intrinsic sectioning via nonlinear excitation, better for thick specimens

Each method trades off speed, photon budget, live-cell compatibility, and maximum resolution.