Signed Distance Function
william-silversmith opened this issue · comments
William Silversmith commented
Should be pretty easy to make. Something like?
edt.edt(labels) - edt.edt(~labels)
Might be faster to do one pass with edt
:
max_label = np.max(labels) + 1
mask = (labels == 0)
sdf = edt.edt(labels + mask * max_label)
sdf[mask] *= -1 # alternative 1
sdf = (sdf * -mask) + (sdf * ~mask) # alternative 2