Largest sphere Euclidean distance output from Java local thickness ImageJ/Fiji plugin


I have read various research papers and forum posts containing the histogram data output from the local_thickness (complete process) plugin to Fiji. To my disappointment, I have yet to find a guide or instructions on how this data is extracted from the .JAR file using the ImageJ API. When I run the histogram call after generating the distance map, the log file outputs the number of like RGB pixels in a set number of bins. The data output I need is: number of like largest sphere/circle diameters, their assigned RGB value bins, and the corresponding Euclidean distances. Is there a method in the InageJ API or under a particular class in the plugin that outputs this information? If not could you provide direction on how to modify the .JAR file to complete this task?

I have looked through the .JAR file Local_Thickness plugin using NetBeans IDE, but do not understand the structure of the plugin well enough to pinpoint an array or function storing the Euclidean distances prior to creating the distance map.

My best attempt has lead me to believe that the skeleton/ridge point data used to find the closest edge and record the Euclidean distance assigned to a thickness is found in the Local_Thickness_Parrallel class.

Related forum posts:

Any and All advisement is greatly appreciated,


Hi @jmthompson,

Welcome to the forum.

The data output I need is: number of like largest sphere/circle diameters, their assigned RGB value bins, and the corresponding Euclidean distances.

I’m confused about what you’re trying to do, maybe if you attach a sample image and annotate it with your analysis goals, it will make it more clear to me and others what you mean. For example, what do you mean by the RGB value bin of a largest circle?

The source code for the local thickness plugin is here:

but I’m not sure how much that will help you, since it’s not super clear to me what your goal is.


Thank you for @bogovicj for your reply.

My main goal is to extract the euclidean distances of respective largest spheres/circles calculated within the LocalThickness plugin. I would then like to store this data as an array to pull statistical data such as mean, mode, median etc. To my knowledge, simply creating a histogram of the output image from the Local_Thickness plug-in does not provide the calculated euclidean distances used when generating the distance map image. Assuming that the value output in the lower right corner of the histogram pop out window relates to measured local thickness, it appears that the corresponding RGB colors on the graph differ from there actual measurements. For example, in the attached view-graph the actual measured diameter correlates to a near red RGB color. However, the RGB value of the circle measured had a near yellow RGB color depicted in the plug-in generated distance map.

I admit, I am new to imageJ and therefore strongly leaning on literature reviews and forum posts to understand how the LocalThickness Plugin works.

Respectfully,210330_Local_Thickness_SEM_image_data_extraction_method…pdf (1.6 MB)

Please let me know if any additional information is missing in my post on March 29th. I have a limited window to address changes in our experiment workflow and would like to have a more efficient method for extracting material thickness/euclidean distance data from batched folder binary filtered SEM images. I am pursuing other options in parallel, but if anyone has an alternative solution, please feel free to chime in. I apologize for short notice.


Hi @jmthompson ,

Sorry to have left this hanging. Here are some thoughts / ideas on how to find the locations and sizes of maximal circles. I’d go with the first if I were you.


Don’t use local thickness results and compute it yourself

I think I’d recommend this approach.
Rather than try to infer the locations of largest circles from the output of local thickness, compute it yourself with a similar approach: skeletonization.

  1. Compute the skeleton of your objects, all pixels that are part of a skeleton are centers of largest circles.
  2. Compute the distance transform of your objects. The value of the distance transform at those points give you the radius of the circle at that point

Distance Transform (L), Skeleton (R):

A post-processing approach

From the output of local thickness, I think you can get an approximation by finding all connected components with the same distance value. See the green circle below. The center of that green circle is a “largest sphere”.


But then you’ll have issues with very small or weirdly shaped connected components like the one below. How to deal with points like that is unclear and should depend on how you want to do the analysis.

You may also come across connected components that are not spherical/circular, but results because of many “overlapping” circles of the same size on the same distance ridge. Like this:

How to deal with this is also not clear.

For these reasons, I think it’s probably too annoying to be practical.

An edit-the-code approach

It’s probably more accurate, and certainly faster if it’s possible for you or someone to edit the local thickness code to output what you want.

At a quick glance, it may be that this line indicates which points are on the distance ridge (i.e. are the centers of largest circles ).

1 Like

Thank you for the detailed response and suggestions! I will comment in this post if I have any further questions.