For each of a number of landmarks in an image an initial position of the
landmark is defined. Next a neighborhood around the initial position,
comprising a number of candidate locations of the landmark is sampled and
a cost is associated with each of the candidate locations. A cost
function expressing a weighted sum of overall gray level cost and overall
shape cost for all candidate locations is optimized. A segmented anatomic
entity is defined as a path through a selected combination of candidate
locations for which combination the cost function is optimized.