prj = dxchange.read_tiff_stack(f'{file_name[:-3]}/data/d_00000.tiff', ind=range(ntheta)) theta = np.load(file_name[:-3] + '/data/theta.npy') nz, n = prj.shape[1:] niteradmm = [96, 48, 24, 12] # number of iterations in the ADMM scheme # niteradmm = [2,2,2] # number of iterations in the ADMM scheme startwin = [256, 128, 64, 32] # starting window size in optical flow estimation stepwin = [2, 2, 2, 2] # step for decreasing the window size in optical flow estimtion res = tomoalign.admm_of_levels(prj, theta, pnz, ptheta, center, ngpus, niteradmm, startwin, stepwin, file_name[:-3] + '/tmp/', padding=True) dxchange.write_tiff_stack(res['u'], file_name[:-3] + '/results_admm/u/r', overwrite=True) dxchange.write_tiff_stack(res['psi'], file_name[:-3] + '/results_admm/psi/r', overwrite=True)
ptheta = 10 niteradmm = [80, 72, 32, 24] # number of iterations in the ADMM scheme # niteradmm = [0, 0, 0, 2] # number of iterations in the ADMM scheme # starting window size in optical flow estimation startwin = [128, 96, 48, 32] # step for decreasing the window size in optical flow estimtion stepwin = [1, 1, 1, 1] center = 1158.5 name += '/fw' + str(len(theta)) + '_' + str(start) + '/' res = tomoalign.admm_of_levels(data, theta, pnz, ptheta, center, ngpus, niteradmm, startwin, stepwin, name, padding=True) dxchange.write_tiff_stack(res['u'], name + '/results_admm/u/r', overwrite=True) dxchange.write_tiff_stack(res['psi'], name + '/results_admm/psi/r', overwrite=True) np.save(name + '/results_admm/flow.npy', res['flow'])
if __name__ == "__main__": n = 1024 + 512 ntheta = 1920 pprot = 96 # adef = 10 # tomoalign.gen_cyl_data(n, ntheta, pprot, adef) data = dxchange.read_tiff('data/deformed_data.tiff') data = ndimage.zoom( data, [ntheta // data.shape[0], n // data.shape[1], n // data.shape[2]], order=0) [ntheta, nz, n] = data.shape theta = np.linspace(0, 4 * np.pi, ntheta).astype('float32') center = n / 2 pnz = 32 # number of slice for simultaneus processing by one GPU in the tomography sub-problem ptheta = 128 # number of projections for simultaneus processing by one GPU in the alignment sub-problem # step for decreasing window size (increase resolution) in Farneback's algorithm on each ADMM iteration ngpus = 8 # number of gpus niteradmm = [5, 5, 5] # number of iterations in the ADMM scheme startwin = [n, n // 2, n // 4] stepwin = [2, 2, 2] fname = 'data/tmp' uof = tomoalign.admm_of_levels(data, theta, pnz, ptheta, center, ngpus, niteradmm, startwin, stepwin, fname) dxchange.write_tiff(uof['u'], 'data/of_recon/recon/iter' + str(niteradmm), overwrite=True)
ptheta = 2 niteradmm = [128] # number of iterations in the ADMM scheme # starting window size in optical flow estimation startwin = [256] # step for decreasing the window size in optical flow estimtion stepwin = [2] center = 192 # data = dxchange.read_tiff_stack(data_prefix+'/reccrop_align_azat/psiangle/r_00000.tiff',ind=range(ntheta)) data_prefix += 'rectomoalign_azat/' res = tomoalign.admm_of_levels(data, theta, pnz, ptheta, center, ngpus, niteradmm, startwin, stepwin, data_prefix, padding=False) dxchange.write_tiff_stack(res['u'], data_prefix + '/results_admm/u/r', overwrite=True) dxchange.write_tiff_stack(res['psi'], data_prefix + '/results_admm/psi/r', overwrite=True) np.save(data_prefix + '/results_admm/flow.npy', res['flow'])