Mga Pahina

Martes, Agosto 20, 2013

Application of Binary Operations 1: Blob Analaysis

Here we go again. Time really flies. We're now down to our 11th activity! It seems like yesterday that I was exploring the syntax and functions used in Scilab. This time, we are more equipped with the knowledge and programming skills to deal with more challenging problems. Our topic this time is blob analysis which integrates all the lessons we have learned from the past. In segmenting an image, we often find the suitable region of interest (ROI) and apply thresholding or color image segmentation. Sometimes, the image that we have an overlap in the graylevel histogram of the ROI and the background[1]. In cases like this, the binarized image has to be further cleaned using morphological operations such as opening or closing to be able to separate the region of interest from the unwanted parts that was segmented. Now, you may be wondering what are opening and closing operations. If you have read my previous blog regarding morphological operations, you must be knowledgeable on erosion and dilation. Opening is often done to preserve foreground regions that are similar to the chosen structuring element[2]. It is done by performing erosion and then followed by dilation. Thus, opening is not as destructive as erosion, and is used if the main goal is to remove unwanted dirt in the segmented image.

The aim is to apply binary operations to be able to analyze blobs of a given cell sample. The sample cell image is shown in the figure below.

Figure 1. Normal cell sample (left) and the image subject to be analyzed (right)

The first task is to separate the cell sample image into a number of 256x256 pixels of subimages, and to get the correct threshold from the its histogram that would separate the image from the background. I generated the histogram for the whole image using Scilab this is shown in the next figure.

Figure 2. Histogram of the Cell Sample and the thresholded image

The image shows a bimodal histogram which dictates that the most number of counts corresponds to the background. From this, we can extract the correct threshold that should be used  if we aim to binarized the image and separate the region of interests (cells) from the gray background. For the whole image, I used 222 as the threshold. I also tried using 215 as the threshold value and compared the results with the first. 

Figure 3. Result of thresholding the image at 222 and 215

Notice that the resulting thresholded images shows some irregular shapes. Thus, we use morphological operations to "clean" the image so that the image left is that of regularly sized circular shapes. I used the opening operation since my aim here is to remove the dirt outside  region of interests. The structuring element that I used is a circle with a radius of 11 units. The result of applying morphological operations and filtering by size is shown in the following image.

Figure 4. Filtered image using Morphological Operation (Opening)

The use of two different threshold affects the resulting image after applying the opening operator significantly. Since we want to determine the average size of each cell and obtain a standard deviation that would give us the best estimates of the normal cell size, I obtained the pixel area of each blob in the image and obtained the histogram of the all the area. This is shown in the following figure.
Figure 5. Histogram of the area computed for each blob in the filtered image


In this histogram, we can obtain the majority pixel area of the blobs. Those that are greater than 600 corresponds to the area of the cells that are overlapping. We can thus exclude these and use filter by size using the correct interval of area. Using the information from the above histogram, I was able to separate those normal cells that are not interconnected. Using these, I calculated the best estimates of their size and obtained the same value for the 222 threshold and 215 threshold. The best estimate, same for both, is 474.03448+- 50.314357 pixels. The picture below are the resulting individual blobs for each threshold used.
Figure 6. Filtered individual blobs using the histogram of the area count

We can now use the best estimate we obtained in separating the abnormally large cancer cells in the next image.
Figure 7. Applying the best estimate for a normal sized cell

Finally, using a larger structuring element and the inspection of the histogram of the area count of all continuous blobs, I was able to separate the abnormally sized cells. The image is shown below:
Figure 8. Abnormally large cells separated from the rest of the normal cells


In this activity, I give myself a grade of 10/10 for all that is required and being able to determine the effect of changing the threshold and radius of structuring element. 





[1] Maricor Soriano. Activity 11 Manual Application of Binary Operations 1: Blob Analaysis


Walang komento:

Mag-post ng isang Komento