Skip to main content

Module resharp

Module resharp 

Source
Expand description

RESHARP background field removal

Regularized SHARP — uses Tikhonov regularization instead of TSVD truncation for more robust deconvolution of the SMV-filtered field.

Solves: argmin ||M·ifft(C·fft(x)) - M·ifft(C·fft(y))||² + λ||x||²

Where C = (1 - S) is the high-pass (delta minus SMV) kernel in k-space, M is the eroded mask, and λ is the Tikhonov regularization parameter.

§Reference pipeline

The first author’s code, background_field_removal/resharp.m in github sunhongfu/QSM (also shipped in QSMART’s toolbox), defaults to a 3 mm kernel (round(r/vox) per axis, at least 2 voxels, so ellipsoidal on anisotropic voxels), λ = 1e-4, and MATLAB cgs at tolerance 1e-6 for at most 200 iterations. It zero-pads by the kernel radius and keeps voxels where the normalised SMV of the mask exceeds 0.999999. Its driver Siemens_3T/qsm_r2s_prisma.m masks with FSL bet2 -f 0.4 -w 2 on the first-echo magnitude, unwraps each echo (bestpath by default), takes the total field from echofit.m (magnitude-weighted, zero-intercept), multiplies the mask by the echo-fit reliability map (fit_thr 40), and calls RESHARP with 3 mm, λ = 1e-3 and 500 iterations, followed by TV (tvdi) or iLSQR. ResharpParams::default follows resharp.m’s own defaults (3 mm, λ = 1e-4, at most 200 iterations), not this driver’s λ and iterations.

§Parity

Against resharp.m as the verified QSM-CI resharp container runs it (identical to licensed MATLAB R2023b): the fixture tests/resharp_sunhongfu_parity.rs (anisotropic voxels; converged, another kernel and λ, and a 5-iteration cap) agrees to 1e-14 relative with identical eroded masks, and the QSM-CI resharp pair (QSM-CI’s simulated head and the KKI travelling head) agrees at the container’s float32 output (KKI 2.5e-6 % NRMSE, astewartau/QSM.rs#404). Until #404 the port solved by conjugate gradients, which stops unconverged at 200 iterations where cgs converges (3.06 % on KKI); it also used a ball of radius r mm instead of resharp.m’s round(r/voxel)-voxel ellipsoid, and did not pad.

Reference: Sun, H. and Wilman, A.H. (2013). “Background field removal using spherical mean value filtering and Tikhonov regularization.” Magn Reson Med, 71(3):1151-1157. https://doi.org/10.1002/mrm.24765

§Pipeline rules

The facts above that a configuration can depart from are published as rules in crate::pipeline::rules::RULES (each with its strength, basis, reason and source): resharp.radius, resharp.iterations.

Structs§

ResharpParams
RESHARP algorithm parameters.

Functions§

apply_ht_h 🔒
Apply H’H to a vector: ifft(DKER * fft(M * ifft(DKER * fft(x))))
resharp
RESHARP background field removal, as resharp.m (sunhongfu/QSM c75b138).
resharp_kernel 🔒
resharp.m’s kernel (l. 43-45): the voxels of the rx×ry×rz ellipsoid (X²/rx² + Y²/ry² + Z²/rz² ≤ 1, in voxels), normalised to sum 1, centred at index (0,0,0) of an n grid for FFT use (Fortran order).
resharp_kernel_radii
The kernel radius in voxels per axis, as resharp.m (l. 37-42): round(radius/voxel), at least 2.