filters

Linear convolution filters

Gaussian filter

Implements filtering with a \(k\)-order Gaussian derivative as a series of 1D convolutions. Currently supports up to second-order derivatives.


source

gaussian_filter

 gaussian_filter (img:torch.Tensor, sigma:float, order:int|list=0,
                  mode:str='reflect', truncate:float=4.0)

*Convolves an image with a Gaussian kernel (or its derivatives).

Inspired by the API of scipy.ndimage.gaussian_filter and the implementation of diplib.Gauss.*

Type Default Details
img Tensor The input tensor
sigma float Standard deviation for the Gaussian kernel
order int | list 0 The order of the filter’s derivative along each dim
mode str reflect Padding mode for torch.nn.functional.pad
truncate float 4.0 Number of standard deviations to sample the filter
Returns Tensor

Hessian matrix of an image

Compute a symmetric matrix of all second-order partial Gaussian derivatives of an image.


source

hessian_eigenvalues

 hessian_eigenvalues (img:torch.Tensor, sigma:float, **kwargs)

source

hessian

 hessian (img:torch.Tensor, sigma:float, as_matrix:bool=False, **kwargs)

Compute the Hessian of a 2D or 3D image.

Frangi

Implements the Frangi filter for enhancing tubular structures in 2D and 3D images. Refer to the original paper: Frangi et al., 1998


source

frangi

 frangi (image:torch.Tensor, sigma_range:tuple=(1, 10), scale_step:int=2,
         sigmas:list=None, alpha:float=0.5, beta:float=0.5,
         gamma:float=None, eps:float=1e-10, device:str|torch.device=None)
Type Default Details
image Tensor The intput image
sigma_range tuple (1, 10) The range of sigmas to use
scale_step int 2 The step between sigmas
sigmas list None Optional list of sigmas to use
alpha float 0.5 Plate-like and line-like structures threshold
beta float 0.5 Blob-like structures threshold
gamma float None Second-order structure threshold
eps float 1e-10
device str | torch.device None
Returns tensor