Distance from Endpoint to First Blue Dot

I have another question that I need a bit of help with. I have an image like this:

and need to calculate the distance from the end of the red line (so closest to the center), to the first blue branch dot, then the distance between the first branch dot and the next, and the distance between the second and the third etc.

How could I approach this? I believe most of the code @Mountain_man already graciously wrote for me here would be useful. In that case, I had manually placed the dots by colour.

I figure I could find the starting end point by somehow picking the red points closest to the center of the image, then order the blue branch points based on their path/distance from the end point of the red skeleton to the first blue line?

Any thoughts? Thank you again!

Hello Ophthalmologist-

I don’t have a clean answer to your question. I’m not sure that
your question is completely well posed, so I have some clarifying
questions, below.

First, how in your analysis do you define the “next” blue dot?

When I look at the structure just to the left of center near the
upper edge of your sample image, when tracing up one of the
red branches, I can reach a nearby blue dot by turning either
left or right. Which should it be? Or should the analysis do
both and somehow construct a “network” of distances that
includes all choices?

In a similar vein, in the lower right corner, there is a triangular
structure that appears to include a closed loop of the red skeleton
(so not a “branch” in the sense of not being a closed loop).
How should that be handled? (A naive algorithm might just go
around and around in circles forever on this one.)

The sample image you posted in your previous topic was very
“clean” – this made the analysis easy. First, you had a uniform
background and dots of three well-defined colors. Second,
even though if the dots had been in somewhat different locations,
linking them together into the correct triplets would have been
more complicated, they weren’t. Therefore a simple minimum
distance criterion worked for linking.

This image – and hence the analysis – is more complicated.

This is an example of what I mean by more complicated. If I
take this proposal literally, I see the following problem. To my
eye, the tips of the branches (what I assume you mean by the
starting points) aren’t always the closest points of the red skeleton
to the center of the image. So, if I understand what you want to
do, you have to have some kind of “tip detector” to find your
starting points.

This comes back to the question I posed above: How do you
order the blue branch points when there’s a choice that might
take you around a circle or down a dead end?

You mention that in the sample image from your previous topic
you “had manually placed the dots.” In your current sample
image what processing has already been done, and was any
of it manual?

Where does the “red skeleton” come from and where do the
“blue branch points” come from?

If the blue branch points are being identified manually, I think
you could make any subsequent analysis much simpler and
more reliable if you would also manually label the tips of the
branches (assuming that they are the relevant starting points
as I’m assuming).

Also to clarify, let’s say you identify two dots the distance
between which you want to measure. Do you want the
linear “crow’s-flight” distance, or do you want the distance
as travelled along the red skeleton?

It would also be very helpful if you could post an image that
has been analyzed manually, together with the manual results,
so that we can see in detail what you are looking for.

Again, I don’t have a clean answer for you, and I’m not an expert
on which built-in Fiji / ImageJ tools could be helpful. Fiji / ImageJ
does offer a Processs > Binary > Skeletonize command,
but I don’t know whether your starting image can successfully
be pre-processed in a way that makes the Skeletonize
command do what you want.

Perhaps posting a sample manual analysis could help other
forum participants make useful suggestions.

(Also, for experimenting with analysis, unless your original
images are, in fact, .jpg’s, may I suggest that you post your
original images in a non-lossy format such as .tif or .png so
that lossy compression artifacts don’t complicate the analysis?
I would recommend .png’s because they seem to be a little more
forum / browser friendly.)

Thanks, mm