Vectorized 3D Frangi Filter

Version 1.0.0 (20.3 MB) by Xiang Ji
An efficient implement of 3D Frangi filter in MATLAB on both CPU and GPU
Updated 9 Apr 2023

Vectorized 3D Frangi Filter

View Vectorized 3D Frangi Filter on File Exchange

This is an efficient implementation of the 3D Frangi filter in MATLAB, capable of running on both CPU and GPU. The frangi_filter function calculates the Frangi vesselness response in accordance with the method proposed by Frangi et al. (1998) for 3D images. This involves the following steps:

  1. Calculation of the gamma-normalized gradients of the image after Gaussian filtering on multiple scales.
  2. Computation of the Hessian matrix for each voxel in the image at each scale, followed by the computation of the three eigenvalues of the 3 x 3 Hessian matrix. These eigenvalues are then combined to obtain the local vesselness measure.
  3. Calculation of the Frangi vesselness response for each voxel as the maximum of the responses obtained in step 2 over all scales.

For 3D vascular images, this process can be computationally intensive. In this implementation, we have leveraged the analytical formula for computing the eigenvalues of a 3 x 3 real symmetric matrix (Smith 1961) and implemented a vectorized version of the Frangi filter on both CPU and GPU in MATLAB.

In the Demo.m file, we demonstrate the computation of the Frangi vesselness for a 240 x 240 x 240 vascular image at 1 x 1 x 1 µm³ resolution. On our laptop workstation, this process takes 6.1 seconds and 1.1 seconds on the CPU and GPU, respectively.

Note that for optimal performance, the parameter c described in Equation 13 in Frangi et al. (1998) must be manually adjusted in frangi_filter_single_scale_gpu. This value can be determined by running the computation on the CPU for some test datasets and printing frangi_c for multiple scales by uncommenting disp(frangi_c); in Line 71 of frangi_filter.

This implementation is part of the image segmentation algorithm we use to segment whole mouse brain vascular images, which contain about one trillion voxels. If you use this implementation in your research, please reference the following paper:


   title={Brain microvasculature has a common topology with local differences in geometry that match metabolic load},
   author={Ji, Xiang and Ferreira, Tiago and Friedman, Beth and Liu, Rui and Liechty, Hannah and Bas, Erhan and Chandrasheka, Jayaram and Kleinfeld, David}, 

Cite As

Xiang Ji (2024). Vectorized 3D Frangi Filter (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2019b
Compatible with R2015a and later releases
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.