Wolfram Demonstrations: Source code
Segmenting a Medical Image