code: def _get_axial_shifts(ndim=2, include_diagonals=False):
      r'''
      Helper function to generate the axial shifts that will be performed on
      the image to identify bordering pixels/voxels
      '''
      if ndim == 2:
          if include_diagonals:
              neighbors = square(3)
          else:
              neighbors = diamond(1)
          neighbors[1, 1] = 0
          x, y = np.where(neighbors)
          x -= 1
          y -= 1
          return np.vstack((x, y)).T
      else:
          if include_diagonals:
              neighbors = cube(3)
          else:
              neighbors = octahedron(1)
          neighbors[1, 1, 1] = 0
          x, y, z = np.where(neighbors)
          x -= 1
          y -= 1
          z -= 1
          return np.vstack((x, y, z)).f _get_axial_shifts(ndim=2, include_diagonals=False):
      r'''
      Helper function to generate the axial shifts that will be performed on
      the image to identify bordering pixels/voxels
      '''
      if ndim == 2:
          if include_diagonals:
              neighbors = square(3)
          else:
              neighbors = diamond(1)
          neighbors[1, 1] = 0
          x, y = np.where(neighbors)
          x -= 1
          y -= 1
          return np.vstack((x, y)).T
      else:
          if include_diagonals:
              neighbors = cube(3)
          else:
              neighbors = octahedron(1)
          neighbors[1, 1, 1] = 0
          x, y, z = np.where(neighbors)
          x -= 1
          y -= 1
          z -= 1
          return np.vstack((x, y, z)).T
docs: r'''
      Helper function to generate the axial shifts that will be performed on
      the image to identify bordering pixels/voxels