Exemplo n.º 1
0
Comparing error for different types of noise and different number of iterations
"""

import astra1
import phantoms
import real_units
import imageio
import matplotlib.pyplot as plt
import numpy as np
import pylab
#create phantom
jet = phantoms.shockjet(129,800,4,2000,6)

#create phantom with correct units

jet_correct_units = real_units.num_density(jet)
# above is unused further out as messes with reconstruction scaling issues - FIXED
#above is unused further as messes with addition of noise


# reconstruct for different amount of angles and plot the average discrepancy..
# .. from the phantom jet
ang_discrepancy_no_noise = []
ang_discrepancy_poisson_noise = []
ang_discrepancy_sandp_noise = []
ang_discrepancy_gaussian_noise = []

angles = range(1,90)#range of different number of angles to take projections at
num_iterations = 15
alg ='FBP'
poi =   False 
stack = unwrap.stack_projs(
    r'C:\my stuff\Imperial\4th Year\MSci Project\Interpret\17-3-20-2-no_blade_interferograms/phase'
)

#stack = stack[:, 1:130, 5:190] #17-3-20 no blade
stack = stack[:, 5:195, 2:200]  #11-3-20 data
#stack = stack[:,1:200, 1:240] #27-2-20 data
#stack = stack[:,1:200, 1:240] #17-3-20 no mount not done yet

grad_sub_stack = np.array(
    [improve_data.gradsub(proj, 15, 180) for proj in stack])
#smooth_bckgnd_stack = np.array([improve_data.smooth_background(proj, 20, 210) for proj in stack])

smooth_bckgnd_stack = np.array(
    [improve_data.smooth_background(proj, 15, 180) for proj in grad_sub_stack])
n_stack = real_units.num_density(smooth_bckgnd_stack)
#n_stack = real_units.num_density(stack)

#smooth_n_stack = improve_data.smooth_sinos(n_stack)
####### does reconstructions at different heights #######
number_of_slices = np.shape(n_stack)[1]
reconstructions = []

for x in np.linspace(0, np.shape(n_stack)[1] - 1, number_of_slices, dtype=int):
    print(x)
    #sino_90 = offset90_v2_29_11.centre_sino(smooth_n_stack[0:90,x,0:])
    #sino_180 = offset90_v2_29_11.mirror_sinogram(sino_90)

    #sino_180 = offset90_v2_29_11.centre_sino(smooth_n_stack[0:180,x,0:])
    sino_180 = offset90_v2_29_11.centre_sino(n_stack[0:180, x, 0:])