Skip to content

Commit dd49ae6

Browse files
committed
fixing bugs in the original paganin
1 parent df63c72 commit dd49ae6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

httomolibgpu/prep/phase.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ def paganin_filter(
9797
fft_tomo = fft2(padded_tomo, axes=(-2, -1), overwrite_x=True)
9898

9999
# calculate alpha constant
100-
alpha = _calculate_alpha(energy, distance / 1e-6, ratio_delta_beta)
100+
micron = 10 ** (-6)
101+
KeV = 1000.0
102+
alpha = _calculate_alpha(energy * KeV, distance * micron, ratio_delta_beta)
101103

102104
# Compute the reciprocal grid
103105
indx = _reciprocal_coord(pixel_size, dy)
@@ -263,6 +265,9 @@ def paganin_filter_savu_legacy(
263265
The 3D array of Paganin phase-filtered projection images.
264266
"""
265267

268+
# the scaling is different here and doesn't follow the original formula
269+
# ((1240.0 / energy) * 10.0 ** (-9)) * distance_micron * ratio_delta_beta * math.pi
270+
266271
return paganin_filter(
267-
tomo, pixel_size, distance, energy, ratio_delta_beta / (4 * 2 * np.pi)
272+
tomo, pixel_size, distance * 1e-03, energy, ratio_delta_beta / (4 * 2 * np.pi)
268273
)

0 commit comments

Comments
 (0)