# read the sinogram sino_hq = ntp.read_image(fname) na = sino_hq.shape[0] # reduce number of projections in the sinogram sino = sino_hq[::skip_theta] # angles views in radians angles = np.linspace(0, 2 * np.pi, na, False)[::skip_theta] # ground truth reconstruction true = ntp.reconstruct(sino_hq, np.linspace(0, np.pi * 2, sino_hq.shape[0], endpoint=False), 'SIRT_CUDA', {'iterations': 200}, pixel_size=pixel_size) # fbp reconstruction fbp = ntp.reconstruct(sino, angles, 'FBP_CUDA', pixel_size=pixel_size) # sirt reconstruction sirt = ntp.reconstruct(sino, angles, 'SIRT_CUDA', parameters={'iterations': 200}, pixel_size=pixel_size) # cgls reconstruction cgls = ntp.reconstruct(sino, angles, 'CGLS_CUDA',
# remove stripes in sinograms norm = ntp.remove_stripe_stack(norm, level=4, wname='db30', sigma=1.5, out=norm) # define the array of the angle views in radians angles = np.linspace(0, last_angle, norm.shape[0], endpoint=False) # FBP reconstruction with the hamming filter using GPU print('> Reconstruction...') rec = ntp.reconstruct(norm, angles, 'FBP_CUDA', parameters={"FilterType": "hamming"}, pixel_size=pixel_size) # Implemented FilterType in ASTRA toolbox are: # ``ram-lak`` (default), ``shepp-logan``, ``cosine``, ``hamming``, ``hann``, ``none``, ``tukey``, # ``lanczos``, ``triangular``, ``gaussian``, ``barlett-hann``, ``blackman``, ``nuttall``, # ``blackman-harris``, ``blackman-nuttall``, ``flat-top``, ``kaiser``, # ``parzen``, ``projection``, ``sinogram``, ``rprojection``, ``rsinogram``. # select the directory and the prefix file name of the reconstructed images to save. recon_dir = ntp.save_filename_gui( '', message= 'Select the folder and the prefix name for the reconstructed images...')
dose_draw=True, crop_draw=True, log=True) # rotation axis tilt correction norm = ntp.correction_COR(norm, norm[0], norm_180) # define the array of the angle views in radians angles = np.linspace(0, last_angle, norm.shape[0], endpoint=False) # high-quality reconstruction train_slice_start = 100 train_slice_end = 120 rec = ntp.reconstruct(norm[:, train_slice_start:train_slice_end + 1, :], angles, 'FBP_CUDA', parameters={"FilterType": "hamming"}, pixel_size=pixel_size) # write the high-quality reconstructed images to disk try: os.mkdir(hqrec_folder) except OSError: pass ntp.write_tiff_stack(hqrec_folder + 'sample', rec) # NN-FBP training skip = 3 # reduction factor of the full dataset to obtain the sparse-view dataset norm_train = norm[::skip, train_slice_start:train_slice_end + 1, :] ntp.reconstruct(norm_train, angles[::skip], 'NN-FBP-train', parameters=conf)
# perform minus-log transform norm = ntp.log_transform(norm, out=norm) # remove stripes in sinograms norm = ntp.remove_stripe_stack(norm, level=4, wname='db30', sigma=1.5, out=norm) # define the array of the angle views in radians angles = np.linspace(0, last_angle, norm.shape[0], endpoint=False) # SIRT reconstruction with 100 iterations using GPU print('> Reconstruction...') rec = ntp.reconstruct(norm, angles, 'SIRT_CUDA', parameters={"iterations": 100}, pixel_size=pixel_size) # select the directory and the prefix file name of the reconstructed images to save. recon_dir = ntp.save_filename_gui( '', message= 'Select the folder and the prefix name for the reconstructed images...') # write the reconstructed images to disk ntp.write_tiff_stack(recon_dir, rec)
radius=3, threshold=0.018, outliers='bright', out=norm) # perform minus-log transform norm = ntp.log_transform(norm, out=norm) # remove stripes in sinograms norm = ntp.remove_stripe_stack(norm, level=4, wname='db30', sigma=1.5, out=norm) # define the array of the angle views in radians angles = np.linspace(0, last_angle, norm.shape[0], endpoint=False) # FBP reconstruction using CPU print('> Reconstruction...') rec = ntp.reconstruct(norm, angles, 'FBP', pixel_size=pixel_size) # select the directory and the prefix file name of the reconstructed images to save. recon_dir = ntp.save_filename_gui( '', message= 'Select the folder and the prefix name for the reconstructed images...') # write the reconstructed images to disk ntp.write_tiff_stack(recon_dir, rec)