Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'width': args.analysis_roi[2],
'height': args.analysis_roi[3],
'units': 'base_pixels'
}
if is_wsi:
print('\n>> Computing foreground fraction of all tiles ...\n')
start_time = time.time()
num_tiles = ts.getSingleTile(**it_kwargs)['iterator_range']['position']
print 'Number of tiles = %d' % num_tiles
tile_fgnd_frac_list = htk_utils.compute_tile_foreground_fraction(
img_paths[i], im_fgnd_mask_lres, fgnd_seg_scale,
**it_kwargs
)
num_fgnd_tiles = np.count_nonzero(
tile_fgnd_frac_list >= args.min_fgnd_frac)
percent_fgnd_tiles = 100.0 * num_fgnd_tiles / num_tiles
fgnd_frac_comp_time = time.time() - start_time
print 'Number of foreground tiles = %d (%.2f%%)' % (
num_fgnd_tiles, percent_fgnd_tiles)
print 'Time taken = %s' % cli_utils.disp_time_hms(fgnd_frac_comp_time)
'scale': {'magnification': args.analysis_mag},
}
#
# Compute foreground fraction of tiles in parallel using Dask
#
print('\n>> Computing foreground fraction of all tiles ...\n')
start_time = time.time()
num_tiles = \
ts.getSingleTile(**it_kwargs)['iterator_range']['position']
print('Number of tiles = {}'.format(num_tiles))
tile_fgnd_frac_list = htk_utils.compute_tile_foreground_fraction(
img_paths[i], im_fgnd_mask_lres, fgnd_seg_scale,
it_kwargs
)
num_fgnd_tiles = np.count_nonzero(
tile_fgnd_frac_list >= args.min_fgnd_frac)
percent_fgnd_tiles = 100.0 * num_fgnd_tiles / num_tiles
fgnd_frac_comp_time = time.time() - start_time
print('Number of foreground tiles = {0:d} ({1:2f}%%)'.format(
num_fgnd_tiles, percent_fgnd_tiles))
print('Tile foreground fraction computation time = {}'.format(
cli_utils.disp_time_hms(fgnd_frac_comp_time)))
'units': 'base_pixels'
}
if is_wsi:
print('\n>> Computing foreground fraction of all tiles ...\n')
start_time = time.time()
num_tiles = ts.getSingleTile(**it_kwargs)['iterator_range']['position']
print('Number of tiles = {}'.format(num_tiles))
if process_whole_image:
tile_fgnd_frac_list = htk_utils.compute_tile_foreground_fraction(
args.inputImageFile, im_fgnd_mask_lres, fgnd_seg_scale,
it_kwargs
)
else:
tile_fgnd_frac_list = np.full(num_tiles, 1.0)
num_fgnd_tiles = np.count_nonzero(
tile_fgnd_frac_list >= args.min_fgnd_frac)
percent_fgnd_tiles = 100.0 * num_fgnd_tiles / num_tiles
fgnd_frac_comp_time = time.time() - start_time
print('Number of foreground tiles = {0:d} ({1:2f}%%)'.format(
'width': args.analysis_roi[2],
'height': args.analysis_roi[3],
'units': 'base_pixels'
}
if is_wsi:
print('\n>> Computing foreground fraction of all tiles ...\n')
start_time = time.time()
num_tiles = ts.getSingleTile(**it_kwargs)['iterator_range']['position']
print 'Number of tiles = %d' % num_tiles
tile_fgnd_frac_list = htk_utils.compute_tile_foreground_fraction(
img_path[i], im_fgnd_mask_lres, fgnd_seg_scale,
**it_kwargs
)
num_fgnd_tiles = np.count_nonzero(
tile_fgnd_frac_list >= args.min_fgnd_frac)
percent_fgnd_tiles = 100.0 * num_fgnd_tiles / num_tiles
fgnd_frac_comp_time = time.time() - start_time
print 'Number of foreground tiles = %d (%.2f%%)' % (
num_fgnd_tiles, percent_fgnd_tiles)
print 'Time taken = %s' % cli_utils.disp_time_hms(fgnd_frac_comp_time)
'units': 'base_pixels'
}
if is_wsi:
print('\n>> Computing foreground fraction of all tiles ...\n')
start_time = time.time()
num_tiles = ts.getSingleTile(**it_kwargs)['iterator_range']['position']
print('Number of tiles = {}'.format(num_tiles))
if process_whole_image:
tile_fgnd_frac_list = htk_utils.compute_tile_foreground_fraction(
args.inputImageFile, im_fgnd_mask_lres, fgnd_seg_scale,
it_kwargs
)
else:
tile_fgnd_frac_list = [1.0] * num_tiles
num_fgnd_tiles = np.count_nonzero(
tile_fgnd_frac_list >= args.min_fgnd_frac)
percent_fgnd_tiles = 100.0 * num_fgnd_tiles / num_tiles
fgnd_frac_comp_time = time.time() - start_time
print('Number of foreground tiles = {0:d} ({1:2f}%%)'.format(
#
print('\n>> Computing foreground fraction of all tiles ...\n')
it_kwargs = {
'tile_size': {'width': args.superpixel_tile_size},
'scale': {'magnification': args.superpixel_mag},
}
start_time = time.time()
num_tiles = \
ts.getSingleTile(**it_kwargs)['iterator_range']['position']
print('Number of tiles = {}'.format(num_tiles))
tile_fgnd_frac_list = htk_utils.compute_tile_foreground_fraction(
img_paths[i], im_fgnd_mask_lres, fgnd_seg_scale,
it_kwargs
)
num_fgnd_tiles = np.count_nonzero(
tile_fgnd_frac_list >= args.min_fgnd_frac
)
percent_fgnd_tiles = 100.0 * num_fgnd_tiles / num_tiles
fgnd_frac_comp_time = time.time() - start_time
print('Number of foreground tiles = {0:d} ({1:2f}%%)'.format(
num_fgnd_tiles, percent_fgnd_tiles))
print('Tile foreground fraction computation time = {}'.format(