コード例 #1
0
# because we do not attempt to match actual X-ray transmission intensity.
dx = xlen0/nx0
dy = ylen0/ny0

#generate an indicator mask for the largest inscribed circle of the image
mask_rad = 1.0*xlen0*0.5
xar = np.arange(x00+dx/2.,x00+xlen0,dx)[:,np.newaxis]*np.ones([ny0])
yar = np.ones([nx0])[:,np.newaxis]*np.arange(y00+dy/2.,y00+ylen0,dy)
mask = np.ones([nx0,ny0],dtype='float64')
mask[xar**2 + yar**2>mask_rad**2] = 0.




image2Dsl = tomo.image2D(\
        shape=(nx0,ny0),\
        xlen= xlen0, ylen=ylen0,\
        x0 = x00, y0= y00)
q_image=image2Dsl.duplicate()
temp_image=image2Dsl.duplicate()

xim= tomo.image2D(shape=(nx0,ny0),x0=x00,xlen=xlen0,y0=y00,ylen=ylen0)
wimq= tomo.image2D(shape=(nx0,ny0),x0=x00,xlen=xlen0,y0=y00,ylen=ylen0)
ygradx = tomo.image2D(shape=(nx0,ny0),x0=x00,xlen=xlen0,y0=y00,ylen=ylen0)
ygrady = tomo.image2D(shape=(nx0,ny0),x0=x00,xlen=xlen0,y0=y00,ylen=ylen0)
wimp= tomo.image2D(shape=(nx0,ny0),x0=x00,xlen=xlen0,y0=y00,ylen=ylen0)
xbarim= tomo.image2D(shape=(nx0,ny0),x0=x00,xlen=xlen0,y0=y00,ylen=ylen0)



image2Dsl.mat = np.load(phantomfile)[::scalefactor,::scalefactor]
image2Dsl.mat *= mask
コード例 #2
0
# because we do not attempt to match actual X-ray transmission intensity.
dx = xlen0/nx0
dy = ylen0/ny0

#generate an indicator mask for the largest inscribed circle of the image
mask_rad = 1.0*xlen0*0.5
xar = np.arange(x00+dx/2.,x00+xlen0,dx)[:,np.newaxis]*np.ones([ny0])
yar = np.ones([nx0])[:,np.newaxis]*np.arange(y00+dy/2.,y00+ylen0,dy)
mask = np.ones([nx0,ny0],dtype='float64')
mask[xar**2 + yar**2>mask_rad**2] = 0.




image2Dsl = tomo.image2D(\
        shape=(nx0,ny0),\
        xlen= xlen0, ylen=ylen0,\
        x0 = x00, y0= y00)
q_image=image2Dsl.duplicate()
temp_image=image2Dsl.duplicate()

xim= tomo.image2D(shape=(nx0,ny0),x0=x00,xlen=xlen0,y0=y00,ylen=ylen0)
wimq= tomo.image2D(shape=(nx0,ny0),x0=x00,xlen=xlen0,y0=y00,ylen=ylen0)
yid = tomo.image2D(shape=(nx0,ny0),x0=x00,xlen=xlen0,y0=y00,ylen=ylen0)
wimp= tomo.image2D(shape=(nx0,ny0),x0=x00,xlen=xlen0,y0=y00,ylen=ylen0)
xbarim= tomo.image2D(shape=(nx0,ny0),x0=x00,xlen=xlen0,y0=y00,ylen=ylen0)



image2Dsl.mat = np.load(phantomfile)[::scalefactor,::scalefactor]
image2Dsl.mat *= mask
コード例 #3
0
ファイル: testCUDA.py プロジェクト: JEStec/how_little_data
nthreads_backprojection = 4

fsino = tomo.sinogram2D(\
   config_name='circular_fan',\
   parms={"source_to_detector":sd,\
          "radius"            :srad},\
   shape=(ns0,nu0),\
   s0=s00,slen=slen0, u0 = u00, ulen = ulen0)


cuda_sino =fsino.duplicate()




image = tomo.image2D(shape=(nx0,ny0),x0=x00,xlen=xlen0,y0=y00,ylen=ylen0)
fimage = image.duplicate()
cuda_image = image.duplicate()

print "Embedding phantom to an image..."
phshepp.collapse_to(image)

print('starting fortran projection')
t0 = time.time()
image.project_to(fsino)
print 'finished fortran projection in: ', time.time() - t0
print 'result in fsino'


print('starting CUDA projection')
t0 = time.time()
コード例 #4
0
ファイル: testCUDA.py プロジェクト: jakobsj/how_little_data
nblocks_projection = 512
nthreads_projection = 4

nblocks_backprojection = 128
nthreads_backprojection = 4

fsino = tomo.sinogram2D(\
   config_name='circular_fan',\
   parms={"source_to_detector":sd,\
          "radius"            :srad},\
   shape=(ns0,nu0),\
   s0=s00,slen=slen0, u0 = u00, ulen = ulen0)

cuda_sino = fsino.duplicate()

image = tomo.image2D(shape=(nx0, ny0), x0=x00, xlen=xlen0, y0=y00, ylen=ylen0)
fimage = image.duplicate()
cuda_image = image.duplicate()

print "Embedding phantom to an image..."
phshepp.collapse_to(image)

print('starting fortran projection')
t0 = time.time()
image.project_to(fsino)
print 'finished fortran projection in: ', time.time() - t0
print 'result in fsino'

print('starting CUDA projection')
t0 = time.time()
image.cproject_to(cuda_sino,