4. Running custom model for segmentation of fragments of cortical sections
As opposed to images, used for training the model, which were relatively small (480×480 pixels), cortical section images used to run the model to obtain segmentation results for further analysis were significantly larger: approximately 3000×4000 pixels. Surprisingly, CELLPOSE 2 takes care of sub-dividing a big image into a subset of smaller images for segmentation and assembling segmentation result into result image of the same size as initial image.
Running custom model on limited number of images is possible using CELLPOSE GUI. Processing of substantial number of images systematically requires coding in Python. Examples of required code are available as Colab script files, open for downloading (link to Colab script), as well as on Youtube (https://www.youtube.com/watch?v=rY_w0qXjGkc)
Segmentation results are available in two types of image data: grey-level images called “masks”, and sets of pixel coordinates of segmented cells called “outlines”. Masks images can be saved as grey-level images where each blob is assigned a unique grey level and represents segmentation mask of a corresponding cell. Also, this image can be used to assign a unique color to each segmented object (see Fig. 4).
Fig. 4: Color-coded results of segmentation. Each segmented cell is assigned a unique color.
Outlines, in particular, can be used to demonstrate segmentation results by drawing perimeter of segmented labels on initial images.
For practical use, we transformed “mask” images to binary images, and used “outlines” to preserve connectivity of segmented blobs. We used these binary images for morphometry and statistical analysis of cortical structure (see below).
To make a short conclusion, we have to say the following: we were involved in development of segmentation algorithms of human neocortex for many years (3, 4, 5, 6, 7). Our approach was based on algorithms of Mathematical Morphology, and implemented different languages and libraries, starting from “TASIC” (Ernst Leitz, Wetzlar, 1980-1989), ending with MAMBA-Image (Nicolas and Serge Besher, Center for Mathematical Morphology, France, http://www.mamba-image.org/, https://github.com/nicolasBeucher/mamba-image) much later. Based on our experience, we can conclude, that CELLPOSE 2 represents the best tool and provides the most robust solution among numerous solutions and libraries, developed for segmentation of microscopic images of different cell types so far. Literally, the segmentation task, which required many month or even years using prior approaches, was accomplished during several weeks using CELLPOSE 2. Needless to say, CELLPOSE 2 is one of the best examples of tremendous progress, demonstrated by recent development of Artificial Intelligence and Deep Learning algorithms so far.