Main Content


Enhance elongated or tubular structures in image using Frangi vesselness filter



J = fibermetric(I) enhances elongated or tubular structures in the 2-D or 3-D grayscale image I using a Hessian-based multiscale Frangi vesselness filter. The image returned, J, contains the maximum response of the filter at a thickness that approximately matches the size of the tubular structure in the image.

J = fibermetric(I,thickness) specifies the thickness of the tubular structures to enhance.

J = fibermetric(___,Name,Value) uses name-value pair arguments to control different aspects of the filtering algorithm.


collapse all

Read and display an image that contains tubular threads of varying thicknesses.

I = imread('threads.png');

Create an enhanced version of the image that highlights threads that are seven pixels thick. Threads show up dark against a light background, therefore specify the object polarity as 'dark'. Display the enhanced image.

B = fibermetric(I,7,'ObjectPolarity','dark');
title('Enhanced Tubular Structures 7 Pixels Thick')

Threshold the enhanced image to create a binary mask image containing the threads with the specified thickness.

BW = imbinarize(B);

Display the mask over the original image by using the labeloverlay function. The overlay has a blue tint where the mask is true (where threads have the specified thickness).

title('Detected Tubular Structures 7 Pixels Thick')

Input Arguments

collapse all

Image with elongated or tubular structures, specified as 2-D grayscale image or 3-D grayscale volume.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

Thickness of tubular structures in pixels, specified as a positive integer or vector of positive integers.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: J = fibermetric(I,'StructureSensitivity',15)

Structure sensitivity, specified as the comma-separated pair consisting of 'StructureSensitivity' and a positive number. The structure sensitivity is a threshold for differentiating the tubular structure from the background.

The default value depends on the data type of image I, and is calculated as 0.01*diff(getrangefromclass(I)). For example, the default threshold is 2.55 for images of data type uint8, and the default is 0.01 for images of data type double with pixel values in the range [0, 1].

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Polarity of the tubular structures with the background, specified as the comma-separated pair consisting of 'ObjectPolarity' and one of the following values:

'bright'Structure is brighter than the background.
'dark'Structure is darker than the background.

Data Types: char | string

Output Arguments

collapse all

Enhanced image, returned as a numeric array of the same size as the input image I. If the data type of I is double, then the data type of J is also double. Otherwise, the data type of J is single.

Data Types: single | double


  • The fibermetric function does not perform segmentation. The function enhances an image to highlight structures and is typically used as a preprocessing step for segmentation.


[1] Frangi, Alejandro F., et al. Multiscale vessel enhancement filtering. Medical Image Computing and Computer-Assisted Intervention — MICCAI'98. Springer Berlin Heidelberg, 1998. pp. 130–137.

Extended Capabilities

Version History

Introduced in R2017a

expand all

See Also