Calculate the length of thread




I find someone ask "Measuring the length of tight junctions - length " a month ago and he/she seems to manage this problem. Unluckily, she did not upload the pipeline so I do not know how to make it. Recently, I am trying to do something similar, namely calculate the length of thread. I hope someone can show me some suggestion.

I modified the image, and post it here:


I write a pipeline myself, and here is the brief introduction:

Here is my pipeline:
thread.cppipe (6.7 KB)

You can see currently, there exist such problems:

Identifyprimary is not good. I even have a hole when identify the image. I need to calculate the length of thread between those connections. But the current object is not what I want.

I hope someone can show some suggestion. Thank you.

Something is wrong with the upload. Please find the image in this link:



Hi Dingcheng,

First : many thanks for your active help for others in the forum. We definitely need such valuable contributions from everyone. Really appreciate it. Keep up the good work !

In your IDprimary, at option “Fill holes in identified objects”, try to set it to “Never”.
It will help to retain only the threads and not filling the empty space.

Then at the "Typical diameter of objects", your current setting 1-9 is too small, tune it up to something like 10-40 for a longer object.

Next, in your “Method to distinguish clumped objects” : don’t use “Intensity”. Actually, you should not use anything here, if your goal is to measure the length of connected threads.

You may try to split the object “SplitOrMergeObjects” after IDprimary, or using some preprocessing trick like Erosion before IDprimary to disconnect the branches.

Hope that will help.



Hi Minh:

Thank you for your reply. I am glad to help others, and I am also very happy to get help from others.

In fact I find out a way by combining the Cellprofiler and MATLAB. It takes time but the result is not bad. Here is how I do it:

Besides those calculated from MeasureObjectSizeShape, I also need those:

  1. Length of thread
  2. Tortuosity of thread (length/distance)

Currently, I did not figure out how to do it the Cellprofiler, but it is quite easy in MATLAB. As you see, I put the value of length on the image:

So, I summarize my questions here:

  1. Can I measure the length and Tortuosity of thread in Cellprofiler?
  2. How to break the connection point and get segmented thread in the Cellprofiler? (maybe SplitOrMergeObjects work. But I have no idea)

Thank you


That ! is a really good MATLAB solution.

In CP3.0, I think the module that deals most with branching points would be MeasureObjectSkeleton (in “Advance”). Can you have a try “NumberBranchEnds” and “TotalObjectSkeletonLength

It deserves a serious look from other experts of the team. Will discuss this with other assay dev.

Great job!



I have tried, but I still don’t understand what is ‘seed object’ in the MeasureObjectSkeleton. You must be the expert in this area, and I hope you can help me improve this.


branch.cppipe (7.2 KB)


Seed objects are small objects within a larger one- typically this would be “I’m going to find a nucleus, use that as my seed object, and then try to calculate the lengths of processes off that neuron”. It doesn’t particularly apply in your case.

You can find your branchpoints in CP without havivng to go into MatLab using Morph’s "Branchpoint’ option on your skeletonized image.

You should be able to at least approximate the length of thread in these images by measuring the area of the skeltonized objects (since their width is 1, area == length). I think your “tortuosity” should be able to be approximated by the “area” (which again, is length) divided by the MajorAxisLength (which should be approximately equal to the distance), but you should check empirically to see if that’s close enough for your purposes.