123456789101112131415161718 |
- import numpy as np
- def BP(G, sino, nx):
- G1=np.transpose(G)
- im=G1.dot(sino.ravel()).reshape(nx,nx)
- return im
- def FBP(G,sino, nx, na):
- sinofft=np.fft.fft(sino)
- N2=sino.shape[1]/2
- filt=np.arange(0,sino.shape[1],dtype=np.float)
- filt-=N2
- filt=np.abs(filt)
- filt=-(filt-N2)
- f2d = np.outer(np.ones(na),filt)
- sinofft = sinofft * f2d
- sino1=np.fft.ifft(sinofft)
- return BP(G,sino1,nx)
|