Count nuclei and capillars in two different muscle fiber types




I would like to count the number of nuclei and capillars in two different types of muscular fibers. Type1 are in green and the membrane of all fibers (type1 and type2) is in red (i.e., fibers of type2 are those which are not type1). Capillars are in b/n and nuclei in blue. I have the 4 channels in individual images.

I have a very basic idea about how to develop the pipeline but I’m not able to separate each fiber silhouette properly:

Counting nuclei
Color to Gray

For counting all fibers (red)
Color to Gray
EnhanceOrSupressFeatures (Neurites/Tubeness)
ImageMath (invert)

For counting type1 (green)
Color to Gray

For counting capillaries
I’m not sure how to do it…

Once I count all the features I guess I have to use something like RelateObjects to calculate the number of nuclei and capillaries per fibre.

Any suggestions will be very much welcome.

Thank you very much in advance

I attach one example of each image.


Hi @ge2sasag, you can build off of the pipeline we discussed in Analysis of diffuse and uneven muscle staining

For counting all fibers (red)
Follow the method in the previous pipeline

For counting type1 (green)
From all the fiber objects found in the red channel, measure the type1 intensities from the green image.
Sort the fibers into type1 and type2 objects using the FilterObjects module

Note: it is clear that I did not choose the best threshold to use in the FilterObjects module. Please update the threshold and play with other features to separate your objects; this, I suppose, is being left as an exercise. It looks like a single intensity feature will get the job done.

Counting nuclei and capillaries
Use IdentifyPrimaryObjects for each.

How will you decide to assign a nuclei or capillary to a fiber? One way to do this is to grant nuclei and capillaries multiple memberships, e.g. a nuclei can be related to a type1 fiber and a type2 fiber, and there doesn’t need to be a 1-to-1 assignment. We can consolidate the individual types of fibers and then relate these object groups to the nuclei and capillaries. Here is an example of the kind of relationships you can quantify:

Total Counts


When you process more images you can create error bars and calculate statistical significance. Good luck! (4.8 MB)

Analysis of diffuse and uneven muscle staining

Wow!! :crazy_face: THANK YOU VERY MUCH!! This helps a lot! I will play around with the settings. Without help it would have been very difficult to figure it out how to count the type1 fibers, I’ve been stuck there for a while.

Is it possible to count the memberships for nuclei and capillaries individually? I mean, skipping the merge step to see how many of them are shared. Could it be useful to calculate the minimum distance of parent-child? i.e., those with similar distances are shared.


Hi @ge2sasag, you can measure memberships of nuclei and capillaries for individual fibers, but the solutions will become more complicated. I’ve attached a zip file with one approach that relates individual fibers to surrounding nuclei and capillaries. (5.1 MB)

Single fiber measurements will give a different perspective on your data (but one you might be able to approach using multiple images with the previous approach):


Your idea for thresholding parent child distances is a good idea. You could also do a nearest neighbor analysis entirely outside of CellProfiler, too. The approach I include in the zip file requires two separate CellProfiler pipelines: one to find the fibers, and another to analyze each fiber on its own. The advantage is that you won’t need additional processing outside of CellProfiler to quantify these relationships. The disadvantage is the multiple pipelines and the relevant relationships will be distributed across several tables.

There are also some additional caveats. These pipelines would require you to run the nightly version of CellProfiler, because some of the modules require recent updates (as of July 2018). The analysis becomes more complicated, too, for data from individual nuclei, capillaries, and fibers exists across multiple tables. It is all possible, but I believe whatever solution you pursue will require more work to both process and analyze the data.



Thanks a lot!! I definitely will play around with all your suggestions, I think I can get a lot of information out of it! What is the nightly version?

I was thinking lately about another way to see how to know the shared objects considering all the fibers together. I took the output figure from RelateObjects for nuclei from both fiber types and I did an overlap of both images in Photoshop, the nuclei in pink are the shared ones between both fiber type:


This is very gross, and probably can be done in Cellprofiler, including the counting of them (with FilterObjects or maybe with inverted mask?), but just to show you my idea.


Great thinking! Your visual immediately conveys what you’re after.

Conveniently, this information is already captured by the first version of the pipeline. Please refer to the columns Parent_ExpandedMergedFibersType1 and Parent_ExpandedMergedFibersType2 in the MyExpt_nuclei.csv. The “pink” nuclei will be those that have both type1 and type2 fiber objects as parents.

The nightly version of CellProfiler can be installed by following the instructions at GitHub.


That’s great! I just localized the columns you mentioned and yes, it’s matching with what I can count manually in the picture! :smiley: Thanks a lot for your help and the nice discussion, I learned a lot!


Hi again @karhohs, I’ve been struggling with something else afterwards. I want to count only the nuclei that are inside or at least overlaping with the cytoplasm at least 50%. Just to clarify a bit more, I want to count the nuclei that are facing the inner laminin border (or at least 50% inside the cytoplasm) for type1 and type2 (green ones), marked with white arrows, but excluding the others which are outside or not overlaping 50% (yellow arrows). So far I managed to identify a decent amount of nuclei inside but it also detects some nuclei which are outside. Working on laminin image, I followed the pipeline attached.

musclefiber_counts_maskobjects.cpproj (834.6 KB)