I don’t believe sampling works like this. The sampling= kwarg tells the algorithm the spacing of each pixel/voxel in each spatial dimension. It then calculates the distance transform. So if you put a zero in, it will traverse in that dimension with a distance cost of zero for each step. This will generate a result that has mostly spurious zero distances, rather than select a particular axis to calculate the distance transform along.

To calculate the correct distance function along a specific axis probably requires repeated calls along that axis; since scipy.ndimage is by definition n-dimensional it should be able to efficiently handle rank-1 arrays without issue.

I use the super handy Chrome extension “Markdown Here” to write in Markdown and then have my free entry fields converted to pretty HTML prior to posting. At this point I pretty much think in Markdown…

Josh