diff options
author | Willem Jan Palenstijn <wjp@usecode.org> | 2015-03-18 16:55:00 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <wjp@usecode.org> | 2015-03-18 16:55:00 +0100 |
commit | a86c7735d1dd20ec884c256950b8a9575f3ebdca (patch) | |
tree | ab4e4e47ba92618562f84a47de587878f4d34af6 /samples/python | |
parent | 65a607967e71d68ec32f34b7cf61fd8d891cc550 (diff) | |
parent | f603045f5bb41de6bc1ffa93badd932b891f5f1d (diff) | |
download | astra-a86c7735d1dd20ec884c256950b8a9575f3ebdca.tar.gz astra-a86c7735d1dd20ec884c256950b8a9575f3ebdca.tar.bz2 astra-a86c7735d1dd20ec884c256950b8a9575f3ebdca.tar.xz astra-a86c7735d1dd20ec884c256950b8a9575f3ebdca.zip |
Merge pull request #28 from dmpelt/projector3d-python
Add projector3d and CUDA projectors to Python (to match new Matlab code)
Diffstat (limited to 'samples/python')
-rw-r--r-- | samples/python/s001_sinogram_par2d.py | 4 | ||||
-rw-r--r-- | samples/python/s003_gpu_reconstruction.py | 4 | ||||
-rw-r--r-- | samples/python/s008_gpu_selection.py | 4 | ||||
-rw-r--r-- | samples/python/s012_masks.py | 4 | ||||
-rw-r--r-- | samples/python/s013_constraints.py | 4 | ||||
-rw-r--r-- | samples/python/s014_FBP.py | 4 | ||||
-rw-r--r-- | samples/python/s015_fp_bp.py | 14 |
7 files changed, 19 insertions, 19 deletions
diff --git a/samples/python/s001_sinogram_par2d.py b/samples/python/s001_sinogram_par2d.py index 009d9b3..1d1b912 100644 --- a/samples/python/s001_sinogram_par2d.py +++ b/samples/python/s001_sinogram_par2d.py @@ -43,8 +43,8 @@ P = scipy.io.loadmat('phantom.mat')['phantom256'] # Create a sinogram using the GPU. # Note that the first time the GPU is accessed, there may be a delay # of up to 10 seconds for initialization. -proj_id = astra.create_projector('line',proj_geom,vol_geom) -sinogram_id, sinogram = astra.create_sino(P, proj_id,useCUDA=True) +proj_id = astra.create_projector('cuda',proj_geom,vol_geom) +sinogram_id, sinogram = astra.create_sino(P, proj_id) import pylab pylab.gray() diff --git a/samples/python/s003_gpu_reconstruction.py b/samples/python/s003_gpu_reconstruction.py index 4f6ec1f..07b38ef 100644 --- a/samples/python/s003_gpu_reconstruction.py +++ b/samples/python/s003_gpu_reconstruction.py @@ -33,8 +33,8 @@ proj_geom = astra.create_proj_geom('parallel', 1.0, 384, np.linspace(0,np.pi,180 # As before, create a sinogram from a phantom import scipy.io P = scipy.io.loadmat('phantom.mat')['phantom256'] -proj_id = astra.create_projector('line',proj_geom,vol_geom) -sinogram_id, sinogram = astra.create_sino(P, proj_id,useCUDA=True) +proj_id = astra.create_projector('cuda',proj_geom,vol_geom) +sinogram_id, sinogram = astra.create_sino(P, proj_id) import pylab pylab.gray() diff --git a/samples/python/s008_gpu_selection.py b/samples/python/s008_gpu_selection.py index c42e53b..a180802 100644 --- a/samples/python/s008_gpu_selection.py +++ b/samples/python/s008_gpu_selection.py @@ -32,10 +32,10 @@ proj_geom = astra.create_proj_geom('parallel', 1.0, 384, np.linspace(0,np.pi,180 import scipy.io P = scipy.io.loadmat('phantom.mat')['phantom256'] -proj_id = astra.create_projector('line',proj_geom,vol_geom) +proj_id = astra.create_projector('cuda',proj_geom,vol_geom) # Create a sinogram from a phantom, using GPU #1. (The default is #0) -sinogram_id, sinogram = astra.create_sino(P, proj_id, useCUDA=True, gpuIndex=1) +sinogram_id, sinogram = astra.create_sino(P, proj_id, gpuIndex=1) # Set up the parameters for a reconstruction algorithm using the GPU diff --git a/samples/python/s012_masks.py b/samples/python/s012_masks.py index 441d11b..0f667b0 100644 --- a/samples/python/s012_masks.py +++ b/samples/python/s012_masks.py @@ -48,8 +48,8 @@ proj_geom = astra.create_proj_geom('parallel', 1.0, 384, np.linspace(0,np.pi,50, # As before, create a sinogram from a phantom import scipy.io P = scipy.io.loadmat('phantom.mat')['phantom256'] -proj_id = astra.create_projector('line',proj_geom,vol_geom) -sinogram_id, sinogram = astra.create_sino(P, proj_id,useCUDA=True) +proj_id = astra.create_projector('cuda',proj_geom,vol_geom) +sinogram_id, sinogram = astra.create_sino(P, proj_id) pylab.figure(2) pylab.imshow(P) diff --git a/samples/python/s013_constraints.py b/samples/python/s013_constraints.py index 009360e..8b63d5e 100644 --- a/samples/python/s013_constraints.py +++ b/samples/python/s013_constraints.py @@ -36,8 +36,8 @@ proj_geom = astra.create_proj_geom('parallel', 1.0, 384, np.linspace(0,np.pi,50, # As before, create a sinogram from a phantom import scipy.io P = scipy.io.loadmat('phantom.mat')['phantom256'] -proj_id = astra.create_projector('line',proj_geom,vol_geom) -sinogram_id, sinogram = astra.create_sino(P, proj_id,useCUDA=True) +proj_id = astra.create_projector('cuda',proj_geom,vol_geom) +sinogram_id, sinogram = astra.create_sino(P, proj_id) import pylab pylab.gray() diff --git a/samples/python/s014_FBP.py b/samples/python/s014_FBP.py index ef4afc2..2f8e388 100644 --- a/samples/python/s014_FBP.py +++ b/samples/python/s014_FBP.py @@ -33,8 +33,8 @@ proj_geom = astra.create_proj_geom('parallel', 1.0, 384, np.linspace(0,np.pi,180 # As before, create a sinogram from a phantom import scipy.io P = scipy.io.loadmat('phantom.mat')['phantom256'] -proj_id = astra.create_projector('line',proj_geom,vol_geom) -sinogram_id, sinogram = astra.create_sino(P, proj_id,useCUDA=True) +proj_id = astra.create_projector('cuda',proj_geom,vol_geom) +sinogram_id, sinogram = astra.create_sino(P, proj_id) import pylab pylab.gray() diff --git a/samples/python/s015_fp_bp.py b/samples/python/s015_fp_bp.py index 10c238d..fa0bf86 100644 --- a/samples/python/s015_fp_bp.py +++ b/samples/python/s015_fp_bp.py @@ -26,8 +26,8 @@ # This example demonstrates using the FP and BP primitives with Matlab's lsqr -# solver. Calls to FP (astra_create_sino_cuda) and -# BP (astra_create_backprojection_cuda) are wrapped in a function astra_wrap, +# solver. Calls to FP (astra.create_sino) and +# BP (astra.create_backprojection) are wrapped in a function astra_wrap, # and a handle to this function is passed to lsqr. # Because in this case the inputs/outputs of FP and BP have to be vectors @@ -39,17 +39,17 @@ import numpy as np # FP/BP wrapper class class astra_wrap(object): def __init__(self,proj_geom,vol_geom): - self.proj_id = astra.create_projector('line',proj_geom,vol_geom) + self.proj_id = astra.create_projector('cuda',proj_geom,vol_geom) self.shape = (proj_geom['DetectorCount']*len(proj_geom['ProjectionAngles']),vol_geom['GridColCount']*vol_geom['GridRowCount']) self.dtype = np.float def matvec(self,v): - sid, s = astra.create_sino(np.reshape(v,(vol_geom['GridRowCount'],vol_geom['GridColCount'])),self.proj_id,useCUDA=True) + sid, s = astra.create_sino(np.reshape(v,(vol_geom['GridRowCount'],vol_geom['GridColCount'])),self.proj_id) astra.data2d.delete(sid) return s.flatten() def rmatvec(self,v): - bid, b = astra.create_backprojection(np.reshape(v,(len(proj_geom['ProjectionAngles']),proj_geom['DetectorCount'],)),self.proj_id,useCUDA=True) + bid, b = astra.create_backprojection(np.reshape(v,(len(proj_geom['ProjectionAngles']),proj_geom['DetectorCount'],)),self.proj_id) astra.data2d.delete(bid) return b.flatten() @@ -61,8 +61,8 @@ import scipy.io P = scipy.io.loadmat('phantom.mat')['phantom256'] # Create a sinogram using the GPU. -proj_id = astra.create_projector('line',proj_geom,vol_geom) -sinogram_id, sinogram = astra.create_sino(P, proj_id,useCUDA=True) +proj_id = astra.create_projector('cuda',proj_geom,vol_geom) +sinogram_id, sinogram = astra.create_sino(P, proj_id) # Reshape the sinogram into a vector b = sinogram.flatten() |