Measuring Length for String-like objects


I’m trying to build a pipeline in CellProfiler to quantify the length changes of string-like objects. My two current issues with the pipeline are with optimizing the object identification, and producing the type of output measurement I need.

For the pipeline, it currently sometimes correctly identifies the objects (see Images A &B), but often times inappropriately splits objects (see Images C & D). I’ve tried increasing the Tubeness Smoothing, but that ends up creating artifacts that get identified (see Image E), which I can’t eliminate based on size, since they fit into the length range for other objects I want identified (see Image F) and often times still isn’t enough to prevent mis-segementation (see Image G).

In terms of the output measurement, what I’m looking to do is replicate the measurement generated by measuring the segmented line length in ImageJ (see Images H & I). Essentially, I’m trying to find the path-length of each object identified. Currently I do this in ImageJ by using to segmented line object and measuring the line’s length. This is highly time consuming, and I thought CellProfiler would massively increase the efficiency on this.

Because these objects often curve, it seems that ‘MajorAxisLength’ would eventually underestimate object lengths, as it my understanding is that it is computed as the major axis of an ellipse surrounding the object. Thus, a serpentine-like object’s length would be expected to be underestimated. Based on forum searching, I tried the suggestion of skeletonizing the object and taking the area, but that seems to often dramatically underestimate object length, and because of the branches created, likely throws off the measurement as well. I tried using the ‘straighten worms’ module to straighten out the objects (and perhaps potentially fix my object identification issue), but CellProfiler keeps crashing mid-way through whenever I try to create my TrainingSet. My thought is that if I could straighten the objects, then I could then take the MajorAxisLength and have it be accurate.

Sorry for the somewhat long post, but my questions boil down to:
Do you have any suggestions for improving my object identification problems?
Could you clarify the way in which MajorAxisLength is calculated?
Suggestions on how to bypass the crashes I get from when trying to train in UntangleWorms?
If I am able to straighten worms, could I subsequently use the output image to re-identify, and then measure my (straightened) object?

Thank you!

Image A … 9417203490
Image B … 5875247138
Image C … 9925896242
Image D … 6212395490
Image E … 6425751826
Image F … 3198895890
Image G … 2807667634
Image H … 6254034834
Image I … 3222552738

Input Images for Pipeline: … 0836091122 … 0745098770
Gacks_Training.cpproj (560 KB)
Gacks_MeasureV6.cpproj (518 KB)

I tried inserting a Smooth module to reduce noise, and fed the output of that into the EnhanceOrSupress module, and seemed to work better. I used the “Smooth Keeping Edges” method, with the artifact diameter set to 5 and edge intensity difference set to 0.5. Then I upped the threshold correction factor a bit in IdentifyPrimary to filter out more of the spurious false positives, though I assume that you are using EditObjects for that a bit?

I think you have the basic idea already. The typical use case is for blobby objects, so for long, thin objects, it wouldn’t be expected as work as well.

I’m not able to produce the crash with the two images you sent. Could you repost the error message, and maybe a screenshot of the binary image that it is training on when it crashes?

In ‘untangle’ mode, one of the per-‘worm’ output measurements is length. I assume that would be the answer you want without any further processing?

Thanks so much!

Regarding the crash that happens when trying to train for untangleworms (I ran the pipeline again just to be sure it was consistently happening). I made a mistake when explaining where my pipeline to train for untangling crashes, it happens during the EditObjectsManually module, and usually happens somewhere like 5-10 images in. What’s strange is that when I ran the pipeline today, it actually warned me of an error in cellprofiler processing (see screenshots), which didn’t happen before. After clicking ‘continue processing’ ~3x times, then the program went on to crash. I can’t post my mac’s error message following the crash, I tried to upload it as a .rtf and as a .docx file but it wouldn’t let me. I also can’t paste the error message in the post since it exceeds the text limit. I could screenshot it if that would help? … 4350602210 … 0601172338

Thank you!!

You can package it in a ZIP file and upload that.

Okay here are the Crash Reports. I posted both yesterdays and todays in case it is useful.

Thank you! (31.6 KB) (30.8 KB)

Thank you so much for providing truly an informative knowledge. I am glad to know about it.