Size filter on secondary objects


I’ve noticed that when I use a lectin stain to identify secondary objects (cells) with DAPI-stained nuclei as seed objects that when there is a space in the well with no cells, the IdentifySecondayObjects module will sometimes created one giant cell, seeded off of the nearest nucleus to the empty space and covering all of the empty space. This is mostly a thresholding issue (high background) but it seems like a size filter in the IdentifySecondaryObjects module might get around it… How hard would that be for me to implement?


Hi Michelle,

One option is to use MeasureObjectSizeShape to measure the areas of all your objects and then use FilterObjects to exclude objects larger than a given size.

However, it sounds like you may have a thresholding problem. The borders of the cell are controlled by the choice of thresholding method and upper/lower limits just as in IdentifyPrimaryObjects; if your cells are much bigger than they ought to be, it may be that your threshold is too low. Changing the thresholding method or adjusting the lower bound may give you better results. If you like, you can post your pipeline and an image in which IdentifySecondayObjects goes awry to see if it needs optimization.


Hi Mark,

I’ve attaching two of the problematic images and the pipeline. The images are fluorescent lectin-stained sheets of cells. The first is nearly confluent but with a couple of empty patches and the second is much more sparse (the third and fourth images are the corresponding nuclei). The problem seems to be setting a lower bound on the threshold that achieves a balance between producing secondary objects that are almost identical to the primary nuclei and segmenting the empty space in image 2 to be part of giant cells. In the case of the former image, I’ve not been able to find parameters that are able to exclude the empty space at the lower right… I’ve played around with the regularization factor and the lower bound on the threshold but haven’t changed the method to identify secondary objects or the thresholding method.

I’ve also attached the first half of the pipeline (through identifying secondary objects).

(I want the segmenting to be as precise as possible because I’m looking for bacteria in the cells and don’t want to get results that classify extracellular bacteria as intracellular.)

Thanks for your help!
LectinObjectsOnly.cp (9.63 KB)

oops, I attached the wrong pipeline above. the correct one is now attached (without the EnhanceEdges module, which doesn’t seem to help the problem)

LectinObjectsOnly.cp (9.1 KB)

Hi Michelle,

I’ve made some tweaks to the pipeline (attached), which should help although it’s not perfect:

  • The illumination correction is meant to create a function which looks like a typical microscope illumination pattern, which is usually broad and smooth. Your function was not doing this, and created functions which corrected poorly for the next step. I’ve changed this accordingly.
  • I changed the thresholding method in IdentifySecondary to Otsu 3-class with the middle class set to foreground, since your cells are not terribly bright as compared to the background/non-stained cells (couldn’t tell which). This tends to capture more of the cell body which was okay for the more confluent image, but created the large patches on the sparse image. So I compromised by adjusting the threshold correction factor slightly downwards (to capture more), while setting a lower limit (to keep it from capturing too much). However, unless your images are consistent in terms of your image acquisition protocol, this lower limit may fail for other images.
  • I changed the identification method to Watershed-gradient in IdentifySecondary which does a better job of capturing the cell edges, though it still has some trouble with the confluent cell edges.

2011_02_18.cp (7.75 KB)