summaryrefslogtreecommitdiffstats
path: root/samples/python
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-03-20 11:20:46 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-03-20 11:20:46 +0100
commit1044332131498907bde76400638cfb42b9e4199d (patch)
treea84800b931aeb6f2c5fa83fe5db3b8cbf7f40823 /samples/python
parentd1ad446669cea2a76d7146023e4862a1fdbf3e13 (diff)
parent2d55fd38b4a8ef5076c0591ae4147f81c1107ee3 (diff)
downloadastra-1044332131498907bde76400638cfb42b9e4199d.tar.gz
astra-1044332131498907bde76400638cfb42b9e4199d.tar.bz2
astra-1044332131498907bde76400638cfb42b9e4199d.tar.xz
astra-1044332131498907bde76400638cfb42b9e4199d.zip
Merge branch 'master' into logging
Diffstat (limited to 'samples/python')
-rw-r--r--samples/python/s001_sinogram_par2d.py4
-rw-r--r--samples/python/s003_gpu_reconstruction.py4
-rw-r--r--samples/python/s008_gpu_selection.py4
-rw-r--r--samples/python/s012_masks.py4
-rw-r--r--samples/python/s013_constraints.py4
-rw-r--r--samples/python/s014_FBP.py4
-rw-r--r--samples/python/s015_fp_bp.py14
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()