MorphoLibJ's Geodesic Distance Map plugin



Hi, I saw your comment above and I was wondering if it is possible to use this plugin in order to measure the distance from the midline to the border (or total thicknes) of multiple points along the mask image. This plugin output is a LUT of the distance and I would like to get a numeric data.
Thanks for your help!

Measuring wall thickness of plastic extruded sample
Analyzing cell layer thickness
Determine average width of irregular line
Vertical Caliper Distance?

Hello @ofirforsht,

The image with the fire LUT contains the distance data, every pixel in that image has an intensity equal to the distance to the midline.


Hi @iarganda,
Thanks a lot for your help!
I understood that the color represent the distance, but how can I extract the numeric measurement of each point? I would like to plot these numbers and create a line/histogram graph of the thickness along the cell layer (the distribution of thickness is more important to me than the average thickness) so I would need an array of points and the measured distance and not the LUT I get as an output.
I guess that I need to convert pixel intensity into distance but I don’t know how to do it and how to arrange them in the right order as they appear in the tissue.
Any idea on how to solve this issue you be very appreciated.
Thanks again,


You just need to read the pixel value at each specific coordinate.

You can use the selection tool and the Plot Profile tool to do that. See this example:

From left to right you have the original binary image, its skeleton and the geodesic distance image calculated using the skeleton as marker. If you select the borders of the original image (for example using the Wand (tracing) tool), convert the selection to a line (Edit > Selection > Area to Line) and then plot the profile (Analyze > Plot Profile), you will get the distance of those pixels to the midline.

PS: if you agree, I will make this conversation public in the forum so everybody can benefit from and contribute to the answers.

Measuring wall thickness of plastic extruded sample

Thanks for the fast reply! I really appreciate it.
First of all, its a good idea to make this conversation public.
Second, I tried your method and got in a few problems:

  1. I’m attaching the MorphoLibJ’s Geodesic Distance Map plugin results I got, using the longest shortest path as marker and the mast. I tried doing the same with the tagged skeleton as marker and got the same results - it doesn’t seem to work like your results, with thickness been measured between skeleton branches instead of from longest shortest path to the borders…do you have any idea how to solve this?
  2. Since I couldn’t get thickness from center line, I created a simple example and used MorphoLibJ’s Geodesic Distance Map plugin to get good results like you did (image attached below). After I select the mask borders with wand tool (this is what you meant by the original image right? because I can’t select the results border anyway) and convert area to line I can’t seem to get the results with the plot profile tool - I get “Line or rectangular selection required” error message…where did I go wrong?



I see. I assume you are interested on having the distance to the midline only. In that case you should the longest shortest path voxels only as marker (you can isolate it by thresholding for example). Another option is to prune the skeleton to remove the small branches using for example this script.

Sorry, my fault, I forgot to mention you have to bring the border selection in the original image to the distance image (which is where you want to plot the profile). You can do that after by selecting the distance image and clicking on Edit > Selection > Restore Selection.



Thank a lot! I followed your directions and everything worked out perfectly! was able to get the plot:

I’m trying to figure out 2 last ploblems:

  1. If I manually press the save on the plot it will save the list I opened on the right as a csv, but adding save as only saves the results and not the plot…how can I code save as from the plot? alternatively, is there a way to move the plot results to the results window?
  2. I’m not sure about the meaning of the numbers I get from the plot - there are a lot of NaN on the Y axis and according to the low values in the middle of the plot it doesn’t seem to be in the right order as the cell layer thickness. I would appreciate an explanation to how are the results ordered (what retermines the X axis number) and how do I get the Cell layer thickness in the order it is in the image


If you select the plot window and click on File > Save then the plot will be saved as an image. If you click on the Save… button of the plot window, you will save the data points as .XLS. I’m not sure I understood what you want to do, but these are the only options you have.

If you click on the List button, they results will be shown on a another window.

That is because your selection takes some pixels out of the object and therefore the distance is NaN. You might want to reduce the selection by 1 (using Enlarge with value -1):

What do you mean? The values will show up in an arbitrary order (most probably starting from the most upper left position and then continuing in the line.



What I meant is that I want to enter the save as command to a macro that can be implemented on a large amount of images instead of opening each one and saving them one at a time by pressing the save button…Save as in the macro will not save the plot measures but only the results window, how can I code this into my macro?

  1. That is exactly what I’m trying to prevent, since my final goal is to plot the cell layer thickness along the longest shortest path - I need the distance between the path and the ROI border in the right order (e.g left to right)…is there a way to overcome this issue?
  2. does it record the thickness from both sides of the longest shortest path (a mirror image) or just a one? is it possible to know the arbitrary direction of the measurements?
    If I would have answer to both questions I could probably get my final goal by analysis of measurement (for example only keeping the maximum value between two NaN if the measurements are in vertical lines along the image would yield the thickness per each point…)

Thanks again and sorry for asking so many questions, I feel like I’m so close to the results I want and just need a little more help :slight_smile: