Self-supervised physics-informed generative networks for phase retrieval from a single X-ray hologram
Abstract: X-ray phase contrast imaging significantly improves the visualization of structures with weak or uniform absorption, broadening its applications across a wide range of scientific disciplines. Propagation-based phase contrast is particularly suitable for time- or dose-critical in vivo/in situ/operando (tomography) experiments because it requires only a single intensity measurement. However, the phase information of the wave field is lost during the measurement and must be recovered. Conventional algebraic and iterative methods often rely on specific approximations or boundary conditions that may not be met by many samples or experimental setups. In addition, they require expert tuning of the reconstruction parameters, making them less adaptable for complex or variable conditions. Here we present a self-learning approach for solving the inverse problem of phase retrieval in the near-field regime of Fresnel theory using a single intensity measurement (hologram). A physics-informed generative adversarial network is employed to reconstruct both the phase and absorbance of the unpropagated wave field in the sample plane from a single hologram. Unlike most state-of-the-art deep learning approaches for phase retrieval, our approach does not require paired, unpaired, or simulated training data. This significantly broadens the applicability of our approach, as acquiring or generating suitable training data remains a major challenge due to the wide variability in sample types and experimental configurations. The algorithm demonstrates robust and consistent performance across diverse imaging conditions and sample types, delivering quantitative, high-quality reconstructions for both simulated data and experimental datasets acquired at beamline P05 at PETRA III (DESY, Hamburg), operated by Helmholtz-Zentrum Hereon. Furthermore, it enables the simultaneous retrieval of both phase and absorption information.
-
Clone the repo
git clone https://github.com/hereon-GEMS/SelfPhish.git cd SelfPhish -
Create a Python environment
(Example with Conda)conda create -n selfphish python=3.12 conda activate selfphish
-
Install dependencies
pip install -r requirements.txt
Required packages include:
- PyTorch ≥1.12
- torchvision
- scikit-image
- numpy
-
GPU / CUDA
By default the code usescuda:0if available; you can override via thedeviceparameter in your experiment.
You can quickly test SelfPhish by running the provided qr.py script. This script sets up the environment, runs a simulation, trains the model, and visualizes the results:
python qr.pyThe script will automatically handle the necessary imports and path setup. You can modify qr.py to run your own experiments or change parameters as needed.
- Mg-wire data:
- Spider hair:
Enjoy experimenting with SelfPhish! 🚀

