scilpy.denoise package
scilpy.denoise.asym_filtering module
- scilpy.denoise.asym_filtering.cosine_filtering(in_sh, sh_order=8, sh_basis='descoteaux07', in_full_basis=False, is_legacy=True, dot_sharpness=1.0, sphere_str='repulsion724', sigma=1.0)[source]
Average the SH projected on a sphere using a first-neighbor gaussian blur and a dot product weight between sphere directions and the direction to neighborhood voxels, forcing to 0 negative values and thus performing asymmetric hemisphere-aware filtering.
- Parameters:
in_sh (ndarray (x, y, z, n_coeffs)) – Input SH coefficients array
sh_order (int, optional) – Maximum order of the SH series.
sh_basis ({'descoteaux07', 'tournier07'}, optional) – SH basis of the input signal.
in_full_basis (bool, optional) – True if the input is in full SH basis.
is_legacy (bool, optional) – Whether or not the SH basis is in its legacy form.
dot_sharpness (float, optional) – Exponent of the dot product. When set to 0.0, directions are not weighted by the dot product.
sphere_str (str, optional) – Name of the sphere used to project SH coefficients to SF.
sigma (float, optional) – Sigma for the Gaussian.
- Returns:
out_sh – Filtered signal as SH coefficients in full SH basis.
- Return type:
ndarray (x, y, z, n_coeffs)
- scilpy.denoise.asym_filtering.unified_filtering(sh_data, sh_order, sh_basis, is_legacy, full_basis, sphere_str, sigma_spatial=1.0, sigma_align=0.8, sigma_angle=None, rel_sigma_range=0.2, win_hwidth=None, exclude_center=False, device_type='gpu', use_opencl=True, patch_size=40)[source]
Unified asymmetric filtering as described in [1].
- Parameters:
sh_data (ndarray) – SH coefficients image.
sh_order (int) – Maximum order of spherical harmonics (SH) basis.
sh_basis (str) – SH basis definition used for input and output SH image. One of ‘descoteaux07’ or ‘tournier07’.
is_legacy (bool) – Whether the legacy SH basis definition should be used.
full_basis (bool) – Whether the input SH basis is full or not.
sphere_str (str) – Name of the DIPY sphere to use for SH to SF projection.
sigma_spatial (float or None) – Standard deviation of spatial filter. Can be None to replace by mean filter, in what case win_hwidth must be given.
sigma_align (float or None) – Standard deviation of alignment filter. None disables alignment filtering.
sigma_angle (float or None) – Standard deviation of the angle filter. None disables angle filtering.
rel_sigma_range (float or None) – Standard deviation of the range filter, relative to the range of SF amplitudes. None disables range filtering.
disable_spatial (bool, optional) – Replace gaussian filter by a mean filter for spatial filter. The value from sigma_spatial is still used for setting the size of the filtering window.
win_hwidth (int, optional) – Half-width of the filtering window. When None, the filtering window half-width is given by (6*sigma_spatial + 1).
exclude_center (bool, optional) – Assign a weight of 0 to the center voxel of the filter.
device_type (string, optional) – Device on which the code should run. Choices are cpu or gpu.
use_opencl (bool, optional) – Use OpenCL for software acceleration.
patch_size (int, optional) – Patch size for OpenCL execution.
References
- [1] Poirier and Descoteaux, 2024, “A Unified Filtering Method for
Estimating Asymmetric Orientation Distribution Functions”, Neuroimage, https://doi.org/10.1016/j.neuroimage.2024.120516