code: def cpmaximum(image, structure=np.ones((3,3),dtype=bool),offset=None):
      
      center = np.array(structure.shape) // 2
      if offset is None:
          offset = center
      origin = np.array(offset) - center
      return scind.maximum_filter(image, footprint=structure, origin=origin,
                                  mode='constant', cval=np.min(image))
docs: Find the local maximum at each point in the image, using the given structuring element
      
      image - a 2-d array of doubles
      structure - a boolean structuring element indicating which
                  local elements should be sampled
      offset - the offset to the center of the structuring element