LCS and MIST frameworks for single-exposure multi-contrast X-ray imaging: transmission, phase, isotropic and directional dark-field retrieval
Project description
๐ฌ LCS-Retrieval โ Low Coherence System & MIST framework for multi-contrast X-ray imaging
LCS-Retrieval implements two complementary frameworks for simultaneous retrieval of transmission, phase, isotropic dark-field, and directional dark-field from X-ray images:
- LCS (Low Coherence System) โ implicit sliding-window least-squares solver based on the TIE + FokkerโPlanck model โ validated
- MIST (Multimodal Intrinsic Speckle Tracking) โ phase and dark-field retrieval via local contrast statistics and FFT-based inversion โ ๏ธ implemented, experimental validation ongoing
Both frameworks share a unified orientation analysis pipeline for the directional scattering tensor (theta, anisotropy, HSV visualization).
Compatible with speckle-based, modulation-based, and single-grid X-ray imaging setups.
๐ Overview
Conventional multi-contrast X-ray imaging requires multiple exposures or phase steps to separate absorption, phase, and scattering signals. LCS-Retrieval eliminates this need by reformulating the inverse problem locally within a sliding window around each pixel.
From a single pair of images (reference + sample), both methods retrieve:
| Signal | LCS symbol | MIST symbol | Description |
|---|---|---|---|
| ๐ฒ Transmission | T | Iob | Absorption contrast |
| ๐ Phase | dy, dx | phi | Phase / wavefront |
| ๐ Isotropic dark-field | DF | Deff | Overall scattering strength |
| ๐งญ Directional dark-field | Dxx, Dxy, Dyy | Dxx, Dxy, Dyy | Anisotropic scattering tensor |
โณ๏ธ Key Features
- ๐น Single-exposure retrieval โ no phase stepping or mask motion required
- ๐น LCS solver โ sliding-window least-squares on the TIE + FokkerโPlanck model โ
- ๐น MIST solver โ local contrast statistics + FFT-based FokkerโPlanck inversion โ ๏ธ (experimental validation in progress)
- ๐น Shared orientation pipeline โ
lcs.hsv_retrieval()andlcs.ddf_metrics()work on both LCS and MIST outputs - ๐น Multi-exposure mode supported for both methods (
win_size=1) - ๐น External absorption injection โ provide an independent T map for both LCS and MIST
- ๐น HSV orientation visualization of the directional scattering tensor
- ๐น Compatible with speckle-based, modulation-based, and single-grid setups
โ๏ธ Installation
โถ๏ธ From PyPI (recommended)
pip install LCS-Retrieval
To also install the dependencies for the example notebooks (matplotlib, fabio):
pip install LCS-Retrieval[examples]
โถ๏ธ From source
git clone https://github.com/MuguiwaraSamy/LCS-Retrieval.git
cd LCS-Retrieval
pip install -e .
Requirements: Python โฅ 3.9, NumPy โฅ 2.0, SciPy โฅ 1.10
๐ง Quick start โ LCS
import lcs
# ref, sample: 2D arrays (H, W) or multi-exposure stacks (H, W, N)
# โโ Isotropic dark-field โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
result_df = lcs.lcs_df(ref, sample, win_size=5, alpha=1e-5)
# Output shape: (H', W', 4)
T = result_df[..., 0] # Transmission
dy = result_df[..., 1] # Vertical refraction
dx = result_df[..., 2] # Horizontal refraction
DF = result_df[..., 3] # Isotropic dark-field
# โโ Directional dark-field โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
result_ddf = lcs.lcs_ddf(ref, sample, win_size=5, alpha=1e5)
# Output shape: (H', W', 6) โ [T, dy, dx, Dxx, Dxy, Dyy]
# โโ HSV orientation visualization โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
rgb, metrics = lcs.hsv_retrieval(result_ddf, sigma=5.0)
๐ง Quick start โ MIST
[!WARNING] The MIST module is fully implemented and functional, but has not yet been experimentally validated. The code is based on the FokkerโPlanck + local contrast statistics formulation, but results have not been systematically compared against ground-truth data. Use with caution and verify outputs on your own datasets. Validation is ongoing.
import mist
import lcs # shared orientation pipeline
energy = 8 # keV
wavelength = 12.398e-10 / energy # X-ray wavelength in metres
dist_det = 0.8 # metres
# โโ Isotropic dark-field + phase โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
result_df = mist.mist_df(ref, sample, dist_det=dist_det, wavelength=wavelength, win_size=3)
phi = result_df['phi'] # Phase map
Deff = result_df['Deff'] # Isotropic dark-field
# โโ Directional dark-field โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
result_ddf = mist.mist_ddf(
ref, sample, gamma_mat=100, dist_det=dist_det, wavelength=wavelength, win_size=3
)
# Output shape: (H', W', 6) โ [thickness, Iob, G, Dxx, Dxy, Dyy]
thickness = result_ddf[..., 0]
Iob = result_ddf[..., 1]
G = result_ddf[..., 2]
# โโ Shared orientation pipeline โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
rgb, metrics = lcs.hsv_retrieval(result_ddf, sigma=5.0) # works on MIST too!
๐๏ธ Acquisition modes
Both methods support the same three modes:
| Mode | Input shape | win_size |
|---|---|---|
| Single exposure + sliding window | (H, W) |
odd integer โฅ 3 |
| Multi-exposure (standard) | (H, W, N) |
1 |
| Multi-exposure + sliding window | (H, W, N) |
odd integer โฅ 3 |
๐งช External absorption image
Both methods accept an optional absorption argument.
The solver divides sample by absorption before retrieval, and returns the provided map (cropped to the valid window region) in the T/Iob channel.
# T_abs: independently measured absorption image, shape (H, W)
# LCS
result_df = lcs.lcs_df( ref, sample, win_size=5, absorption=T_abs)
result_ddf = lcs.lcs_ddf(ref, sample, win_size=5, absorption=T_abs)
# MIST
result_df = mist.mist_df( ref, sample, dist_det=dist_det, wavelength=wavelength, absorption=T_abs)
result_ddf = mist.mist_ddf(ref, sample, gamma_mat=100, dist_det=dist_det,
wavelength=wavelength, absorption=T_abs)
๐ Shared orientation pipeline
Both lcs.lcs_ddf and mist.mist_ddf return a (H', W', 6) stack whose last 3 channels are always the scattering tensor [Dxx, Dxy, Dyy]. This means the orientation analysis functions work identically on both:
# Works with both lcs.lcs_ddf() and mist.mist_ddf() outputs
rgb, metrics = lcs.hsv_retrieval(result_ddf, sigma=5.0)
metrics = lcs.ddf_metrics(result_ddf, sigma=5.0)
# Or directly on tensor components
metrics = lcs.tensor_metrics(Dxx, Dxy, Dyy, sigma=5.0)
metrics contains: theta, theta_smooth, coherence, aniso, traceS, major, minor, lambda_max, lambda_min, intensity
๐ API reference
LCS
lcs.lcs_df(ref, sample, *, win_size=5, alpha=1e-5, absorption=None)
| Parameter | Type | Default | Description |
|---|---|---|---|
ref |
ndarray (H,W) or (H,W,N) |
โ | Reference image(s) |
sample |
ndarray (H,W) or (H,W,N) |
โ | Sample image(s) |
win_size |
int | 5 |
Sliding window size (odd) |
alpha |
float | 1e-5 |
Tikhonov regularization |
absorption |
ndarray (H,W) or None |
None |
External absorption image |
Returns ndarray (H', W', 4) โ [T, dy, dx, DF]
lcs.lcs_ddf(ref, sample, *, win_size=5, alpha=1e5, absorption=None)
Returns ndarray (H', W', 6) โ [T, dy, dx, Dxx, Dxy, Dyy]
MIST โ ๏ธ experimental
[!NOTE] MIST functions are available in the package but experimental validation is still ongoing.
mist.mist_df(ref, sample, dist_det, wavelength, *, win_size=3, sig_scale=0.0, median_filter_size=0, alpha=1e5, absorption=None)
| Parameter | Type | Default | Description |
|---|---|---|---|
ref |
ndarray (H,W) or (H,W,N) |
โ | Reference image(s) |
sample |
ndarray (H,W) or (H,W,N) |
โ | Sample image(s) |
dist_det |
float | โ | Sample-to-detector distance (m) |
wavelength |
float | โ | X-ray wavelength in metres (12.398e-10 / energy_keV) |
win_size |
int | 3 |
Sliding window size (odd) |
sig_scale |
float | 0.0 |
Gaussian high-pass filter scale |
median_filter_size |
int | 0 |
Median filter on Deff (0 = off) |
alpha |
float | 1e5 |
Tikhonov regularization |
absorption |
ndarray (H,W) or None |
None |
External absorption image |
Returns dict โ {'phi', 'Deff', 'phi_laplacian'}
mist.mist_ddf(ref, sample, gamma_mat, dist_det, wavelength, *, win_size=3, sig_scale=0.0, alpha=1e5, absorption=None)
| Parameter | Type | Default | Description |
|---|---|---|---|
gamma_mat |
float | โ | Material delta/beta ratio |
dist_det |
float | โ | Sample-to-detector distance (m) |
wavelength |
float | โ | X-ray wavelength in metres (12.398e-10 / energy_keV) |
sig_scale |
float | 0.0 |
Gaussian high-pass filter scale |
absorption |
ndarray (H,W) or None |
None |
External absorption image |
Returns ndarray (H', W', 6) โ [thickness, Iob, G, Dxx, Dxy, Dyy]
Shared orientation functions
lcs.hsv_retrieval(result_ddf, *, sigma=5.0, percentile=99.0, sat_min=0.0, sat_max=1.0, val_min=0.0, val_max=1.0)
Returns (rgb, metrics) โ works on both LCS and MIST outputs.
lcs.ddf_metrics(result_ddf, *, sigma=5.0)
Returns metrics dict โ works on both LCS and MIST outputs.
lcs.tensor_metrics(Dxx, Dxy, Dyy, *, sigma=5.0)
Returns metrics dict directly from tensor components.
๐ Example notebooks
| Notebook | Description |
|---|---|
examples/example_lcs.ipynb |
LCS isotropic & directional dark-field |
examples/example_mist.ipynb |
MIST phase, isotropic & directional dark-field |
๐ฅ๏ธ ImageJ Plugin
A dedicated ImageJ/Fiji plugin for LCS retrieval is also available: ๐ github.com/MuguiwaraSamy/LCS-ImageJ
๐ Citation
If you use this package in your work, please cite:
@article{kefs2025lcs,
title = {Implicit Single-Exposure Retrieval of {X}-ray Phase, Absorption, and Anisotropic Dark-Field},
author = {Kefs, Samy and Ninham, Chris and Magnin, Clara and
Rolland du Roscoat, Sabine and Lhuissier, Pierre and Brun, Emmanuel},
journal = {IEEE Transactions on Medical Imaging},
year = {2025},
}
๐ License
Distributed under the MIT License. ยฉ 2025 Samy KEFS. All rights reserved.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lcs_retrieval-0.1.1.tar.gz.
File metadata
- Download URL: lcs_retrieval-0.1.1.tar.gz
- Upload date:
- Size: 3.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88de62a947912dcb951c33c6dd5b27676939258101719df1d12b43a1069a7325
|
|
| MD5 |
9dc74655da579e46a8aff71e5f73190f
|
|
| BLAKE2b-256 |
3bd232d480b91883afc6193b37abd4e41ca5673c030d66aea9b609b347db19e7
|
File details
Details for the file lcs_retrieval-0.1.1-py3-none-any.whl.
File metadata
- Download URL: lcs_retrieval-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
290dcfd3a806ebc2e0040334e3110a6eff9a1ac3f4534ad73850022fa31ec05a
|
|
| MD5 |
5c127522d3e3bfca66c6b0cf58470e8b
|
|
| BLAKE2b-256 |
76222bec0d1c01e29139f4e0e5c34326c8a64e355e71c4a7b027ac2f91e68dac
|