def paddingMed(img, shape, shift=None, smooth=10): """ pad with median see doc for paddingValue """ try: med = N.median(img, axis=None) except TypeError: # numpy version < 1.1 med = U.median(img) return paddingValue(img, shape, med, shift, smooth)
def maskEdgeWithValue2D(arr, val=None): """ overwrite 2D image edge (s[:-2,2:]) with value **in place** if val is None, use median """ if not val: val = U.median(arr[:-2,2:]) arr[-2:] = val arr[:,:2] = val return arr
def maskEdgeWithValue2D(arr, val=None): """ overwrite 2D image edge (s[:-2,2:]) with value **in place** if val is None, use median """ if not val: val = U.median(arr[:-2, 2:]) arr[-2:] = val arr[:, :2] = val return arr