Automatic distance calculation between particle edges


I would like to automatically analyze the average distance between the edges of the particles, ideally in a neighbourhood.

Here is the example image with a marked neighbourhood:
The green lines indicate the distance, which is taken from the edges.

It would be great if there is an existing plugin, which performs that. I have tried the BioVoxxel Toolbox and NND Plugin, but the results are given from the centroids.

I would be glad for every hint.


A quick search led me to this older plugin.

I don’t know if it fits your needs, but a hint is a hint :slight_smile:


Hi @oburri,
that is a perfect solution, and it works even on my large images.

Thanks a lot, now I have to try and include it in my GUI Script with rest of the functions.



I have a case like your case , I would like to measure the neighbor distance in the image bellow for each particle, but I could not generate the XStart and YStart table. Thank you in advance


Can you try using the macro I published a year ago?

I did not use ImageJ much since that time, but I believe it should still work.
Generally, you would have to be more specific with the description of your problem, as I cannot provide much help in this case.

yes, I am sorry for the late reply. I am working on the microstructure of Al-Si alloys, and I am interested to measure the distances between edges of Si lamella ( black object in the photo below).

I tried with the plugin what u have suggested but unfortunately, it doesn`t work because it measures just the objects on edges. any help will be appreciated please find the photo and thank you in advance :slightly_smiling_face:

MD-Experiment-0001_p015.tif (1.4 MB)

I still don’t understand you.
You say:

I am interested to measure the distances between edges

And then:

it doesn`t work because it measures just the objects on edges

It doesn’t make much sense to me.

I only know the following plugins that can have something that you need:

If they do not solve your issue, I would suggest you to make a separate post and carefully describe your problem. Hopefully, the rest of the ImageJ community can help.

Just to correct the statement for the BioVoxxel Nearest Neighbor Tool… it uses the euclidean distance between the borders of the objects (not the centroids).

1 Like

I would like to thank u for the plugin that u provide, it is a really amazing plugin and it helps me a lot.
but I have a question, I am using it to measure the distances between particles from edges and it gives a matrix for all particles and the distances to each other. I wonder if there is an option to give the matrix give the distance between the particles with its neighbors just not for all particles.
thank you in advance


I’m not the author of neither of the mentioned plugins. I would suggest you to research its author and try getting in contact.

Thank you for your advice, and again thank you for your help with the plugin