def process(self, cmd): if cmd == 401: astraMPI.create(None,None) elif cmd == 402: astraMPI._runInternal(None, None) else: print("Not implemented astraMPI command")
proj_geom['Vectors'][:, 3:5] = proj_geom[ 'Vectors'][:, 3:5] + postAlignment * proj_geom['Vectors'][:, 6:8] print proj_geom vx = detectorColCount vy = detectorColCount vz = detectorRowCount print('Object has size %d x %d x %d\n' % (vx, vy, vz)) vol_geom = astra.create_vol_geom(vx, vy, vz) #Setup the MPI domain distribution proj_geom, vol_geom = mpi.create(proj_geom, vol_geom, nGhostcellsVolume=0, nGhostcellsProjection=19) print proj_geom proj_id = astra.data3d.create('-proj3d', proj_geom, P) # Create a data object for the reconstruction rec_id = astra.data3d.create('-vol', vol_geom) # Set up the parameters for a reconstruction algorithm using the GPU cfg = astra.astra_dict('SIRT3D_CUDA') #cfg = astra.astra_dict('CGLS3D_CUDA') cfg['ReconstructionDataId'] = rec_id cfg['ProjectionDataId'] = proj_id # Create the algorithm object from the configuration structure
#astra.log.setOutputFile("sirt3d.txt", astra.log.DEBUG) X = 128 vol_geom = astra.create_vol_geom(X, X, X) angles = np.linspace(0, np.pi, 180, False) proj_geom = astra.create_proj_geom('parallel3d', 1.0, 1.0, 128, 192, angles) # Create a simple hollow cube phantom cube = np.zeros((X, X, X)) cube[17:113, 17:113, 17:113] = 1 cube[33:97, 33:97, 33:97] = 0 # Modify the geometry to support distributed execution and then proceed as before proj_geom, vol_geom = mpi.create(proj_geom, vol_geom) # Create projection data from this volume proj_id, proj_data = astra.create_sino3d_gpu(cube, proj_geom, vol_geom) # Display a single projection image import pylab pylab.gray() pylab.figure(1) pylab.imshow(proj_data[:, 20, :]) rec_id = astra.data3d.create('-vol', vol_geom) #Execute the plugin-based reconstruction # Register the plugin with ASTRA
Y = 192 X = 160 vol_geom = astra.create_vol_geom(Y, X, Z) angles = np.linspace(0, np.pi, 180, False) #proj_geom = astra.create_proj_geom('parallel3d', 1.0, 1.0, 128, 192, angles) proj_geom = astra.create_proj_geom('cone', 1.0, 1.0, X, Y + 64, angles, 1000, 0) # Create a simple hollow cube phantom cube = np.zeros((Z, Y, X)) cube[17:Z - 15, 17:Y - 15, 17:X - 15] = 1 cube[33:97, 33:Y - 31, 33:X - 31] = 0 #Setup the MPI domain distribution mpi.create(proj_geom, vol_geom, nGhostcellsVolume=1, nGhostcellsProjection=0) # Create projection data from this proj_id, proj_data = astra.create_sino3d_gpu(cube, proj_geom, vol_geom) # Create a data object for the reconstruction rec_id = astra.data3d.create('-vol', vol_geom) # Set up the parameters for a reconstruction algorithm using the GPU cfg = astra.astra_dict('SIRT3D_CUDA') #cfg = astra.astra_dict('CGLS3D_CUDA') cfg['ReconstructionDataId'] = rec_id cfg['ProjectionDataId'] = proj_id # Create the algorithm object from the configuration structure alg_id = astra.algorithm.create(cfg)
vol_geom = astra.create_vol_geom(Y, X, Z) angles = np.linspace(0, np.pi, 180, False) #proj_geom = astra.create_proj_geom('parallel3d', 1.0, 1.0, 128, 192, angles) proj_geom = astra.create_proj_geom('cone', 1.0, 1.0, X, Y + 64, angles, 1000, 0) # Create a simple hollow cube phantom cube = np.zeros((Z, Y, X)) cube[17:Z - 15, 17:Y - 15, 17:X - 15] = 1 cube[33:97, 33:Y - 31, 33:X - 31] = 0 #Setup the MPI domain distribution GPUList = [0, 1] proj_geom, vol_geom = mpi.create(proj_geom, vol_geom, nGhostcellsVolume=1, nGhostcellsProjection=0, GPUList=GPUList) # Create projection data from this proj_id, proj_data = astra.create_sino3d_gpu(cube, proj_geom, vol_geom) # Create a data object for the reconstruction rec_id = astra.data3d.create('-vol', vol_geom) # Register the plugin with ASTRA astra.plugin.register(segment_plugin.SegmentationPlugin) six.print_(astra.plugin.get_help('SIMPLE-SEGMENT-PLUGIN')) # Set up the parameters for a reconstruction algorithm using the GPU cfg = astra.astra_dict('SIMPLE-SEGMENT-PLUGIN') cfg['ReconstructionDataId'] = rec_id