コード例 #1
0
# MAIN PARAMETER BLOCK
imagefile = "tvmin"+str(scalefactor)+"_lam1e-4_"
phantomfile = "structureWalnut.npy"
lam = 1.e-4
itermax = 10001 
imagedumpset=[100,1000]
nviews = [4,8,12,16,18,19,20,21,22,24,28,32,36,40,50,100]
# end of MAIN PARAMETER BLOCK




if using_CUDA:
   tomo.set_GPU_dev(0)
   print "GPU = ",tomo.get_GPU_dev()



def gradim(image):
   '''Compute gradient of an image for the TV norm.
'''
   xgrad = image.mat.copy()
   ygrad = image.mat.copy()
   temp = image.mat
   xgrad[:-1,:] = temp[1:,:] - temp[:-1,:]
   ygrad[:,:-1] = temp[:,1:] - temp[:,:-1]
   xgrad[-1,:] =  -1.0* temp[-1,:]
   ygrad[:,-1] =  -1.0* temp[:,-1]

   return xgrad,ygrad
コード例 #2
0
# MAIN PARAMETER BLOCK
imagefile = "l1min"+str(scalefactor)+"_lam1e-4_"
phantomfile = "structureWalnut.npy"
lam = 1.e-4
itermax = 100001 
imagedumpset=[100,1000,10000]
nviews = [10,18,19,20,21,22,24,26,28,30,40,60]
# end of MAIN PARAMETER BLOCK





if using_CUDA:
   tomo.set_GPU_dev(0)
   print "GPU = ",tomo.get_GPU_dev()




# Image parameters
#    numbers of pixels in each dimension of the image array
nx0 = 1024/scalefactor
ny0 =  1024/scalefactor
#    physical lengths of image array
xlen0 = 2.0             
ylen0 = 2.0             
#    physical corner of image array
x00 = -1.
y00 = -1.
# for the present theoretical studies physical dimension has little meaning
コード例 #3
0
ファイル: testCUDA.py プロジェクト: JEStec/how_little_data
phshepp = generate_shepp_logan_HC()

#
print '''This program is designed to run in an ipython shell with matplotlib.
From terminal command line run:
ipython --pylab

From within the ipython shell execute:
run testCUDA.py


'''


print tomo.get_GPU_dev()
tomo.set_GPU_dev(0)
print 'GPU dev now: ',tomo.get_GPU_dev()


#image parameters
nx0=1024
ny0=1024
xlen0=2.0
ylen0=2.0
x00=-1.0
y00=-1.0


# scan configuration parameters
srad = 4.
コード例 #4
0
ファイル: testCUDA.py プロジェクト: jakobsj/how_little_data
from phantoms_tomo2D import generate_shepp_logan_HC

phshepp = generate_shepp_logan_HC()

#
print '''This program is designed to run in an ipython shell with matplotlib.
From terminal command line run:
ipython --pylab

From within the ipython shell execute:
run testCUDA.py


'''

print tomo.get_GPU_dev()
tomo.set_GPU_dev(0)
print 'GPU dev now: ', tomo.get_GPU_dev()

#image parameters
nx0 = 1024
ny0 = 1024
xlen0 = 2.0
ylen0 = 2.0
x00 = -1.0
y00 = -1.0

# scan configuration parameters
srad = 4.
sd = 8.