def _sample_FDK_(projections, geometry, sample): ''' Compute a subsampled version of FDK ''' geometry_ = geometry.copy() projections_ = projections[::sample[0], ::sample[2], ::sample[2]] # Apply subsampling to detector and volume: vol_sample = [sample[0], sample[1], sample[2]] det_sample = [sample[0], sample[2], sample[2]] geometry_['vol_sample'] = vol_sample geometry_['det_sample'] = det_sample volume = projector.init_volume(projections_) # Do FDK without progress_bar: projector.settings.progress_bar = False projector.FDK(projections_, volume, geometry_) projector.settings.progress_bar = True return volume
# Initialize images: proj_a = numpy.zeros([128, 32, 128], dtype='float32') proj_b = numpy.zeros([128, 32, 128], dtype='float32') # Forward project: projector.forwardproject(proj_a, vol, geom_a) projector.forwardproject(proj_b, vol, geom_b) display.slice(proj_a, dim=1, title='Proj A') display.slice(proj_b, dim=1, title='Proj B') #%% Preview reconstructions: geom_b = geom_a.copy() # First volume: vola = projector.init_volume(proj_a) projector.FDK(proj_a, vola, geom_a) # Second volume: volb = projector.init_volume(proj_b) projector.FDK(proj_b, volb, geom_b) display.projection(vola, dim=1, title='Volume A') display.projection(volb, dim=1, title='Volume B') #%% Register: R, T = process.register_volumes(vola, volb, subsamp=1, use_moments=True, use_CG=True)
vol = phantom.cuboid([128, 128, 128], geom, 3, 3, 3) display.slice(vol, title='Phantom') # Forward project: projector.forwardproject(proj, vol, geom) display.slice(proj, dim=1, title='Projection') #%% Use optimize_rotation_center: # Unmodified geometry: geom = geometry.circular(src2obj=100, det2obj=100, det_pixel=0.1, ang_range=[0, 360]) vol = projector.init_volume(proj) projector.FDK(proj, vol, geom) display.slice(vol, bounds=[0, 2], title='FDK: uncorrected') #%% Optimization: vals = numpy.linspace(0., 3., 7) process.optimize_modifier(vals, proj, geom, samp=[1, 1, 1], key='det_roll', metric='highpass') #%% Reconstruct: