Home > Image Processing > 10. Binary Operations

10. Binary Operations

Important applications, such as biomedical imaging, need the performance of accurate area detection and measurement, especially in disease examinations (e.g. malaria parasite detection, cancer cell detection). Oftentimes, noisy background obstructs the region of interest (ROI), which causes false interpretations from the image data.  Thresholding an image to binary is not able to make up for these errors due to the illegitimate features still present in the grayscaled specimen.

Methods in morphological image processing offer operators that are able to transform images and clean them from unwanted artifacts.  A good combination of the erosion and dilation techniques accomplish more sophisticated morphological operations that achieve image cleaning.  The morphological opening operator is an erosion followed by a dilation, using the same structuring element for both operations.  It reduces the size of areas that are of smaller size compared to the strel.  The closing operator, on the other hand, performs a reverse of this – it fills in small holes along areas similar to the strel.  A procedure doing opening followed by closing makes an intelligent workhorse for morphological noise removal.

For instance we have a specimen image similar to a microscope photo-capture of human cells (Figure 1).

Figure 1. An image of scattered punched paper digitized using a flatbed scanner. Suppose these circles are cells under the microscope. Courtesy of Soriano, M. [1].

We cut the big picture into sub-images of dimension 256 x 256 with slight overlap.  We perform binarization with a threshold that best captures the important parts of the image with minimal noise in the background.

Figure 2. Binarized sub-images of the cell image at optimal threshold.

For each of these images, we apply the opening and closing operations, using a structuring element shaped as a circle with a size larger than the background noise and about similar to the cells in the image.  This can then be implemented in Scilab as follows:

im = erode(im, se);    // opening, se being the cirular strel
im = dilate(im, se);
im = dilate(im, se);   // closing
im = erode(im, se);

The image, after this noise reduction method, and recombining the sub-images, produces a much excellent capture of the cells – our regions of interest (ROI) (Figure 3).

Figure 3. Cleaned image of the cell circles after undergoing morphological opening and closing operations.

In order to be able to calculate for the areas, we use the function bwlabel to distinguish connected areas in the image.

[L, n] = bwlabel(img);
area = [];
count = 1;

// scan regions for connected areas
for i = 1:n
   area(count) = length(find(L==i));
   count = count + 1;

Curiosity would raise a question on how to determine the area of the cells considering there are overlapping cells in the image. The best solution to this is to look into the histogram of the areas detected and find the range at which we are certain that overlaps are not involved.

scf(0); histplot(length(area), area);

This gives us a plot that tells us that most of the detected areas (which in our special case, are the unconnected ones) fall under the range 450-600 pixels (Figure 4A).  We can zoom into this range by creating a separate histogram for it (Figure 4B).

cells = find(area<600 & area>450);
scf(1); histplot(length(cells), area(cells));
Figure 4. Histogram of areas detected in the cleaned image. A. for all areas  B. for areas with no overlapping cells.

We can now calculate for the average area of the cells in this range, implemented by:

all_cells = area(cells);
average_area = sum(all_cells)/length(cells) //area
stdev_area = stdev(area(cells))             //error

Our calculations will result to an area A = 536.28 + 23.17.  To verify the integrity of this value, we attempt to measure the average area of the cells in a sub-image at which we are sure of no overlaps (Figure 5).

Figure 5. 10th sub-image of the cleaned binarized cells.

This gives us an area value A = 533.60 + 25.58, which is of no significant difference to our actual measurement.

Circles with cancer
Now that we know the area of the cells, we can now use these methods for cancer cell detection.  Suppose we have an image of cells now with the presence of enlarged blobs to portray abnormal cancer cells (Figure 6).

Figure 6. Another set of punched papers now with some “cells” bigger than the rest. Courtesy of Soriano, M. [1].

The technique here is to make an intelligent use of the morphological operations such that we can isolated the enlarged cells.  We instead use a structuring element with area greater than our previously measured area A.  We use a circular strel with radius R > sqrt[(μarea + σ) / π].  Oftentimes, R would need a larger value in order to eliminate clustered cells.  This will result to a binary image with the cancer cells isolated (Figure 7).

Figure 7. Isolated “cancer” cells from the set of punched papers.

Current intelligent systems already make more sophisticated applications of image isolation, wherein an image of a target property is captured separately based on a user-specified property identifier.  Nonetheless, it is the morphological operations that make up the fundamentals of these complex machines.

Credits to Dr. Soriano for the valuable tips and discussions.  I would rate myself 10 for doing an awesome job and enjoying the learning at the same time.

[1] Soriano, 2010. Binary operations. Applied Physics 186.
[2] Mathworks, 2010. Morphology fundamentals: Dilation and erosion. Image processing toolbox.

Now that we know the area of the cells, we can now use this for cancer cell detection
  1. venali sonone
    December 17, 2013 at 3:18 pm

    The resources are great.I haven’t worked much in this aspect but i would just like to have a look as my new project needs it.
    I just wanted to know if you have a image of bundel of notes can you get number of notes by someway??

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: