Tuesday, January 25, 2011

Exploring initial seeds conditions with ImageJ and mathematical morphology.

Up to now, image labelling was performed with seeds chosen manually and drawn with the gimp or ImageJ.
The seeds localization have to be found automatically and mathematical morphology can provide solutions. The chromosomal axis is close to the particule squeleton:
  
Binary chromosomes
 From the binary particules, imagej gives the following distance map:
Distance map of binary particules (false colors)
 with the following code recorded from the macro:
  1. run("Make Binary");
  2. run("Distance Map");
  3. run("3-3-2 RGB");
Binary particules squeleton
and then the squeleton. From the squeleton, peculiar points are searched: branching points and end-points using a binary hit-and-miss operator:

End points detection with imagej:
  1. run("Duplicate...", "title=squel.png");
  2. run("Make Binary");
  3. run("Skeletonize");
  4. run("BinaryHitOrMiss ", "kernel_a=[0 0 0 0 1 0 0 1 0 ] rotations=[rotate 45] white");
  5. run("Dilate");
  6. run("Select All");
  7. run("Copy");
  8. selectWindow("bin.png");
  9. run("Paste");
Branching points detection:
  1. run("Duplicate...", "title=EndPoints-Triple.png");
  2. run("Make Binary");
  3. run("Skeletonize");
  4. run("BinaryHitOrMiss ", "kernel_a=[0 1 0 1 1 1 2 2 2 ] rotations=[rotate 45] white");
  5. run("Dilate");
  6. selectWindow("bin.png");
  7. selectWindow("EndPoints-Triple.png");
  8. run("Select All");
  9. run("Copy");
  10. selectWindow("bin.png");
  11. run("Paste");
  12. saveAs("PNG", "/home/jeanpat/Applications/Images_test/png/essai07/ImageJ_HitnMiss_pointstriples_type2.png");
  13. open("/home/jeanpat/Applications/Images_test/png/essai07/ImageJ_HitnMiss_pointstriples.png");
  14. run("Select All");
  15. run("Copy");
  16. selectWindow("ImageJ_HitnMiss_pointstriples_type2.png");
  17. run("Paste");
Different hit-n-miss kernels 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:
  
end-points (black), branching-points (colored)
 Good candidates are selected.
Post a Comment