Optimize number of layers to be cut for contour map approach