---
title: 'OSI-flex: Joint Phase and Shear Reconstruction'
url: https://www.emergentmind.com/topics/osi-flex
type: topic
---

# OSI-flex: Joint Phase and Shear Reconstruction

Searching arXiv for the exact OSI-flex paper and closely related context.
OSI-flex is an optimization-based computational framework for quantitative phase reconstruction from shearing interferometry measurements, distinguished by its joint estimation of the object phase and the shear vectors themselves. In shearing interferometry, the detector does not observe the absolute phase \( \phi \), but a phase difference between the field and a laterally shifted replica, so reconstruction requires solving an inverse integration problem under uncertain geometric parameters. OSI-flex addresses this by combining a differentiable forward model, regularized inverse optimization, and joint shear refinement within an open-source TensorFlow 2 implementation [2509.15382].

## 1. Measurement model and problem formulation

Shearing interferometry is a common-path quantitative phase imaging technique in which an object beam interferes with a laterally shifted copy of itself. Its principal advantage is high temporal stability, reduced sensitivity to environmental noise, compact design, and compatibility with partially coherent illumination; its principal limitation is that it yields only sheared phase-difference measurements rather than the absolute phase. OSI-flex is designed precisely for this setting [2509.15382].

The central measurement model is the sheared phase difference
\[
\Delta \phi(x, y; \mathbf{d}) = \phi(x+d_x, y+d_y)-\phi(x,y),
\]
where \(\mathbf{d}=(d_x,d_y)\) is the shear vector. For sub-resolution shears this approaches a directional derivative, but the general problem remains finite-difference inversion rather than direct phase recovery. The practical difficulty is not only that the measurement is incomplete for a single shear direction, but also that reconstruction quality is highly sensitive to the assumed shear. The paper emphasizes that calibration or cross-correlation-based estimation may provide precision only on the order of \(0.5\) pixels, which is insufficient for high-fidelity reconstruction [2509.15382].

OSI-flex formulates reconstruction from one or more measured phase-difference maps \(\Delta \phi_{M,n}\), \(n=1,\dots,N\), as minimization of
\[
\mathcal{E}(\phi; \mathbf{d}, \Delta \phi_M) = D(\phi; \mathbf{d}, \Delta \phi_M) + R(\phi),
\]
with a data-fidelity term
\[
D(\phi;\Delta \phi_M,\mathbf{d}) = \sum_{n=1}^{N} \sum_i \sum_j \left[ \Delta \tilde{\phi}_n(i,j;\mathbf{d}_n)-\Delta \phi_{M,n}(i,j) \right]^2.
\]
Here \(\Delta \tilde{\phi}_n\) is the model-predicted phase difference generated from the current phase estimate and current shear estimate. This formulation is inherently multi-shear, and it does not require the shear vectors to be orthogonal, equal in magnitude, integer-valued, or more than one in number.

## 2. Joint phase and shear estimation

The defining feature of OSI-flex is that it does not treat the shear as fixed metadata. Instead, it estimates the phase distribution and the shear vectors jointly. This is motivated by the observation that the forward model depends explicitly on \(\mathbf{d}\), so an inaccurate assumed shear forces the optimization to compensate by distorting the phase estimate, producing scale errors, ringing, and related artifacts [2509.15382].

To support arbitrary subpixel shears, OSI-flex computes the predicted phase difference by bilinear interpolation:
\[
\tilde{\Delta \phi}(d_x,d_y)= W_xW_y\,\Delta \phi(\lfloor d_x \rfloor,\lfloor d_y \rfloor) +W_x(1-W_y)\,\Delta \phi(\lfloor d_x \rfloor,\lceil d_y \rceil) +(1-W_x)W_y\,\Delta \phi(\lceil d_x \rceil,\lfloor d_y \rfloor) +(1-W_x)(1-W_y)\,\Delta \phi(\lceil d_x \rceil,\lceil d_y \rceil),
\]
with
\[
W_x=d_x-\lfloor d_x \rfloor, \qquad W_y=d_y-\lfloor d_y \rfloor.
\]
This makes the forward model piecewise differentiable with respect to shear, which is essential for gradient-based optimization.

The paper’s simulation study identifies shear mismatch as a major failure mode of conventional reconstruction. For two orthogonal shears with true magnitude \(5.3\) pixels but initial assumed value \(4.3\) pixels, reconstruction without shear fine-tuning degraded strongly as the mismatch increased, while joint optimization recovered nearly nominal quality even for large errors. The reported results are summarized below.

| Shear error | Without fine-tuning | With fine-tuning |
|---|---|---|
| \(0.1\) pixel | SSIM \(=0.961\), RMSE \(=0.022\) | SSIM \(=0.967\), RMSE \(=0.012\) |
| \(1\) pixel | SSIM \(=0.763\), RMSE \(=0.181\) | SSIM \(=0.967\), RMSE \(=0.012\) |
| \(2\) pixels | SSIM \(=0.532\), RMSE \(=0.326\) | SSIM \(=0.966\), RMSE \(=0.013\) |

The ideal no-error case had SSIM \(=0.967\) and RMSE \(=0.012\). This establishes joint shear refinement as a central component of OSI-flex rather than a secondary convenience. A plausible implication is that the framework is best understood as solving a coupled geometric-and-phase inverse problem, not merely a phase integration task.

## 3. Regularization, priors, and numerical optimization

The regularization term in OSI-flex has two components,
\[
R(\phi)=\alpha_{\mathrm{TV}}\,TV(\phi)+\alpha_{\mathrm{SP}}\,SP(\phi).
\]
The total variation component is
\[
TV(\phi)= \sum_i \sum_j \sqrt{ [\phi(i+1,j)-\phi(i,j)]^2 + [\phi(i,j+1)-\phi(i,j)]^2 },
\]
and the sign-penalty term is
\[
SP(\phi)=\sum_i \sum_j \max\!\big(s\cdot \phi(i,j),0\big),
\]
with
\[
s= \begin{cases} -1 & \text{for nonnegativity},\\[4pt] +1 & \text{for nonpositivity}. \end{cases}
\]
The sign penalty encodes prior knowledge that the sample induces phase of only one sign relative to background. The paper states that this prior is especially important for ill-posed settings, particularly nonorthogonal shears and the degenerate single-shear case [2509.15382].

Optimization is implemented with TensorFlow automatic differentiation and the ADAM optimizer. For a generic decision variable \(a\), either a phase pixel or a shear parameter, the update rule is
\[
a_k = a_{k-1} - \eta \frac{D_k}{\sqrt{\hat{v}_k}+\epsilon},
\]
with moment updates
\[
m_k=\beta_1 m_{k-1} + (1-\beta_1)\nabla_a \mathcal{E}_{k-1},
\]
\[
\hat{m}_k=\frac{m_k}{1-\beta_1^k},
\]
\[
v_k=\beta_2 v_{k-1} + (1-\beta_2)(\nabla_a \mathcal{E}_{k-1})^2,
\]
\[
\hat{v}_k=\frac{v_k}{1-\beta_2^k}.
\]
The paper notes that the learning rate for shear estimation is additionally multiplied by a factor \(\gamma\). Typical reported hyperparameters are \(\eta=0.1\), \(\gamma=0\) when shear fine-tuning is disabled, and \(\gamma=10^{-4}\) when it is enabled.

Convergence is reported empirically rather than with a theoretical guarantee. Many studies use 400 iterations, while shear-magnitude studies use 800 iterations. For a \(454\times 454\) phase image over 800 iterations, runtime was about 31 s on a CPU, and enabling shear estimation increased runtime by about 8% in one experiment. The authors explicitly note that ADAM lacks theoretical convergence guarantees, even though it converged quickly in practice.

## 4. Supported shear geometries and reconstruction regimes

A central claim of OSI-flex is flexibility with respect to the number, magnitude, and orientation of shears. The paper identifies two roughly orthogonal shears as the best-conditioned configuration, but does not require alignment with the image axes. Tilted but approximately orthogonal shears remain acceptable, while nonorthogonal and single-shear measurements are still reconstructable with stronger regularization [2509.15382].

The simulation results cover several regimes:

| Configuration | SSIM | RMSE |
|---|---:|---:|
| Nonorthogonal shears \([2.6,1.5]\), \([-1.4,7.9]\) | 0.9527 | 0.0151 |
| Single vertical shear \(5.3\) px | 0.7463 | 0.1419 |
| Small shear \(0.8\) px | 0.9544 | 0.0257 |
| Medium shear \(5.3\) px | 0.9975 | 0.0035 |
| Large shear \(50.3\) px | 0.9931 | 0.0055 |
| Unequal orthogonal shears \(5.3\) px and \(0.8\) px | 0.9108 | 0.0515 |

These results support several conclusions stated in the paper. First, OSI-flex is not limited to differential or one-pixel shears; it spans subpixel to semi-total-shear regimes extending to several dozen pixels. Second, medium shear offered the best trade-off in the reported study. Third, equal magnitudes are not required. Fourth, single-shear reconstruction is possible but inherently ill posed and tends to produce stripe artifacts along the shear direction.

This also addresses a common misconception. OSI-flex is not restricted to the standard textbook configuration of two known orthogonal one-pixel shears. Conversely, it does not claim equal performance across all geometries: the best results still occur with two roughly orthogonal shears, while nonorthogonal and especially single-shear cases require stronger priors and yield lower-quality reconstructions.

## 5. Experimental validation and application domains

The experimental platform uses a common-path shearing interferometer with a polarization-grating shearing module and a polarization-resolved camera. Four phase-shifted interferograms are recorded simultaneously with a micro-polarizer array, and standard phase-retrieval methods such as phase shifting, Fourier transform, or Hilbert transform are used upstream to obtain the unwrapped phase-difference maps that serve as input to OSI-flex [2509.15382].

Three classes of experimental samples are reported. For a calibrated phase target from Lyncée Tec, a \(125\pm 5\) nm etched structure in Boroflat 33 glass should produce a phase delay of \(0.7039\) rad under the experimental wavelength conditions; OSI-flex reconstructs a phase step consistent with this theoretical value and yields a uniform background. For a 3D-printed cell phantom designed to mimic phase distributions of HeLa cells in relatively high confluence, the method reconstructs dense, spatially complex phase features while maintaining a uniform background and avoiding the noise growth or error propagation associated in the paper with many direct integration methods. For follicular thyroid smear samples, the reconstruction resolves clustered and dispersed thyrocytes and colloid strands without visible halo artifacts.

The paper also repeats the single-shear case experimentally. As in simulation, essential structure is preserved but quality is reduced and stripe artifacts appear along the shear direction. In that setting, the authors do not fine-tune the shear; instead they reuse the shear estimated from a paired-shear reconstruction. This functions as a practical recommendation: when operating in an underdetermined single-shear regime, obtain the shear from a better-conditioned multi-shear measurement first.

A broader technical implication is that OSI-flex is positioned not only as a reconstruction algorithm but as a calibration-tolerant workflow. The joint phase-and-shear estimation is especially valuable in experimental systems where nominal geometric parameters are difficult to define precisely, which the paper identifies as a pervasive issue in shearing interferometry.

## 6. Software framework, scope, and limitations

OSI-flex is explicitly presented as an open-source framework. The implementation is based on TensorFlow 2 and uses its built-in automatic differentiation and ADAM optimizer, with code available at
\[
\texttt{https://github.com/QCI-LAB/OSI-flex}.
\]
Datasets are provided separately on Zenodo. The authors emphasize that the same optimization engine can be extended to other shearing geometries, explicitly mentioning radial and azimuthal shearing as future variants obtained by changing the forward model rather than the overall optimization structure [2509.15382].

The framework’s strengths are correspondingly specific. It does not require perfectly orthogonal, known, or small shears; it works with one or many phase-difference measurements; it jointly estimates phase and shear; and it recovers both low- and high-spatial-frequency content while avoiding the error accumulation associated in the paper with direct integration. Its use of automatic differentiation minimizes analytic derivative development and makes the software readily modifiable.

Its limitations are also explicit. The best results still occur with two roughly orthogonal shears. Nonorthogonal and single-shear cases are less well conditioned and need stronger regularization. The \(TV+SP\) prior is most naturally matched to piecewise-constant or sign-definite objects, although the paper states that weak regularization can still work for gradient-dominated samples. The optimization is iterative rather than closed form, and convergence is empirical rather than theoretically guaranteed. The paper further notes that ADAM lacks theoretical convergence guarantees.

Finally, the name itself can be a source of confusion. OSI-flex should be distinguished from the unrelated diffusion-watermark extraction method OSI, “One-step Inversion,” which the separate paper “OSI: One-step Inversion Excels in Extracting Diffusion Watermarks” does not call OSI-flex [2602.09494]. In the context of quantitative phase imaging, OSI-flex refers specifically to a flexible, open-source, optimization-driven framework for shearing interferometry phase reconstruction with joint shear estimation [2509.15382].

Source: https://www.emergentmind.com/topics/osi-flex