Demo iadcells

Extract blood cells and separate them.

Description

A microscopic gray-scale image containing blood cells is segmented and further processed for the separation of superposed cells. The segmentation procedure is based on gray-scale connected filtering and threshold, while the separation procedure is based on the classical watershed approach.

Script

Reading and elimination of white pores

First, the blood cells image is read. Then, the gray-scale area open operator is applied for removing small white pores over the cells.

1. from ia870 import *
2. 
3. a = adreadgray('bloodcells.tif')
4. adshow(a)
5. b = iaareaopen(a,200)
6. adshow(b)

Threshold and shape smoothing

The threshold of dark areas produces the segmented image (i.e., the region where there are cells). Then the opening by a small disk performs smoothing of the cells borders.

1. c = iacmp( uint8(0), '<=', b, '<=', uint8(140))
2. adshow(c)
3. d = iaopen(c,iasedisk(2,'2D','OCTAGON'))
4. adshow(d)

Marking

A marker for each cell is obtained by dilating the regional maximum of the distance transform. For visualization illustration, the distance transform is viewed as a topographic surface shading on the left and the dilated regional maximum is displayed in read overlayed on the surface view.

1. e1 = iadist(d, iasebox(),'EUCLIDEAN')
2. e2 = iagsurf(e1)
3. adshow( e2)
4. e3 = iaregmax(e1)
5. e  = iadil(e3)
6. adshow( iagshow(e2, e))

Geodesic SKIZ

The watershed, constrained by the markers image, is applied to the negation of the distance function. The result of this procedure is also called geodesic SKIZ. For visualization, on the left the negate distance function is displayed as a topographic surface, and on the right this surface is superposed by the markers and the detected watershed lines.

1. f = ianeg(e1)
2. fs = iagsurf(f)
3. adshow(fs)
4. g = iacwatershed( f, e, iasebox())
5. adshow( iagshow(fs, g, e))

Cell separation

The geodesic SKIZ (i.e., watershed division lines) is subtracted from the segmented image, separating the cells. On the left the detected watershed lines is overlayed on the cells binary image, and on the right, the cells image separated using the watershed lines.

1. adshow(iagshow(c,g))
2. h = iaintersec(c,ianeg(g))
3. adshow(h)

Edge off

The cells that touch the frame of the image are removed.

1. i = iaedgeoff(h)
2. adshow(i)

Final display

Superposition of the contour of the detected cells on the original image.

1. j=iagradm(i)
2. adshow(iagshow(a,j))