FBP.py 427 B

123456789101112131415161718
  1. import numpy as np
  2. def BP(G, sino, nx):
  3. G1=np.transpose(G)
  4. im=G1.dot(sino.ravel()).reshape(nx,nx)
  5. return im
  6. def FBP(G,sino, nx, na):
  7. sinofft=np.fft.fft(sino)
  8. N2=sino.shape[1]/2
  9. filt=np.arange(0,sino.shape[1],dtype=np.float)
  10. filt-=N2
  11. filt=np.abs(filt)
  12. filt=-(filt-N2)
  13. f2d = np.outer(np.ones(na),filt)
  14. sinofft = sinofft * f2d
  15. sino1=np.fft.ifft(sinofft)
  16. return BP(G,sino1,nx)