Demo iadfila


Detect Filarial Worms.


This procedure extracts the filarial worms from a complex microscopic image by eliminating progressively the other objects present in the image. The selection of the structures begins in the gray-scale level and, after a threshold, continues based on the object geometrical properties.



A microscopic gray-scale image, with two filarial worms, is read.

1. a = adreadgray('danaus.tif')
2. adshow(a)

Background regularization.

The Close by Reconstruction Top-Hat operator is applied to regularize the image background.

1. from ia870 import iacloserecth
2. from ia870 import iasebox
4. b = iacloserecth(a,iasebox(5))
5. adshow(b)

Removing narrow objects

The gray-scale opening by the elementary cross is applied to remove narrow objects.

1. from ia870 import iaopen
3. c = iaopen(b)
4. adshow(c)

Removing small objects

The gray-scale area open operator is applied to remove small objects.

1. from ia870 import iaareaopen
3. t1 = time.time()
4. d = iaareaopen(c,200)
5. print time.time() - t1, 'seconds'
6. adshow(d)
1.91921591759 seconds


The threshold operator is applied to extract a reduced set of structures that include the two worms present in the image.

1. e = (d >50)
2. adshow(e)


The objective of the sequence of transformations, that begin with the homotopic skeleton, is to eliminateg the structures that are not worms. The information used for the filtering is that the worms are longer than any other structure found.

1. from ia870 import iathin
3. f = iathin(e)
4. adshow(f)

Elimination of short structures

The first 12 points of the skeleton branches, counting from their extremities, are eliminated. The structures that were not eliminated will be the markers for extracting the two worms.

1. from ia870 import iaendpoints
3. g = iathin(f,iaendpoints(), 12)
4. adshow(g)

Extraction of the worms from their markers

The binary reconstruction operator is applied to reconstruct the binary image produced by the threshold from the marker image.

1. from ia870 import iainfrec
3. h = iainfrec(g,e)
4. adshow(h)

Final display

The structures extracted are overlaid to the input gray-scale image.

1. from ia870 import iagshow
3. adshow(iagshow(a,h))