def generate_synthetic_data():
 rs = np.random.RandomState(0)
 n_pts = 36.0
 (x, y) = np.ogrid[0:l, 0:l]
 mask_outer = ((((x - (l / 2)) ** 2) + ((y - (l / 2)) ** 2)) < ((l / 2) ** 2))
 mask = np.zeros((l, l))
 points = (l * rs.rand(2, n_pts))
 mask[(points[0].astype(np.int), points[1].astype(np.int))] = 1
 mask = ndimage.gaussian_filter(mask, sigma=(l / n_pts))
 res = np.logical_and((mask > mask.mean()), mask_outer)
 return (res - ndimage.binary_erosion(res))

def generate_synthetic_data ( ) : rs = np . random . RandomState ( 0 ) n_pts = 36.0 ( x , y ) = np . ogrid [ 0 : l , 0 : l ] mask_outer = ( ( ( ( x - ( l / 2 ) ) ** 2 ) + ( ( y - ( l / 2 ) ) ** 2 ) ) < ( ( l / 2 ) ** 2 ) ) mask = np . zeros ( ( l , l ) ) points = ( l * rs . rand ( 2 , n_pts ) ) mask [ ( points [ 0 ] . astype ( np . int ) , points [ 1 ] . astype ( np . int ) ) ] = 1 mask = ndimage . gaussian_filter ( mask , sigma = ( l / n_pts ) ) res = np . logical_and ( ( mask > mask . mean ( ) ) , mask_outer ) return ( res - ndimage . binary_erosion ( res ) )
synthetic binary data .