def run_reconstruction_and_compare(self, path_to_projections, correct_body): # Set the work path as the filepath to this file dir_path = os.path.dirname(os.path.realpath(__file__)) # Set the same settings as used in the forward projection param = axitom.config_from_xtekct(dir_path + "/example_data/settings.xtekct") param.n_voxels_x = 500 param.n_voxels_y = 500 param.n_voxels_z = 500 param.n_pixels_u = 500 param.n_pixels_v = 500 param.update() proj = np.load(dir_path + path_to_projections) proj = np.exp(-proj) reconstruction = axitom.fdk(proj, param) # Note that the reconstruction give the radial slice only deviation_field = np.abs(correct_body[:250, 250, :] - reconstruction) # Sample some deviation values from the background and the interior background_deviation = deviation_field[5:60, 75:-75] interior_deviation = deviation_field[90:, 75:-75] if np.max(background_deviation) > self.tol: self.fail("The background was not reconstructed properly with largest deviation of %f" % np.max( background_deviation)) if np.max(interior_deviation) > self.tol: self.fail( "The interior was not reconstructed properly with largest deviation of %f" % np.max(interior_deviation))
def main(): config = axitom.config_from_xtekct("./example_data/radiogram.xtekct") config.n_voxels_x = 500 config.n_voxels_y = 500 config.n_voxels_z = 500 config.n_pixels_u = 500 config.n_pixels_v = 500 config.update() radiograms = np.load("proj_barrel.npy") radiograms = np.exp(-radiograms) tomogram = axitom.fdk(radiograms, config) return tomogram
def main(): config = axitom.config_from_xtekct(join(path_to_data, "radiogram.xtekct")) config.n_voxels_x = 500 config.n_voxels_y = 500 config.n_voxels_z = 500 config.n_pixels_u = 500 config.n_pixels_v = 500 config.update() radiograms = np.load(join(path_to_data, "proj_barrel.npy")) radiograms = np.exp(-radiograms) tomogram = axitom.fdk(radiograms, config) return tomogram
def reconstruct_tomogram(): config = axitom.config_from_xtekct("./example_data/radiogram.xtekct") radiogram = axitom.read_image(r"./example_data/radiogram.tif", flat_corrected=True) # Remove some edges that are in field of view radiogram[:250, :] = 0.95 radiogram[1800:, :] = 0.95 radiogram = median_filter(radiogram, size=20) _, center_offset = axitom.object_center_of_rotation(radiogram, config, background_internsity=0.9) config.center_of_rot_y = center_offset config.update() tomogram = axitom.fdk(radiogram, config) return tomogram
def run_reconstruction(): dir_path = os.path.dirname(os.path.realpath(__file__)) config = axitom.config_from_xtekct(dir_path + "/example_data/settings.xtekct") radiogram = axitom.read_image(dir_path + "/example_data/radiogram.tif", flat_corrected=True) # Remove some edges that are in field of view radiogram[:250, :] = 0.95 radiogram[1800:, :] = 0.95 radiogram = median_filter(radiogram, size=20) _, center_offset = axitom.object_center_of_rotation( radiogram, config, background_internsity=0.9) config.center_of_rot_y = center_offset config.update() reconstruction = axitom.fdk(radiogram, config) return reconstruction
def recon(self, stack): tomo = [axitom.fdk(slice, self.config) for slice in self.stack] plt.title("1st Reconstructed Radial slice") plt.imshow(tomo[0].transpose(), cmap=plt.cm.cividis)