Our activity here focuses on extracting a certain region of interest (ROI). It will allow us to utilize the skills we've acquired from the previous activities, particularly those of morphological operations. We're tasked to look at 'cells' in images, extract them as our ROI and calculate the average size of the ROI. Armed with this knowledge, we can then detect which cells have grown disproportionately, or rather, have become cancerous.
Figure 1 shows a set of what we'll consider as our normal, healthy cells. We analyze the image in sections of 256x256 pixels. Each section is converted to binary based on its histogram, and the ROI is polished using our morphological operations.
![]() |
| Figure 1. Scattered punched paper that will simulate normal, healthy cells. |
After much hard work (on around 14 overlapping sections!), we extract the cells from the background as in Figure 2. We use a color map to easily find where clumps of cells still remain, and we separate them from the single cells before we finally calculate the mean cell size. The mean cell size is 534.0417 pixels with a standard deviation of 15.3297 pixels.
![]() |
| Figure 2. Color map of cells in Figure 1, extracted from the background. Areas with the same color have the same value on the map. |
We inspect a collection of cells with a few cancerous cells, shown by Figure 3. Of course, visually, the overgrown cancerous cells are easy to find considering the small size of Figure 3 and the small number of cells in the image. But for our activity, we'll process the image as if we cannot visually find the cancerous cells.
We again extract the cells from the background and discard the clumps of normal, healthy cells. Thankfully, the cancerous cells are not attached to these clumps so we can quickly discard them from our analysis.
Figure 3. Scattered punched paper that will simulate normal, healthy cells
interspersed with cancerous cells. Which are cancerous?
|
We again extract the cells from the background and discard the clumps of normal, healthy cells. Thankfully, the cancerous cells are not attached to these clumps so we can quickly discard them from our analysis.
![]() |
| Figure 4. Color map of cells in Figure 3, extracted from the background. Areas with the same color have the same value on the map. |
The mean cell size and standard deviation from our healthy cells can be used as a threshold to extract the cancerous cells. Figure 5 portrays the cancerous cells (as considered by our threshold) in yellow while healthy cells are in maroon. Although the cancerous cells were segmented from the background, we somehow manage to get healthy cells too!
But a second look at Figure 1 and Figure 3 tells us that the cells are not of the same size in the images. We scale the mean cell size and standard deviation values from Figure 1 to match the mean cell size of healthy cells in Figure 3, and ta-da! The cancerous cells are finally segmented from the rest.
Now we have to give someone the bad news... or do we?
Using our image processing powers, we will try to cure our patient of their cancer by eroding the cancerous cells until they shrink to a healthy size. The verdict?
No more cancer!
Grading
Now we have to give someone the bad news... or do we?
Using our image processing powers, we will try to cure our patient of their cancer by eroding the cancerous cells until they shrink to a healthy size. The verdict?
No more cancer!
![]() |
| Figure 7. No more cancer! Orange cells used to be cancerous but we've shrunk them down to normal size like our healthy maroon cells. |
Grading
Because I was able to cure cancer besides detecting the patient's cancerous cells, I give myself 11/10 and a Nobel Prize. Yay!
This activity was rather frustrating for me, mainly because I couldn't decide whether I was satisfied with the segmentation in each section. I was literally coming back to previous sections to try to isolate more cells to improve the mean cell size value, as well as increasing the overlapping sections. I had to stop and forcefully convince myself that my work was good enough, or else I would still be trying to segment my ROI. :O
Acknowledgements
I would like to acknowledge Floyd Willis Patricio for reminding me through a Facebook chat that an erosion followed by a dilation with the same structuring element is mainly an opening operation. Haha. I was too engrossed with trying to experiment with a good combination of morphological operations that I had forgotten what an opening operation technically entailed, thus having a code filled with imerode-imdilate's (instead of the sensible imopen's).
This activity was rather frustrating for me, mainly because I couldn't decide whether I was satisfied with the segmentation in each section. I was literally coming back to previous sections to try to isolate more cells to improve the mean cell size value, as well as increasing the overlapping sections. I had to stop and forcefully convince myself that my work was good enough, or else I would still be trying to segment my ROI. :O
Acknowledgements
I would like to acknowledge Floyd Willis Patricio for reminding me through a Facebook chat that an erosion followed by a dilation with the same structuring element is mainly an opening operation. Haha. I was too engrossed with trying to experiment with a good combination of morphological operations that I had forgotten what an opening operation technically entailed, thus having a code filled with imerode-imdilate's (instead of the sensible imopen's).







No comments:
Post a Comment