def testfill(): c = np.asarray((25, 25, 25)) a = make_test_array(c) x = krebs.flood_fill(a, (0, 0, 0)) img = Image.fromarray(255 * np.asarray(x[:, :, c[2]], dtype=np.uint8)) img.save('filled2.png') x = krebs.flood_fill(a, c) img = Image.fromarray(255 * np.asarray(x[:, :, c[2]], dtype=np.uint8)) img.save('filled1.png') img = Image.fromarray(255 * np.asarray(a[:, :, c[2]], dtype=np.uint8)) img.save('tobefilled.png')
def calc_distmap(tumorgroup): ld = get_tumld(tumorgroup) distmap = np.asarray(tumorgroup['ls']) > 0 distmap = krebsutils.flood_fill(distmap, (0, 0, 0)) distmap = np.logical_not(distmap) distmap = krebsutils.distancemap(distmap) * ld.scale return distmap
def calc_distmap(ds, ld, level): distmap = np.asarray(ds) > level distmap = krebsutils.flood_fill(distmap, (0,0,0)) distmap = np.logical_not(distmap) distmap = krebsutils.distancemap(distmap)*ld.scale return distmap