Counting tapeworm segments- please help

segmentation
Tags: #<Tag:0x00007fd54054a318>

#1

Hi everyone,

I need to count the number of segments on tapeworms (or pieces of tapeworms) and I’m trying to do this is an automated way. The problem is that these segments are in the process of development so they are not exactly alike in either size or morphology (as seen from samples stained with DAPI). It’s a clearly metameric pattern that the human eye is really good at picking-out. So right now, I use the cell counter feature and click on the individual segments to keep count of them. Can I use some plug-in to just upload my image and get the number of segments reported back to me?

Additionally, if I can subdivide the segments into types (immature, mature, pregravid/gravid), I would also like to be able to do that, if at all possible. There are no sharp transitions so it’s a little subjective but here’s my rough criteria:
immature: from the first segment to the point that there is only one clear central dot (it’s the ovary)
mature: 4 dots visible and spread “linearly” (ovary and 3 testes that will continue to develop)
pregravid/gravid: hazy structure (expanded uterus, outlined in image) as testes and ovary degenerate

I’ve uploaded an example image of a tapeworm fragment. There’s a second image where I have demarcated the rough transitions between the segment types that I would like to get. I had to reduce the file size in order to upload the images. The higher resolution files can be found at this dropbox link: https://www.dropbox.com/sh/v3s2gi6h1m4t8xj/AADdPxLS5paw6wqzV3vBCoHMa?dl=0

Anybody know how to help me?

Thanks!
-tania

Original tif: http://forum.imagej.net/uploads/default/original/2X/2/28d82d4e61329be9e3226d70c60c20296c1eba1c.tif

Original tif: http://forum.imagej.net/uploads/default/original/2X/f/f2febce9ee66994b1fdbc31d1704009f0b5f4b84.tif


#2

With the method described below I get around 517 segments. Does this match with manual counting?

Here´s what I did (on the full sized tiff). It makes use of a BAR script --> BAR update sites need to be activated:

Draw a segmented line through the middle of the worm

Edit > Selection > Straighten … (line width 100 px)
In the new straightened Image:
Select all (Ctrl + A)

Analyze > Plot Profile

On the profile plot:
BAR > Data analysis > Find Peaks (Min. peak amplitude set to 1):

–> 517 maxima = segments


#3

Oh, that’s a clever solution. But I’m afraid that by manual counting there are only 395 segments.


#4

@cestodelavie

Welcome to the Forum! So great that you posted here! :slight_smile:

You might just have to alter the settings a bit (might also depend a bit on the initial segmented line that is drawn. This introduces a bit of bias - but beats counting by hand!). Perhaps some pre-processing is needed before plotting the profile… check out that list of filters, etc. and see.

This option in BAR though really looks promising! Try playing with it a bit … perhaps try on varying samples to see if you get relatively ‘close’ counts.

eta


#5

Here are some refinements suggestions:
100 px line width for the staighten command was a little too small when I tried it again I used 180.

Then I think that the DAPI staining is rather bad for the method suggested here. This is a crude way to eliminate the DAPI-confusion:
Image > Adjust > Brightness Contrast
set the Min Max sliders to 0 and 56, resp. and press Apply.

Smoothen the image a little bit:
Process > Filters > Gaussian blur (Sigma 1)

You should get something like this:

Then do the profile plot from only the upper half of the worm (red box)

This gives me 388 maxima (find peaks settings as in the previous post). Of course there are for sure mistakes especially in the regions where the worm is twisted.


#6

Thanks for that! I can definitely cut the worms to avoid the twists and acquire images that way.


#7

@cestodelavie

Just checking in… for whatever reason - your segmentation issue popped into my head today. I have some new ideas and potential tools you could use… if you are interested, and it’s still needed.

Just to throw them out there - perhaps you want to look into the following tools/plugins:

  • Analyze Skeleton - you can use this to calculate the longest shortest path - ie. an automatic line drawn through the middle of your worm - no more manual drawing… you can see how it was used in this way on this old forum thread.

  • MorphoLibJ - tons of great tools for segmenting, irregular watershed, and tons of measurement goodies, including geodesic distance transform, etc.

  • Trainable Weka Segmentation - you could use this machine learning tool to create classes for each of your segment types.

Let me know either way.

eta :slight_smile: