# How to join vectors in counting function

Hi Forum,

I'm trying to count the length and branchpoints in images of tubes. The 'Vectorize' Count picks up most of what I want, but does not connect vectors at branch points (see picture below).

I've made a mask of the vectors and used the dilate filter to connect all vectors. However, when counting the processed image, branch points are still disconnected.

Furthermore, if it's possible to connect the vectors, is there a way of counting the number of branch points per continuous tube? I know how to use the branch end filter, but is it possible to get a read-out of the number of branch points in each tube?

Thanks a lot,
Henri

Henri,

In that case you can just segment the skeletonized image as "Objects" (not Vectorize) and measure the Area of the skeleton, it will give you the number of pixels in the skeleton, which is correlated to the total Length of the skeleton.

Yuri

• Hi Henri,

If you want to count branch points, then you should apply Thinning filter and then Branch End filter (with Branches selected):

The result image will have Points at branch-point locations, then you just segment these points and count.

Yuri

• Thanks Yuri,

But my bigger problem is that lines, which are connected are picked up as multiple vectors. Is there a way of getting one single length measurement for all parts of a tube which are connected.

For the branch points, it would be nice (but not essential) to have those counts per tube. For example:
Tube 1: length = x , branch points = y
tube 2: length = x .....

Thank you!
• Hi Henry,

You can use Pruning filter (after Thinning) to remove short branches, after that you can count the number of real branch points.

Yuri
• Hi Yuri,

Sorry, I don't think I've explained this very well. I've attached another picture to show the different tubes: Ideally I'd like one length measurement per tube. But as all vectors are disconnected (see smaller circles) I can only get the total length within one image.