Use larger values of sigma to detect thicker tubes.


PlugIn for ImageJ


This plugin filters a 3D image stack (or 2D image) to produce a score for how "tube-like" each point in the image is. This is useful as a preprocessing step for tracing neurons or blood vessels, for example. For 3D image stacks, the plugin uses the eigenvalues of the Hessian matrix to calculate this measure of "tubeness", using one of the simpler metrics me mentioned in Sato et al 1997 ¹: if the larger two eigenvalues (λ₂ and λ₃) are both negative then value is √(λ₂λ₃), otherwise the value is 0. For 2D images, if the large eigenvalue is negative, we return its absolute value and otherwise return 0.

These metrics may not be quite right for the application you have in mind, but it is very easy to replace them with alternative schemes by changing the functions measureFromEvalues2D and measureFromEvalues3D in

¹ Y. Sato, S. Nakajima, N. Shiraga, H. Atsumi, S. Yoshida, T. Koller, G. Gerig, and R. Kikinis, “Three-dimensional multi-scale line filter for segmentation and visualization of curvilinear structures in medical images,” Med Image Anal., vol. 2, no. 2, pp. 143-168, June 1998.

Please let me know of any problems you have with this plugin or any suggestions you have. I hope it is of some use to you.


Mark Longair, Stephan Preibisch and Johannes Schindelin.


This plugin is now bundled as part of Fiji (a distribution of ImageJ with many useful plugins), and no longer supported as a standalone ImageJ plugin. Please download and install Fiji and you will find the plugin in "Plugins > Analyze > Tubeness"


The initial dialog box should look like this:

Before calculating the Hessian matrix for each point, the entire images is convolved with a Gaussian with the standard deviation (sigma) that you specify here. You can specify larger values of sigma here to tune the filter to select thicker tubes (see the image at the top right of this page for an example). The default value is a reasonable choice for finding tubes that have radii of approximately the minimum voxel separation.

If you deselect "Use calibration information" (which I would discourage) the plugin assumes that the aspect ratio of the voxels is 1:1:1 and their separation is 1.

Batch Preprocessing

You may wish to preprocess a large batch of images using this filter, for example if you are going to trace them. For this, I suggest that you use a macro like this:

// This short macro looks for all the files called .tif
// in a directory and preprocesses them for "tubeness"
// using sigma = 3.

// If you want to pick a directory manually, uncomment the
// "getDirectory" line.

d = "/home/mark/batch-examples/
// d = getDirectory("Choose a Directory ");

list = getFileList(d);

for (i=0; i<list.length; i++) {
    fullName = d + list[i];
    if (endsWith(fullName, ".tif")) {
        t = getTitle();
        run("Tubeness ", "sigma=3 use");
        selectWindow("tubeness of "+t);
        dotIndex = lengthOf(fullName) - 4;
        n = substring(fullName,0,dotIndex) + ".tubes.tif";
        saveAs("Tiff", n);


This plugin is licensed under the GPL (the GNU General Public License version 3). The source code for the plugin is available from the Fiji git repository.