Segmentation: Onward Toward Single Cell Analysis

Onward! Towards single cell analysis

I filtered out cells that are were not positively labeled in CellProfiler with the Simple Segmentation images/masks made in ilastik. Then, I filtered out cells based on size and circularity. Lastly, I cropped out objects from each image into separate images. I’ll walk you through what I did to make this happen.

Spare you the details…or not

The details I’m describing refer to the CellProfiler pipeline I created. I’ll make my CellProfiler pipeline publicly available here. The segmentation mask/images from ilastik have very small intensity values (0 to approximately 0.01). Thus, I had to re-scale the intensities (5th step in my pipeline) to segment cells properly in CellProfiler. Next, with the ConvertImageToObjects, MeasureObjectSizeShape, and FilterObjects modules (6th through 10th steps in my pipeline), objects smaller than 80 pixels were excluded to remove non-specific labeling around nuclei and fluorescent debris. I had better results repeating the filtering steps making some modifications to the filtering criteria (11th through 15th steps).
Cell profiler causes erosion when converting images to objects. Thus, to regain the area that was lost during conversion to objects I included dilation steps in my pipeline.

My pipeline saves the mask and the segmented areas that are considered positively labeled. The images are cropped to exclude area that do not have positively labeled (i.e. fluorescent) cells.

Filtering steps based on size cutoff (max/min) may not work for each batch of immunocytochemicaly labeled cells, due to differences in non-specific labeling and batch processing. This will lead to false negative or positives; you may include cells that are not labeled specifically. If it is not done properly then false positives occur. So, if labeling is not consistent, from batch to batch, and it typically is not, then selecting a cut off size that will be applicable is challenging. This seems like an opportunity to create a “hyper parameter” which could be trained in a model to maximize a cutoff size which would maximize your valuation metric (e.g. accuracy or F-score).

Custom Script to Crop Object to Individual Images

To my knowledge, Cell Proiler does not have the ability to save each segmented area or object into separate images, but it may be possible soon. In the mean time you can use OpenCV in Python to cut cell(s) in segmented areas into separate files. The cropped images at the top of this post were created using the Python. I’ve posted my script below. Next up, extracting features from my cropped images using a pre-trained deep neural network.