Skip to content

Commit 0277f3a

Browse files
authored
Merge pull request #241 from DiamondLightSource/paganinsavu
Adding Paganin savu legacy
2 parents 489803a + 7fcb559 commit 0277f3a

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

httomolibgpu/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from httomolibgpu.misc.rescale import rescale_to_int
77
from httomolibgpu.prep.alignment import distortion_correction_proj_discorpy
88
from httomolibgpu.prep.normalize import normalize
9-
from httomolibgpu.prep.phase import paganin_filter
9+
from httomolibgpu.prep.phase import paganin_filter, paganin_filter_savu_legacy
1010
from httomolibgpu.prep.stripe import (
1111
remove_stripe_based_sorting,
1212
remove_stripe_ti,

httomolibgpu/prep/phase.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
__all__ = [
4343
"paganin_filter",
44+
"paganin_filter_savu_legacy",
4445
]
4546

4647

@@ -229,3 +230,37 @@ def _reciprocal_coord(pixel_size: float, num_grid: int) -> cp.ndarray:
229230
rc = cp.arange(-n, num_grid, 2, dtype=cp.float32)
230231
rc *= 2 * math.pi / (n * pixel_size)
231232
return rc
233+
234+
235+
def paganin_filter_savu_legacy(
236+
tomo: cp.ndarray,
237+
pixel_size: float = 1.28,
238+
distance: float = 1.0,
239+
energy: float = 53.0,
240+
ratio_delta_beta: float = 250,
241+
) -> cp.ndarray:
242+
"""
243+
Perform single-material phase retrieval from flats/darks corrected tomographic measurements. For more detailed information, see :ref:`phase_contrast_module`.
244+
Also see :cite:`Paganin02` and :cite:`paganin2020boosting` for references. The ratio_delta_beta parameter here follows implementation in Savu software.
245+
The module will be retired in future in favour of paganin_filter. One can rescale parameter ratio_delta_beta / 4 to achieve the same effect in paganin_filter.
246+
247+
Parameters
248+
----------
249+
tomo : cp.ndarray
250+
3D array of f/d corrected tomographic projections.
251+
pixel_size : float
252+
Detector pixel size (resolution) in micron units.
253+
distance : float
254+
Propagation distance of the wavefront from sample to detector in metre units.
255+
energy : float
256+
Beam energy in keV.
257+
ratio_delta_beta : float
258+
The ratio of delta/beta, where delta is the phase shift and real part of the complex material refractive index and beta is the absorption.
259+
260+
Returns
261+
-------
262+
cp.ndarray
263+
The 3D array of Paganin phase-filtered projection images.
264+
"""
265+
266+
return paganin_filter(tomo, pixel_size, distance, energy, ratio_delta_beta / 4)

0 commit comments

Comments
 (0)