Beispiel #1
0
def test_simu():

    import siddon.simu as simu
    
    im = simu.fa.infoarrays2infoarray([simu.Image((1, 1)),])
    obj = simu.Object((1, 1, 1))
    im[:] = 0.
    obj[:] = 1.
    im2 = siddon.projector(im.copy(), obj)
    assert_almost_equal(im2[0], 0.39369162)
    im[:] = 1.
    obj[:] = 0.
    obj2 = siddon.backprojector(im, obj.copy())
    assert_almost_equal(obj2[0], 0.39369162)
Beispiel #2
0
# data 
image_header = {'n_images':60,
                'SIMPLE':True, 'BITPIX':-64,
                'NAXIS1':128, 'NAXIS2':128,
                'CRPIX1':64, 'CRPIX2':64,
                'CDELT1':6e-5, 'CDELT2':6e-5,
                'CRVAL1':0., 'CRVAL2':0.,
                }
image_header['radius'] = 200.
data = siddon.simu.circular_trajectory_data(**image_header)
data[:] = np.zeros(data.shape)
# projector
P = siddon.siddon_lo(data.header, obj.header)
# projection
t = time.time()
data = siddon.projector(data, obj)
print("projection time : " + str(time.time() - t))
# data
y = data.flatten()
# backprojection
t = time.time()
x0 = P.T * y
bpj = x0.reshape(obj.shape)
print("projection time : " + str(time.time() - t))
# coverage map
weights = (P.T * np.ones(y.size)).reshape(obj.shape)
# priors
Ds = [lo.diff(obj.shape, axis=i) for i in xrange(3)]
hypers = 1e-2 * np.ones(3)
#Ds, hypers = [], []
# inversion using scipy.sparse.linalg
Beispiel #3
0
 def matvec(x):
     y = dataarray_from_header(data_header)
     y[:] = 0
     projector(y, x, obstacle=obstacle)
     return y
Beispiel #4
0
 def matvec(x):
     x = fa.InfoArray(data=x, header=dict(cube_header))
     y = xout
     y[:] = 0.
     projector(y, x, **kwargs)
     return y