The algorithm uses a coarse to fine isearch strategy to quickly identify the worm head and gross shape and subsequenty uses dynamic programing to extract the boundaries of the body and compute the central curve. The entire procedure is based on intensity invariant oriented edge features that are used to define mid-level oriented features with robustness to small deformations. The use of a global generative statistical model coupled with robust features allows the algorithm to reliably detect the head and body even when the worm curves in on itself or glides along the boundary.