Active contour model based measurement of distance of material serial sections