How to analyse the tortuosity of an object

Hello, I am new to this forum and would like some help in how best to measure the tortuosity of an object in ImageJ software. I am a clinical researcher without any background in coding/computer progarmming at all so please bear with me if my questions are appear simplistic/obvious answers!

I am looking at whether the morphology (namely tortuosity) of a special type of gland in the human body affects its ability to function normally. Usually these glands are linear/straight but some display significant “wiggly” (tortuous) appearance. I came across ImageJ from recommendation by a colleague to analyse images of these glands but I am struggling to find a measure/metric that best describes tortuosity; and how to go about doing this.

I would be most grateful if someone is able to help me do this by describing the steps to do this in a simple manner,



Hi @Paz_Bilkhu
To help you :
Are you allowed to deposit one or even two images?
An original and another where is found the organ that you want to study.
Then specify your wishes: length, surface, width etc …
Finally, what do you call tortuosity?

Many thanks Mathew for the prompt response - I have attached files (below) with an image of the glands, they are the linear structures which extend vertically in the eyelid.

One image shows the type of images taken. The other I have drawn on lines to show a “normal” straight gland (on the left) and another “wiggly” (tortuous) gland (on the right)

meibography image

meibography image with lines to show tortuosity

There is no specific length/width, just the amount of “wiggling” the gland displays (which is tortuosity).

Kind regards,


Hi Paz,

Concerning the tortuosity measure, a typical definition is the ratio of the geodesic diameter over the Feret Diameter. For linear objects such as the black lines you have drawn, the geodesic diameter can be approximated by the sum of the pixels in the curve, and the Feret diameter corresponds to the (Euclidean) distance between extremities. So in theory there should be no difficulty…

The only remaining problem would be to transform the input image into a set of black curves (i.e., performing image segmentation). This task is often complicated, especially if you do not have any background. Some steps you can start to investigate:

  • (manual) delineation of the region of interest (“ROI”)
  • enhance the contrast within the ROI to facilitate the discrimination between bright and dark parts
  • segmentation of the glands. Threshold can be a good start (automated choice of threshold can be performed by some methods like Otsu). Resulting particles can be further selected based on size / shape criterion (in the “Analyze Particles” tool).
  • the region corresponding to a single gland can be reduced to a line by skeletonization procedure. There is one in ImageJ. Some extra branches may be present, requiring pruning of the skeleton.
  • measurement of Feret diameter is included in Analyze Particle. Including the sum of the voxel of the skeleton allows to tcombine with Feret diameter to compute tortuosity.

There is unfortunately no unique recipe for each step, so it will surely be necessary to perform a trials/errors search…

Many thanks dlegland,

This is very helpful to know that tortuosity can be measured by calculating the ratio as you have suggested. However I am a neophyte to ImageJ let alone any type of image analysis software!Some of the terms you have mentioned for want of my own ignorance I simply do not understand what you are referring to - I have never used this software before or required to do such a task as this previously in my work (I am a medical research clinician)! apologies in advance for the basic queries…

  1. I don’t know how to delineate the region of interest - what tool do I use to do this? does this mean to create a continous line around the gland to identify it’s shape i.e. make a polygon?
  2. What do use to enhance contrast? and why would I do this if I have been able to delineate the gland?
  3. I don’t understand what segmentation would mean for the gland - again, why if I have been able to delineate the gland from the image? I don’t know what threshold is referring to or what Otsu is
  4. Once I have delinieated/identified a single gland, how do I reduce it to a line with a skeletonization procedure - I need step by step instructions
  5. what calculation do I need to perform to obtain the geodisic diameter or is than an output measurement that is shown on analysis
  6. I understand Feret diameter is shown after analysing particle; but I don’t know what a voxel is or how to combine it with Feret diameter to compute tortuosity - I though this was a simple ratio between geodisic diameter and Feret diamater?

Again, I am very sorry for the questions/ignorance on this subject as I have had no prior training with this software. Unfortunately the image capture technology for these types gland images has no built in software to analyse them for clinical purposes.



For the complexity of a line, a quite powerful descriptor is the fractal dimension.
In some cases the global fractal dimension (e.g. box counting) is effective if the object is homogeneously irregular. If not, then you can compute the local dimension or the local-connected dimension.


To begin.
Obviously the macro is rough.
It will have to be refined.
[To understand what the macro does, I invite you to use the macro line by line. (which takes a little time).]

I hope it helps you.

run("Duplicate...", "title=temp");
makeRectangle(251, 72, 190, 190);
run("Duplicate...", "title=a");
run("Enhance Local Contrast", "blocksize=127 histogram=256 maximum=20");
run("Duplicate...", "title=1 ");
run("Unsharp Mask...", "radius=60 mask=0.60");
run("Duplicate...", "title=2 ");
setAutoThreshold("Default dark");
run("Convert to Mask");
run("Duplicate...", "title=3 ");
run("Analyze Particles...", "add");
roiManager("Show All without labels");
roiManager("Set Color", "red");
roiManager("Set Line Width", 1);