Need help from scratch

Hi everyone, I tried my best reading the manual and trying examples but I still not quite understand how to use this software. :frowning:

In this simple picture, I need to count how many cells are there and count the area of each cells, and export the area value of each cells into a spreadsheet.

I tried to do these,

LoadImages
ColorToGray
IdentifyPrimaryObjects
MeasureObjectSizeShape

but in the step of IdentifyPrimaryObjects, I have no idea what’s going on here. I need some advices helping me understand this.

Thank you.

Hi,

Unfortunately, this is actually not a “simple picture” for image analysis! It looks easy by eye, but standard segmentation routines actually find it quite hard to find dark “cytoplasm” areas that do not have any marker. My first instinct was to tell you to invert the image using ImageMath, simce the Identify* modules assume you are finding bright areas as foreground and dark areas as background. Although that tactic may help a bit, the background/extracellular areas will be even brighter than the cytoplasm. So I think you need a more radical solution, but it’s actually not hard and kind of fun! And it works even better than I expected :smile:

My suggestion:
(1) Launch Ilastik, a pixel classifier that is packaged with CellProfiler. (On Windows only, Start > Program Files > Ilastik)
(2) Create an Ilastik Project, load your image file(s), and train your classifier by simply defining and drawing example regions on your image. Please refer to their documentation within ilastik, or on ilastik.org. The training set will look something like the lines drawn on this screenshot. And the probability maps look something like this screenshot with the color labels as shown on the right. For example, the ilastik project I created is attached as the .ilp.zip file (you have to unzip it first!). Note, I’d suggest you use only measure features in ilastik that are large-ish since you have fairly high resolution images and no very small features.
(3) Apply the ilastik classifier in CP using the ClassifyPixels module. An example pipeline is attached.
(4) The probability maps will help you to segment the cells with IdentifyPrimaryObjects. Screenshot here. Ilastik suggest that you simply use a “Manual” threshold since ilastik has already done the hard work of differentiating the regions for you. I chose 1-(1/3) as my threshold = 0.67 since there were three regions defined. Set to 0.5 for two.
(5) Measure and export!

I included ClassifyPixels for the other probability maps (extracellular and membrane) in the pipeline but you don’t need them for counting cells and measuring areas. It’s not as good as possible, but you can do the rest.

Cheers,
David
test_ilastik_11710.ilp.zip (6.06 MB)
pipe_ilastik_DL_11710.cp (5.77 KB)