Our software takes in two inputs: the nd2 file of all the z-stacks (from the NIS Elements software) and an excel sheet of all the coordinates to all the z-stacks (from the NIS Elements Image Properties menu). To have accurate results and reduce auto-contrast biases, the luminance of z-stack channels must be normalized. A Python function, which is based on the lumMatch function from the MATLAB SHINE Toolbox, was written to normalize luminance. Salt and pepper noise is a further complication that could affect results, so a Python script to apply a Median blur (provided by the OpenCV module) was written to enhance cell segmentation. Doing this would enhance cell segmentation and performance.
Using the contour and centroid that are identified in the previous step, each 3D object in a Z-stack needs to be identified and labeled. To classify each blob on the 2D images into corresponding 3D objects, two tests are created. The first test calculates the distance of blob centroids between two consecutive images of Z-stack. If those centroids are close enough (within the smallest radius of the two), then it goes to the second test. If the centroids are not close enough, the blobs are of different objects. The second test uses the contour to test whether or not those have a overlapped area. If the blobs pass both tests (i.e. blob centroids are close and contours are overlapping enough), they are considered to be the same object. This set of tests was applied for every combination of consecutive 2D objects to identify the location and number of 3D objects. This allows us to recapitulate the 3D space from 2D images.
As we want to photoconvert only spherical 3D cell clonies, the previously identified 3D objects need to be assessed for its phenotype: sphere or non-sphere. To do so, we tested the circularity of 2D blobs. Our circularity test consists of three parameters: circularity, solidity (convexity), and elongation. Circularity, or roundness, is defined as 4pi times area divided by the square of convex perimeter. This is the basic function to test the circularity of blob. To further examine its ciruclarity, two other factors, solidity (convexity) and elongation factor, are used. Solidity is defined as the ratio between area and convex area; it tests how convex a shape is. Elongation tests how elongated a shape is by compare the second moments. The thresholds for these three parameters are set to 0.8, 0.8, 0.5, respectively. When a blob passes all three parameter tests, the blob is classified as circular. Finally, if all the blobs that belong to a 3D object pass the three parameter test, then the 3D object is determined to be spherical which is the phenotype that links to the invasive cancer cell, our target.
The source code for our cell segmentation diagram can be found at the following Github Repository:
https://github.com/enc013/G31_cell_segmentation.git
Please refer to it for installation and how to use it.