def main(in_path: str, ref_channel: str, out_dir: str, n_workers: int, tile_size: int, overlap: int, ): if not osp.exists(out_dir): os.makedirs(out_dir) if n_workers == 1: dask.config.set({'scheduler': 'synchronous'}) else: dask.config.set({'num_workers': n_workers, 'scheduler': 'processes'}) st = datetime.now() with tif.TiffFile(in_path, is_ome=True) as stack: ome = stack.ome_metadata cycle_size, ncycles, first_ref_position = get_cycle_composition(ome, ref_channel) block_width = tile_size block_height = tile_size overlap = overlap warper = Warper() warper.block_w = block_width warper.block_h = block_height warper.overlap = overlap # perform registration of full stack register(in_path, out_dir, cycle_size, ncycles, first_ref_position, ome, warper, block_width, block_height, overlap) fin = datetime.now() print('time elapsed', fin - st)
def main(in_path: str, ref_channel: str, out_dir: str, n_workers: int, tile_size: int, overlap: int, method: str): if not osp.exists(out_dir): os.makedirs(out_dir) if n_workers == 1: dask.config.set({'scheduler': 'synchronous'}) else: dask.config.set({'num_workers': n_workers, 'scheduler': 'processes'}) avail_methods = ('farneback', 'denselk', 'deepflow', 'rlof', 'pcaflow') if method not in avail_methods: raise ValueError('Provided opt flow method is not recognised. ' + '\nAvailable methods: ' + str(avail_methods)) print('Using method', method) st = datetime.now() with tif.TiffFile(in_path, is_ome=True) as stack: ome = stack.ome_metadata cycle_size, ncycles, first_ref_position = get_cycle_composition(ome, ref_channel) block_width = tile_size block_height = tile_size overlap = overlap warper = Warper() warper.block_w = block_width warper.block_h = block_height warper.overlap = overlap # perform registration of full stack register(in_path, out_dir, cycle_size, ncycles, first_ref_position, ome, warper, block_width, block_height, overlap, method) fin = datetime.now() print('time elapsed', fin - st)