I have a set of binary mask images with irregular shape, and I want to measure the maximal thickness along the medial axis, also I want the exact position of this maximal thickness.
I have tried the medial_axis function in scikit-image, and successfully get the medial axis I want.
from skimage.morphology import medial_axis
from scipy import ndimage
index = random.randint(0,pred_imgs.shape[0])
print(index)
mask = pred_imgs[index]
mask=ndimage.binary_fill_holes(mask).astype(int)
skel, distance = medial_axis(mask, return_distance=True)
dist_on_skel = distance * skel
fig, axes = plt.subplots(1, 2, figsize=(8, 8), sharex=True, sharey=True, dpi = 200)
ax = axes.ravel()
ax[0].imshow(mask, cmap=plt.cm.gray, interpolation='nearest')
ax[0].set_title('original')
ax[1].imshow(dist_on_skel, cmap='magma', interpolation='nearest')
ax[1].contour(mask, [0.5], colors='w')
ax[1].set_title('medial_axis')

For the next step, I want to measure the thickness along the axis, like the red and blue lines in the below figure(These lines are perpendicular to the axis). Also, I want to know the position of the maximal thickness, that is the starting and ending point of the red line.

How can I do this in python? Thank you very much!