bwdist should work for multi-D images