An image segmentation for the measurement of microstructures in ductile cast iron