Thursday, January 20, 2011

Labelling chromosome-like shapes using watershed: effect of the chromosome shape

[edit feb 2013]
In previous post, the  chromatids of metaphasic chromosomes were labelled by hand with a painting tool in ImageJ following a watershed segmentation step:
Initial chromatids segmentation in ImageJ after high pass  filtering, thresholding, watershed and image labelling.
Final chromatids (blue or green) segmentation after painting by hand, centromeric region was added and paint in red.

 With a simplistic rigid model of chromosome and well chosen seeds, a watershed can label the chromatids:

Chromosomes present variable shapes, metacentric chromosomes are X shaped, acrocentric chromosomes are Y-shaped. The  shape of the same chromosome varies also from one metaphase spread to another, it can be randomly bended,condensed. Image processing introduces also variability according to the parameters used (threshold, filtering ...). Is it possible to segment chromatids such conditions ? Let submit a contour image of chromosome-like shapes to wateshed algorithm implemented in mahotas:

model shapes of chromosomes of variable size, bending. (Gimp)
seeds: the darkest seeds will label the back ground, they are outside the chromosomes. The pairs of lighter seeds are supposed to label the chromatids. (The Gimp)
In a python console:

    PyShell 0.9.8 - The Flakiest Python Shell
    Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
    [GCC 4.4.5] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    Startup script executed: /home/claire/.pyshell/startup
   >>> g=readmagick.readimg("/home/claire/Applications/ImagesTest/essai02/grad.tif")
   >>> s=readmagick.readimg("/home/claire/Applications/ImagesTest/essai02/seeds.tif")
   >>> label=mahotas.cwatershed(g, s, Bc=None, return_lines=False)
   >>> readmagick.writeimg(label,"/home/claire/Applications/ImagesTest/essai02/label.tif")

The background is labelled with one seeds outside the chromosomes and with seeds (same grey level) inside the chromosome holes. The chromatids are labelled with one pair of seeds inside the chromosomes:
Pair of seeds for watershed with two different grey levels

They are chosen grossly to fall apart the chromosomal axe:

Labelling with one pair of seeds per chromosome
If several pair of seeds are chosen by hand, a better chromatid segmentation can be found:
Pair of seeds overlaid to the particles contour
Chromatids like segmentation
The result depends on how the seeds were chosen. Four independent factors seems to be considered:

  • Seeds number:  one pair yields poor results as observed previously.
  • Seeds orientation : the seeds axis, must be locally orthogonal to the axis of the chromosome.
  • For a given pair of seeds, the distance between the two discs.
  • Relative orientation of the pair of seeds: The pair of seeds must have the same orientation.
When the seeds don't have the same relative orientation, watershed yields an harlequin  pattern :
opposite pair of seed yield harlequin pattern

Up to now, image labelling was performed with seeds chosen manually and drawn by hand with the gimp or ImageJ. The seeds localization have to be found automatically and mathematical morphology may provide solutions. The chromosomal axis is close to the particle skeleton. Can the particle skeleton be used to automatically find seeds useful for chromatid labelling with watershed? Using ImageJ interactively, chromosome-like particles skeleton was found:
chromosome-like particles
particles skeletons
From the skeleton, the branching points and end-points are searched using a binary hit-or-miss operator in ImageJ (see here for code). Different hit-or-miss structuring elements suceed in detecting branching points. If end-points and branching points are overlaid on the binary particules, chromosomal areas close to those chosen by hand, are finally found:
Skeleton branching points (color), skeleton end points (black)
At first sight end-points would provide better candidate seeds for watershed.