$ conda install -c dgursoy tomopy --- $ conda install -c astra-toolbox astra-toolbox --- import tomopy # Read data from APS 32ID beamline prj, flat, dark = tomopy.read_aps_32id('data.h5') # Normalize data prj = tomopy.normalize(prj, flat, dark) # Define acquired angles ang = tomopy.angles(1024) # Reconstruct data using TomoPy gridrec rec = tomopy.recon(prj, ang, algorithm='gridrec') --- # Reconstruct data using ASTRA FBP rec = tomopy.recon(prj, ang, algorithm=tomopy.astra, options={'method': 'FBP', 'proj_type': 'linear'}) --- # Reconstruct data using ASTRA FBP on the GPU rec = tomopy.recon(prj, ang, algorithm=tomopy.astra, options={'method': 'FBP_CUDA', 'proj_type': 'cuda'}) --- # Reconstruct data using ASTRA CGLS on the GPU rec = tomopy.recon(prj, ang, algorithm=tomopy.astra, options={'method': 'CGLS_CUDA', 'proj_type': 'cuda', 'num_iter': 10}) --- # Reconstruct data using ASTRA SIRT on the GPU, # with nonnegativity constraint extra_options = {'MinConstraint':0} rec = tomopy.recon(prj, ang, algorithm=tomopy.astra, options={'method': 'SIRT_CUDA', 'proj_type': 'cuda', 'num_iter': 100, 'extra_options': extra_options}) --- # Reconstruct data using ASTRA CGLS on 4 GPUs rec = tomopy.recon(prj, ang, algorithm=tomopy.astra, options={'method': 'CGLS_CUDA', 'proj_type': 'cuda' ,'num_iter': 10, 'gpu_list': [0, 1, 2, 3]}) --- # Reconstruct data using an ASTRA plugin, # performing FISTA total variation minimization import astra import tvtomo astra.plugin.register(tvtomo.plugin) extra_options = {'tv_reg':1} rec = tomopy.recon(prj, ang, algorithm=tomopy.astra, options={'method': 'TV-FISTA', 'proj_type': 'cuda', 'num_iter': 100, 'extra_options':extra_options}) --- import tomopy import numpy as np # Set up dataset variables file_name = './data.h5' center = 1286 # center of rotation start = 740 # first slice end = 1500 # last slice miss_ang = [142, 228] # blocked angle range # Read data from APS 32ID beamline prj, flat, dark = tomopy.read_aps_32id(file_name, sino=(start, end)) # Remove the blocked projections ang = tomopy.angles(359) prj = np.concatenate((prj[:miss_ang[0]], prj[miss_ang[1]:]), axis=0) ang = np.concatenate((ang[:miss_ang[0]], ang[miss_ang[1]:])) # Normalize data prj = tomopy.normalize(prj, flat, dark) # Remove ring artifacts prj = tomopy.remove_stripe_fw(prj) # Setup ASTRA options opts = {} opts['method'] = 'SIRT_CUDA' opts['num_iter'] = 100 opts['proj_type'] = 'cuda' opts['extra_options'] = {'MinConstraint':0} # Perform reconstruction rec = tomopy.recon(prj, ang, algorithm=tomopy.astra, options=opts) # Export reconstructed slices as TIFFs tomopy.io.writer.write_tiff_stack(rec, fname='./recs', start=start)