code: def strel_diamond(radius):
      
      iradius = int(radius)
      i, j = np.mgrid[-iradius:(iradius + 1), -iradius:(iradius+1)]
      
      strel = (((i+j) <= radius) & ((i+j) >= -radius) &
               ((i-j) <= radius) & ((i-j) >= -radius))
      return strel
docs: Create a diamond structuring element for morphological operations
      
      radius - the offset of the corners of the diamond from the origin
               rounded down (e.g. r=2: (0, 2), (2, 0), (0, -2), (-2, 0))
               
      returns a two-dimensional binary array