// - binary image with only 0"s and 1"s
if image.ndim != 2:
raise ValueError("Skeletonize requires a 2D array")
if not np.all(np.in1d(image.flat, (0, 1))):
raise ValueError("Image contains values other than 0 and 1")
return _fast_skeletonize(image)
After Change
raise ValueError("skeletonize method "zhang" only works for 2D "
"images.")
elif image.ndim == 3 or (image.ndim == 2 and method == "lee"):
skeleton = skeletonize_3d(image)
else:
raise ValueError("skeletonize requires a 2D or 3D image as input, "
"got {}D.".format(image.ndim))
return skeleton
def skeletonize_2d(image):
Return the skeleton of a 2D binary image.