Concepts¶
The world-model paradigm¶
Every modality in pySRX is described by the same three pieces.
1. A forward operator. A linear operator \(H\) maps the sample (the "world", a 3D fluorescence density \(x\)) to the expected raw data. For the light field, \(H\) produces the 37 sub-aperture views; for lattice SIM it will produce the raw phases and orientations. With a constant background \(b\) the expected data are
\(H\) is built from the optics (pysrx.optics: PSFs per view or per illumination pattern) and applied by
pysrx.forward with a matching adjoint \(H^{\top}\), both z-chunked FFT convolutions on the GPU.
2. A Poisson likelihood. Photon counts are Poisson, \(y \sim \mathrm{Poisson}(Hx + b)\), so reconstruction minimises the negative log-likelihood \(\sum_i \left[(Hx + b)_i - y_i \log (Hx + b)_i\right]\), optionally with a regulariser such as total variation.
3. A reconstruction. Two families share the same operator.
- Classical solvers (
pysrx.solvers). Richardson-Lucy is the multiplicative EM update for this likelihood,
[ x^{(k+1)} = \frac{x^{(k)}}{H^{\top} \mathbf{1}} \, H^{\top}!\left(\frac{y}{H x^{(k)} + b}\right), ]
with an optional TV term; the MAP solver optimises the same objective with gradients.
- The world model (
pysrx.field). Instead of a voxel grid, \(x\) is a continuous neural field \(x_\theta(\mathbf{r})\) (a multi-resolution hash grid and a small MLP). It is rendered on the operator's grid, pushed through the same \(H\), and \(\theta\) is fitted by the same Poisson loss. Because the field only sees the data through \(H\), any modality with a forward operator gets a neural-field reconstruction for free, and the field can be resampled at any resolution afterwards.
Why one operator for everything¶
- Physics in one place. Calibration (lenslet geometry, defocus groups, illumination patterns) lives in the operator, not in each solver.
- Fair comparisons. RL, MAP and the neural field differ only in the prior, so differences in the metrics are differences in the reconstruction, not in the model.
- In-silico ground truth.
pysrx.simulateruns \(H\) forward on a reference volume (for example a registered confocal Nyquist stack) with a camera noise model, giving data whose answer is known.
Measuring the result¶
pysrx.metrics evaluates reconstructions on single optical sections with the same normalisation for every method:
resolution (FRC, self-FRC, decorrelation), fidelity against a reference (nMSE, PSNR, SSIM, PCC, MI), sharpness
(Tenengrad), noise and axial extent.