Skip to content

Commit 9650754

Browse files
committed
remove generilised paganin formulation
1 parent 05d7a5a commit 9650754

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

httomolibgpu/prep/phase.py

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,12 @@
4949
# This implementation originated from the TomoPy version. It has been modified to conform
5050
# different unit standards and also control of the filter driven by 'delta/beta' ratio
5151
# as opposed to 'alpha' in the TomoPy implementation.
52-
# The generalised formulation for Paganin is also added.
5352
def paganin_filter(
5453
tomo: cp.ndarray,
5554
pixel_size: float = 1.28,
5655
distance: float = 1.0,
5756
energy: float = 53.0,
5857
ratio_delta_beta: float = 250,
59-
generalised_paganin: bool = False,
6058
) -> cp.ndarray:
6159
"""
6260
Perform single-material phase retrieval from flats/darks corrected tomographic measurements. See
@@ -74,8 +72,6 @@ def paganin_filter(
7472
Beam energy in keV.
7573
ratio_delta_beta : float
7674
The ratio of delta/beta, where delta is the phase shift and real part of the complex material refractive index :math:`n = (1 - \delta) + i \beta` and beta is the absorption.
77-
generalised_paganin : bool
78-
Implementation of the filter following a newer generalised formulation for Paganin. This can further boost the resolution through periodic boundary conditions.
7975
8076
Returns
8177
-------
@@ -107,26 +103,13 @@ def paganin_filter(
107103
alpha = _calculate_alpha(energy, distance / 1e-6, ratio_delta_beta)
108104

109105
# Compute the reciprocal grid
110-
indx = _reciprocal_coord(pixel_size, dx)
111-
indy = _reciprocal_coord(pixel_size, dy)
112-
113-
# Build filter either following the classical Paganin or the generilised modification in 2020 paper by Paganin
114-
if generalised_paganin:
115-
phase_filter = fftshift(
116-
1.0
117-
/ (
118-
1.0
119-
- (2 * alpha / pixel_size**2)
120-
* (
121-
cp.add.outer(cp.cos(pixel_size * indx), cp.cos(pixel_size * indy))
122-
- 2
123-
)
124-
)
125-
)
126-
else:
127-
phase_filter = fftshift(
128-
1.0 / (1.0 + alpha * (cp.add.outer(cp.square(indx), cp.square(indy))))
129-
)
106+
indx = _reciprocal_coord(pixel_size, dy)
107+
indy = _reciprocal_coord(pixel_size, dx)
108+
109+
# Build Lorentzian-type filter
110+
phase_filter = fftshift(
111+
1.0 / (1.0 + alpha * (cp.add.outer(cp.square(indx), cp.square(indy))))
112+
)
130113

131114
phase_filter = phase_filter / phase_filter.max() # normalisation
132115

0 commit comments

Comments
 (0)