From 9a4372d61fc3c2c0661d479ffe4a13193c7f8862 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 19 Oct 2016 12:37:35 +0200 Subject: Fix Python create_projector docstring --- python/astra/creators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python/astra') diff --git a/python/astra/creators.py b/python/astra/creators.py index 18504ea..7009884 100644 --- a/python/astra/creators.py +++ b/python/astra/creators.py @@ -535,7 +535,7 @@ def create_reconstruction(rec_type, proj_id, sinogram, iterations=1, use_mask='n def create_projector(proj_type, proj_geom, vol_geom): - """Create a 2D projector. + """Create a 2D or 3D projector. :param proj_type: Projector type, such as ``'line'``, ``'linear'``, ... :type proj_type: :class:`string` -- cgit v1.2.3 From ba0895b5299512e5028429e9e0111ab9944899cc Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 26 Apr 2016 16:45:33 +0200 Subject: Add SIRT plugin --- python/astra/__init__.py | 1 + python/astra/plugins/__init__.py | 28 +++++++++++++ python/astra/plugins/sirt.py | 90 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 python/astra/plugins/__init__.py create mode 100644 python/astra/plugins/sirt.py (limited to 'python/astra') diff --git a/python/astra/__init__.py b/python/astra/__init__.py index 515d9a2..f4f5fe8 100644 --- a/python/astra/__init__.py +++ b/python/astra/__init__.py @@ -35,6 +35,7 @@ from . import projector from . import projector3d from . import matrix from . import plugin +from . import plugins from . import log from .optomo import OpTomo diff --git a/python/astra/plugins/__init__.py b/python/astra/plugins/__init__.py new file mode 100644 index 0000000..a24b04d --- /dev/null +++ b/python/astra/plugins/__init__.py @@ -0,0 +1,28 @@ +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam +# +# Contact: astra@uantwerpen.be +# Website: http://sf.net/projects/astra-toolbox +# +# This file is part of the ASTRA Toolbox. +# +# +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . +# +# ----------------------------------------------------------------------- + + +from .sirt import SIRTPlugin + diff --git a/python/astra/plugins/sirt.py b/python/astra/plugins/sirt.py new file mode 100644 index 0000000..a0f1230 --- /dev/null +++ b/python/astra/plugins/sirt.py @@ -0,0 +1,90 @@ +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam +# +# Contact: astra@uantwerpen.be +# Website: http://sf.net/projects/astra-toolbox +# +# This file is part of the ASTRA Toolbox. +# +# +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . +# +# ----------------------------------------------------------------------- + + +import astra +import numpy as np +import six + +class SIRTPlugin(astra.plugin.base): + """SIRT. + + Options: + + 'Relaxation': relaxation factor (optional) + 'MinConstraint': constrain values to at least this (optional) + 'MaxConstraint': constrain values to at most this (optional) + """ + + astra_name = "SIRT-PLUGIN" + + def initialize(self,cfg, Relaxation = 1, MinConstraint = None, MaxConstraint = None): + self.W = astra.OpTomo(cfg['ProjectorId']) + self.vid = cfg['ReconstructionDataId'] + self.sid = cfg['ProjectionDataId'] + self.min_constraint = MinConstraint + self.max_constraint = MaxConstraint + + try: + v = astra.data2d.get_shared(self.vid) + s = astra.data2d.get_shared(self.sid) + self.data_mod = astra.data2d + except Exception: + v = astra.data3d.get_shared(self.vid) + s = astra.data3d.get_shared(self.sid) + self.data_mod = astra.data3d + + self.R = self.W * np.ones(v.shape,dtype=np.float32).ravel(); + self.R[self.R < 0.000001] = np.Inf + self.R = 1 / self.R + self.R = self.R.reshape(s.shape) + + self.mrC = self.W.T * np.ones(s.shape,dtype=np.float32).ravel(); + self.mrC[self.mrC < 0.000001] = np.Inf + self.mrC = -Relaxation / self.mrC + self.mrC = self.mrC.reshape(v.shape) + + + def run(self, its): + v = self.data_mod.get_shared(self.vid) + s = self.data_mod.get_shared(self.sid) + tv = np.zeros(v.shape, dtype=np.float32) + ts = np.zeros(s.shape, dtype=np.float32) + W = self.W + mrC = self.mrC + R = self.R + for i in range(its): + W.FP(v,out=ts) + ts -= s + ts *= R # ts = R * (W*v - s) + + W.BP(ts,out=tv) + tv *= mrC + + v += tv # v = v - rel * C * W' * ts + + if self.min_constraint is not None or self.max_constraint is not None: + v.clip(min=self.min_constraint, max=self.max_constraint, out=v) + -- cgit v1.2.3 From 4843e28a6666b9557dc7550a9fc056adee4c21c8 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 29 Aug 2016 14:07:20 +0200 Subject: Add CGLS plugin --- python/astra/plugins/__init__.py | 1 + python/astra/plugins/cgls.py | 99 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 python/astra/plugins/cgls.py (limited to 'python/astra') diff --git a/python/astra/plugins/__init__.py b/python/astra/plugins/__init__.py index a24b04d..71e9b64 100644 --- a/python/astra/plugins/__init__.py +++ b/python/astra/plugins/__init__.py @@ -25,4 +25,5 @@ from .sirt import SIRTPlugin +from .cgls import CGLSPlugin diff --git a/python/astra/plugins/cgls.py b/python/astra/plugins/cgls.py new file mode 100644 index 0000000..2f4970b --- /dev/null +++ b/python/astra/plugins/cgls.py @@ -0,0 +1,99 @@ +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam +# +# Contact: astra@uantwerpen.be +# Website: http://sf.net/projects/astra-toolbox +# +# This file is part of the ASTRA Toolbox. +# +# +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . +# +# ----------------------------------------------------------------------- + + +import astra +import numpy as np +import six + +class CGLSPlugin(astra.plugin.base): + """CGLS.""" + + astra_name = "CGLS-PLUGIN" + + def initialize(self,cfg): + self.W = astra.OpTomo(cfg['ProjectorId']) + self.vid = cfg['ReconstructionDataId'] + self.sid = cfg['ProjectionDataId'] + + try: + v = astra.data2d.get_shared(self.vid) + s = astra.data2d.get_shared(self.sid) + self.data_mod = astra.data2d + except Exception: + v = astra.data3d.get_shared(self.vid) + s = astra.data3d.get_shared(self.sid) + self.data_mod = astra.data3d + + def run(self, its): + v = self.data_mod.get_shared(self.vid) + s = self.data_mod.get_shared(self.sid) + z = np.zeros(v.shape, dtype=np.float32) + p = np.zeros(v.shape, dtype=np.float32) + r = np.zeros(s.shape, dtype=np.float32) + w = np.zeros(s.shape, dtype=np.float32) + W = self.W + + # r = s - W*v + W.FP(v, out=w) + r[:] = s + r -= w + + # p = W'*r + W.BP(r, out=p) + + # gamma = + gamma = np.dot(p.ravel(), p.ravel()) + + for i in range(its): + # w = W * p + W.FP(p, out=w) + + # alpha = gamma / + alpha = gamma / np.dot(w.ravel(), w.ravel()) + + # v += alpha * p + z[:] = p + z *= alpha + v += z + + # r -= alpha * w + w *= -alpha; + r += w + + # z = W' * r + W.BP(r, out=z) + + # beta = / gamma + newgamma = np.dot(z.ravel(), z.ravel()) + beta = newgamma / gamma + + # gamma = + gamma = newgamma + + # p = z + beta * p + p *= beta + p += z + -- cgit v1.2.3 From 3cfc4df88a9f70ab6fae8ce0ed955295c5ead9ca Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 28 Nov 2016 15:40:59 +0100 Subject: Update python headers --- python/astra/PyAlgorithmFactory.pxd | 36 ++++++++++++++--------------- python/astra/PyAlgorithmManager.pxd | 36 ++++++++++++++--------------- python/astra/PyData2DManager.pxd | 36 ++++++++++++++--------------- python/astra/PyData3DManager.pxd | 36 ++++++++++++++--------------- python/astra/PyIncludes.pxd | 36 ++++++++++++++--------------- python/astra/PyIndexManager.pxd | 2 +- python/astra/PyMatrixManager.pxd | 36 ++++++++++++++--------------- python/astra/PyProjector2DFactory.pxd | 36 ++++++++++++++--------------- python/astra/PyProjector2DManager.pxd | 36 ++++++++++++++--------------- python/astra/PyProjector3DFactory.pxd | 36 ++++++++++++++--------------- python/astra/PyProjector3DManager.pxd | 36 ++++++++++++++--------------- python/astra/PyXMLDocument.pxd | 35 ++++++++++++++-------------- python/astra/__init__.py | 36 ++++++++++++++--------------- python/astra/algorithm.py | 35 ++++++++++++++-------------- python/astra/algorithm_c.pyx | 2 +- python/astra/astra.py | 35 ++++++++++++++-------------- python/astra/astra_c.pyx | 2 +- python/astra/creators.py | 35 ++++++++++++++-------------- python/astra/data2d.py | 36 ++++++++++++++--------------- python/astra/data2d_c.pyx | 2 +- python/astra/data3d.py | 36 ++++++++++++++--------------- python/astra/data3d_c.pyx | 2 +- python/astra/experimental.pyx | 2 +- python/astra/extrautils.pyx | 2 +- python/astra/functions.py | 24 +++++++++---------- python/astra/log.py | 37 +++++++++++++++--------------- python/astra/log_c.pyx | 2 +- python/astra/matlab.py | 36 ++++++++++++++--------------- python/astra/matrix.py | 36 ++++++++++++++--------------- python/astra/matrix_c.pyx | 2 +- python/astra/optomo.py | 35 ++++++++++++++-------------- python/astra/plugin.py | 37 +++++++++++++++--------------- python/astra/plugin_c.pyx | 2 +- python/astra/plugins/__init__.py | 2 +- python/astra/plugins/cgls.py | 2 +- python/astra/plugins/sirt.py | 2 +- python/astra/projector.py | 36 ++++++++++++++--------------- python/astra/projector3d.py | 36 ++++++++++++++--------------- python/astra/projector3d_c.pyx | 2 +- python/astra/projector_c.pyx | 2 +- python/astra/pythonutils.py | 24 +++++++++---------- python/astra/src/PythonPluginAlgorithm.cpp | 2 +- python/astra/src/PythonPluginAlgorithm.h | 2 +- python/astra/utils.pxd | 36 ++++++++++++++--------------- python/astra/utils.pyx | 2 +- 45 files changed, 487 insertions(+), 494 deletions(-) (limited to 'python/astra') diff --git a/python/astra/PyAlgorithmFactory.pxd b/python/astra/PyAlgorithmFactory.pxd index 256d7b2..5e335e4 100644 --- a/python/astra/PyAlgorithmFactory.pxd +++ b/python/astra/PyAlgorithmFactory.pxd @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from libcpp.string cimport string from libcpp cimport bool from .PyIncludes cimport * diff --git a/python/astra/PyAlgorithmManager.pxd b/python/astra/PyAlgorithmManager.pxd index a99a807..dfc7961 100644 --- a/python/astra/PyAlgorithmManager.pxd +++ b/python/astra/PyAlgorithmManager.pxd @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# -------------------------------------------------------------------- + from libcpp.string cimport string from libcpp cimport bool from .PyIncludes cimport * diff --git a/python/astra/PyData2DManager.pxd b/python/astra/PyData2DManager.pxd index db8ec84..7cf60c7 100644 --- a/python/astra/PyData2DManager.pxd +++ b/python/astra/PyData2DManager.pxd @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from libcpp.string cimport string from .PyIncludes cimport * diff --git a/python/astra/PyData3DManager.pxd b/python/astra/PyData3DManager.pxd index 9264a82..250147e 100644 --- a/python/astra/PyData3DManager.pxd +++ b/python/astra/PyData3DManager.pxd @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from libcpp.string cimport string from .PyIncludes cimport * diff --git a/python/astra/PyIncludes.pxd b/python/astra/PyIncludes.pxd index 4a4ce43..39f9039 100644 --- a/python/astra/PyIncludes.pxd +++ b/python/astra/PyIncludes.pxd @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from libcpp cimport bool from libcpp.string cimport string from .PyXMLDocument cimport XMLNode diff --git a/python/astra/PyIndexManager.pxd b/python/astra/PyIndexManager.pxd index c1ad502..5eeff02 100644 --- a/python/astra/PyIndexManager.pxd +++ b/python/astra/PyIndexManager.pxd @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/PyMatrixManager.pxd b/python/astra/PyMatrixManager.pxd index b2b84c4..38ad7f1 100644 --- a/python/astra/PyMatrixManager.pxd +++ b/python/astra/PyMatrixManager.pxd @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from libcpp.string cimport string from .PyIncludes cimport * diff --git a/python/astra/PyProjector2DFactory.pxd b/python/astra/PyProjector2DFactory.pxd index 3314544..8c751fc 100644 --- a/python/astra/PyProjector2DFactory.pxd +++ b/python/astra/PyProjector2DFactory.pxd @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from libcpp.string cimport string from libcpp cimport bool from .PyIncludes cimport * diff --git a/python/astra/PyProjector2DManager.pxd b/python/astra/PyProjector2DManager.pxd index 92176ba..86bd3cf 100644 --- a/python/astra/PyProjector2DManager.pxd +++ b/python/astra/PyProjector2DManager.pxd @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from libcpp.string cimport string from .PyIncludes cimport * diff --git a/python/astra/PyProjector3DFactory.pxd b/python/astra/PyProjector3DFactory.pxd index bcbce94..345678b 100644 --- a/python/astra/PyProjector3DFactory.pxd +++ b/python/astra/PyProjector3DFactory.pxd @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from libcpp.string cimport string from libcpp cimport bool from .PyIncludes cimport * diff --git a/python/astra/PyProjector3DManager.pxd b/python/astra/PyProjector3DManager.pxd index b1eac6b..cdd739a 100644 --- a/python/astra/PyProjector3DManager.pxd +++ b/python/astra/PyProjector3DManager.pxd @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from libcpp.string cimport string from .PyIncludes cimport * diff --git a/python/astra/PyXMLDocument.pxd b/python/astra/PyXMLDocument.pxd index 033b8ef..dbd84d5 100644 --- a/python/astra/PyXMLDocument.pxd +++ b/python/astra/PyXMLDocument.pxd @@ -1,28 +1,27 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- # distutils: language = c++ # distutils: libraries = astra diff --git a/python/astra/__init__.py b/python/astra/__init__.py index f4f5fe8..25518b1 100644 --- a/python/astra/__init__.py +++ b/python/astra/__init__.py @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from . import matlab as m from .creators import astra_dict,create_vol_geom, create_proj_geom, create_backprojection, create_sino, create_reconstruction, create_projector,create_sino3d_gpu, create_backprojection3d_gpu from .functions import data_op, add_noise_to_sino, clear, move_vol_geom diff --git a/python/astra/algorithm.py b/python/astra/algorithm.py index 46cfccc..b6dfb95 100644 --- a/python/astra/algorithm.py +++ b/python/astra/algorithm.py @@ -1,28 +1,27 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- from . import algorithm_c as a diff --git a/python/astra/algorithm_c.pyx b/python/astra/algorithm_c.pyx index 4e96578..84d742d 100644 --- a/python/astra/algorithm_c.pyx +++ b/python/astra/algorithm_c.pyx @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/astra.py b/python/astra/astra.py index 61c26ee..625f7b4 100644 --- a/python/astra/astra.py +++ b/python/astra/astra.py @@ -1,28 +1,27 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- from . import astra_c as a diff --git a/python/astra/astra_c.pyx b/python/astra/astra_c.pyx index 8e30e69..caa8d02 100644 --- a/python/astra/astra_c.pyx +++ b/python/astra/astra_c.pyx @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/creators.py b/python/astra/creators.py index 7009884..f45fd52 100644 --- a/python/astra/creators.py +++ b/python/astra/creators.py @@ -1,28 +1,27 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- import six import numpy as np diff --git a/python/astra/data2d.py b/python/astra/data2d.py index f119f05..674161d 100644 --- a/python/astra/data2d.py +++ b/python/astra/data2d.py @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from . import data2d_c as d import numpy as np diff --git a/python/astra/data2d_c.pyx b/python/astra/data2d_c.pyx index 65e80ce..203fde2 100644 --- a/python/astra/data2d_c.pyx +++ b/python/astra/data2d_c.pyx @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/data3d.py b/python/astra/data3d.py index f143659..9c2bea4 100644 --- a/python/astra/data3d.py +++ b/python/astra/data3d.py @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from . import data3d_c as d import numpy as np diff --git a/python/astra/data3d_c.pyx b/python/astra/data3d_c.pyx index 811d1e4..915c60d 100644 --- a/python/astra/data3d_c.pyx +++ b/python/astra/data3d_c.pyx @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/experimental.pyx b/python/astra/experimental.pyx index 9bb73a2..b6c7881 100644 --- a/python/astra/experimental.pyx +++ b/python/astra/experimental.pyx @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/extrautils.pyx b/python/astra/extrautils.pyx index 2c7771e..502cc78 100644 --- a/python/astra/extrautils.pyx +++ b/python/astra/extrautils.pyx @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/functions.py b/python/astra/functions.py index 3f4aa82..7277de5 100644 --- a/python/astra/functions.py +++ b/python/astra/functions.py @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -# Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -# Author: Daniel M. Pelt -# Contact: D.M.Pelt@cwi.nl -# Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -# This file is part of the Python interface to the -# All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -# The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify +# The ASTRA Toolbox is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# (at your option) any later version. # -# The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, +# The ASTRA Toolbox is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with the Python interface to the ASTRA Toolbox. If not, see . +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + """Additional functions for PyAstraToolbox. .. moduleauthor:: Daniel M. Pelt diff --git a/python/astra/log.py b/python/astra/log.py index 3ec0df5..a54ed08 100644 --- a/python/astra/log.py +++ b/python/astra/log.py @@ -1,28 +1,27 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- from . import log_c as l @@ -150,4 +149,4 @@ def setOutputFile(filename, level): :param level: Logging level to use (DEBUG, INFO, WARN, or ERROR). :type level: :class:`int` """ - l.log_setOutputFile(filename, level) \ No newline at end of file + l.log_setOutputFile(filename, level) diff --git a/python/astra/log_c.pyx b/python/astra/log_c.pyx index 0d187e9..0757d0c 100644 --- a/python/astra/log_c.pyx +++ b/python/astra/log_c.pyx @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/matlab.py b/python/astra/matlab.py index 83b345d..c96931e 100644 --- a/python/astra/matlab.py +++ b/python/astra/matlab.py @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + """This module implements a MATLAB-like interface to the ASTRA Toolbox. Note that all functions are called with a :class:`string` as the first diff --git a/python/astra/matrix.py b/python/astra/matrix.py index 27e4823..eeb873c 100644 --- a/python/astra/matrix.py +++ b/python/astra/matrix.py @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from . import matrix_c as m def delete(ids): diff --git a/python/astra/matrix_c.pyx b/python/astra/matrix_c.pyx index f5c0938..ba20b10 100644 --- a/python/astra/matrix_c.pyx +++ b/python/astra/matrix_c.pyx @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/optomo.py b/python/astra/optomo.py index dde719e..74f34e5 100644 --- a/python/astra/optomo.py +++ b/python/astra/optomo.py @@ -1,28 +1,27 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- from . import data2d from . import data3d diff --git a/python/astra/plugin.py b/python/astra/plugin.py index 3e3528d..56c2761 100644 --- a/python/astra/plugin.py +++ b/python/astra/plugin.py @@ -1,28 +1,27 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- from . import plugin_c as p from . import log @@ -118,4 +117,4 @@ def get_help(name): :returns: :class:`str` -- Help string (docstring). """ - return p.get_help(name) \ No newline at end of file + return p.get_help(name) diff --git a/python/astra/plugin_c.pyx b/python/astra/plugin_c.pyx index ee04853..3853cec 100644 --- a/python/astra/plugin_c.pyx +++ b/python/astra/plugin_c.pyx @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/plugins/__init__.py b/python/astra/plugins/__init__.py index 71e9b64..88a68cb 100644 --- a/python/astra/plugins/__init__.py +++ b/python/astra/plugins/__init__.py @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/plugins/cgls.py b/python/astra/plugins/cgls.py index 2f4970b..5268f51 100644 --- a/python/astra/plugins/cgls.py +++ b/python/astra/plugins/cgls.py @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/plugins/sirt.py b/python/astra/plugins/sirt.py index a0f1230..5238399 100644 --- a/python/astra/plugins/sirt.py +++ b/python/astra/plugins/sirt.py @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/projector.py b/python/astra/projector.py index e370e5a..878e011 100644 --- a/python/astra/projector.py +++ b/python/astra/projector.py @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from . import projector_c as p def create(config): diff --git a/python/astra/projector3d.py b/python/astra/projector3d.py index d1086b9..9befa3f 100644 --- a/python/astra/projector3d.py +++ b/python/astra/projector3d.py @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from . import projector3d_c as p def create(config): diff --git a/python/astra/projector3d_c.pyx b/python/astra/projector3d_c.pyx index e355e38..98eccc1 100644 --- a/python/astra/projector3d_c.pyx +++ b/python/astra/projector3d_c.pyx @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/projector_c.pyx b/python/astra/projector_c.pyx index 53d38c3..be529da 100644 --- a/python/astra/projector_c.pyx +++ b/python/astra/projector_c.pyx @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # diff --git a/python/astra/pythonutils.py b/python/astra/pythonutils.py index 8ea4af5..3bd3321 100644 --- a/python/astra/pythonutils.py +++ b/python/astra/pythonutils.py @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -# Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -# Author: Daniel M. Pelt -# Contact: D.M.Pelt@cwi.nl -# Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -# This file is part of the Python interface to the -# All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -# The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify +# The ASTRA Toolbox is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# (at your option) any later version. # -# The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, +# The ASTRA Toolbox is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with the Python interface to the ASTRA Toolbox. If not, see . +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + """Additional purely Python functions for PyAstraToolbox. .. moduleauthor:: Daniel M. Pelt diff --git a/python/astra/src/PythonPluginAlgorithm.cpp b/python/astra/src/PythonPluginAlgorithm.cpp index 893db94..69b3d06 100644 --- a/python/astra/src/PythonPluginAlgorithm.cpp +++ b/python/astra/src/PythonPluginAlgorithm.cpp @@ -4,7 +4,7 @@ Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp 2014-2016, CWI, Amsterdam Contact: astra@uantwerpen.be -Website: http://sf.net/projects/astra-toolbox +Website: http://www.astra-toolbox.com/ This file is part of the ASTRA Toolbox. diff --git a/python/astra/src/PythonPluginAlgorithm.h b/python/astra/src/PythonPluginAlgorithm.h index ea4c6fb..dacd0e4 100644 --- a/python/astra/src/PythonPluginAlgorithm.h +++ b/python/astra/src/PythonPluginAlgorithm.h @@ -4,7 +4,7 @@ Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp 2014-2016, CWI, Amsterdam Contact: astra@uantwerpen.be -Website: http://sf.net/projects/astra-toolbox +Website: http://www.astra-toolbox.com/ This file is part of the ASTRA Toolbox. diff --git a/python/astra/utils.pxd b/python/astra/utils.pxd index ca84836..695081f 100644 --- a/python/astra/utils.pxd +++ b/python/astra/utils.pxd @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://www.astra-toolbox.com/ # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to the ASTRA Toolbox is free software: you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation, either version 3 of the License, or -#(at your option) any later version. +# The ASTRA Toolbox is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -#The Python interface to the ASTRA Toolbox is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. +# The ASTRA Toolbox is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -#You should have received a copy of the GNU General Public License -#along with the Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . # -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- + from libcpp.string cimport string cimport PyXMLDocument diff --git a/python/astra/utils.pyx b/python/astra/utils.pyx index 34d1902..a40916b 100644 --- a/python/astra/utils.pyx +++ b/python/astra/utils.pyx @@ -3,7 +3,7 @@ # 2013-2016, CWI, Amsterdam # # Contact: astra@uantwerpen.be -# Website: http://sf.net/projects/astra-toolbox +# Website: http://www.astra-toolbox.com/ # # This file is part of the ASTRA Toolbox. # -- cgit v1.2.3 From 7017618690b66e99773355b82afe26ac869d6aa8 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 28 Nov 2016 15:34:50 +0100 Subject: Add astra.__version__ (PEP396) --- python/astra/__init__.py | 2 ++ python/astra/astra.py | 11 ----------- python/astra/astra_c.pyx | 9 --------- 3 files changed, 2 insertions(+), 20 deletions(-) (limited to 'python/astra') diff --git a/python/astra/__init__.py b/python/astra/__init__.py index 25518b1..6707eff 100644 --- a/python/astra/__init__.py +++ b/python/astra/__init__.py @@ -39,6 +39,8 @@ from . import plugins from . import log from .optomo import OpTomo +__version__ = '1.8rc1' + import os if 'ASTRA_GPU_INDEX' in os.environ: diff --git a/python/astra/astra.py b/python/astra/astra.py index 625f7b4..3804d51 100644 --- a/python/astra/astra.py +++ b/python/astra/astra.py @@ -37,17 +37,6 @@ def use_cuda(): """ return a.use_cuda() - -def version(printToScreen=False): - """Check version of the ASTRA Toolbox. - - :param printToScreen: If ``True``, print version string. If ``False``, return version integer. - :type printToScreen: :class:`bool` - :returns: :class:`string` or :class:`int` -- The version string or integer. - - """ - return a.version(printToScreen) - def set_gpu_index(idx, memory=0): """Set default GPU index to use. diff --git a/python/astra/astra_c.pyx b/python/astra/astra_c.pyx index caa8d02..6de10da 100644 --- a/python/astra/astra_c.pyx +++ b/python/astra/astra_c.pyx @@ -37,8 +37,6 @@ cimport PyIndexManager from .PyIndexManager cimport CAstraObjectManagerBase cdef extern from "astra/Globals.h" namespace "astra": - int getVersion() - string getVersionString() bool cudaEnabled() IF HAVE_CUDA==True: @@ -74,13 +72,6 @@ def credits(): def use_cuda(): return cudaEnabled() - -def version(printToScreen=False): - if printToScreen: - six.print_(wrap_from_bytes(getVersionString())) - else: - return getVersion() - IF HAVE_CUDA==True: def set_gpu_index(idx, memory=0): import collections -- cgit v1.2.3 From 77f2cedaac088da5107dcfb37ae62d8f3a56f335 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Mon, 5 Dec 2016 14:44:09 +0100 Subject: Update version to 1.8 --- python/astra/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python/astra') diff --git a/python/astra/__init__.py b/python/astra/__init__.py index 6707eff..b73fff5 100644 --- a/python/astra/__init__.py +++ b/python/astra/__init__.py @@ -39,7 +39,7 @@ from . import plugins from . import log from .optomo import OpTomo -__version__ = '1.8rc1' +__version__ = '1.8' import os -- cgit v1.2.3 From 1d851f0a8fa093e044c7264569cc6f88df39a16e Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 26 Jan 2017 14:57:42 +0100 Subject: Remove unused 3d global min/max --- python/astra/data3d_c.pyx | 1 - 1 file changed, 1 deletion(-) (limited to 'python/astra') diff --git a/python/astra/data3d_c.pyx b/python/astra/data3d_c.pyx index 915c60d..1b9293a 100644 --- a/python/astra/data3d_c.pyx +++ b/python/astra/data3d_c.pyx @@ -132,7 +132,6 @@ def create(datatype,geometry,data=None, link=False): if not link: fillDataObject(pDataObject3D, data) - pDataObject3D.updateStatistics() return man3d.store(pDataObject3D) -- cgit v1.2.3 From ebd5fe932fd2d6c4a516bc1cdc69e37aa4f5cf55 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 8 Feb 2017 10:43:35 +0100 Subject: Make python -sinocone a synonym of -sino. The matlab interface already behaves like this. --- python/astra/data3d_c.pyx | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'python/astra') diff --git a/python/astra/data3d_c.pyx b/python/astra/data3d_c.pyx index 1b9293a..3934f22 100644 --- a/python/astra/data3d_c.pyx +++ b/python/astra/data3d_c.pyx @@ -86,7 +86,7 @@ def create(datatype,geometry,data=None, link=False): pDataObject3D = new CFloat32VolumeData3DMemory(pGeometry) del cfg del pGeometry - elif datatype == '-sino' or datatype == '-proj3d': + elif datatype == '-sino' or datatype == '-proj3d' or datatype == '-sinocone': cfg = utils.dictToConfig(six.b('ProjectionGeometry'), geometry) tpe = wrap_from_bytes(cfg.self.getAttribute(six.b('type'))) if (tpe == "parallel3d"): @@ -111,18 +111,6 @@ def create(datatype,geometry,data=None, link=False): pDataObject3D = new CFloat32ProjectionData3DMemory(ppGeometry) del ppGeometry del cfg - elif datatype == "-sinocone": - cfg = utils.dictToConfig(six.b('ProjectionGeometry'), geometry) - pppGeometry = new CConeProjectionGeometry3D() - if not pppGeometry.initialize(cfg[0]): - del cfg - del pppGeometry - raise Exception('Geometry class not initialized.') - if link: - pCustom = new CFloat32CustomPython(data) - pDataObject3D = new CFloat32ProjectionData3DMemory(pppGeometry, pCustom) - else: - pDataObject3D = new CFloat32ProjectionData3DMemory(pppGeometry) else: raise Exception("Invalid datatype. Please specify '-vol' or '-proj3d'.") -- cgit v1.2.3 From d85a660f064e8130b27e11c7fd762221c754c315 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 26 Jan 2017 14:57:57 +0100 Subject: Start work on CFloat32Data3DGPU to allow persistent/external GPU memory --- python/astra/PyIncludes.pxd | 48 +++++++++++++++++++++++++++------------ python/astra/data3d.py | 8 ++++--- python/astra/data3d_c.pyx | 53 ++++++++++++++++++++++++++++++++----------- python/astra/experimental.pyx | 24 +++++++++++++------- python/astra/pythonutils.py | 18 +++++++++++++++ 5 files changed, 113 insertions(+), 38 deletions(-) (limited to 'python/astra') diff --git a/python/astra/PyIncludes.pxd b/python/astra/PyIncludes.pxd index 39f9039..d5da17c 100644 --- a/python/astra/PyIncludes.pxd +++ b/python/astra/PyIncludes.pxd @@ -172,6 +172,13 @@ IF HAVE_CUDA==True: cdef extern from "astra/CudaProjector2D.h" namespace "astra": cdef cppclass CCudaProjector2D + cdef extern from "astra/Float32Data3DGPU.h" namespace "astraCUDA3d": + cdef cppclass MemHandle3D: + pass + + cdef extern from "astra/Float32Data3DGPU.h" namespace "astraCUDA3d": + cdef MemHandle3D wrapHandle(float *D_ptr, unsigned int x, unsigned int y, unsigned int z, unsigned int pitch) + cdef extern from "astra/SparseMatrix.h" namespace "astra": cdef cppclass CSparseMatrix: @@ -184,14 +191,18 @@ cdef extern from "astra/SparseMatrix.h" namespace "astra": unsigned int* m_piColIndices unsigned long* m_plRowStarts -cdef extern from "astra/Float32Data3DMemory.h" namespace "astra": - cdef cppclass CFloat32Data3DMemory: - CFloat32Data3DMemory() +cdef extern from "astra/Float32Data3D.h" namespace "astra": + cdef cppclass CFloat32Data3D: bool isInitialized() int getSize() int getWidth() int getHeight() int getDepth() + + +cdef extern from "astra/Float32Data3DMemory.h" namespace "astra": + cdef cppclass CFloat32Data3DMemory(CFloat32Data3D): + CFloat32Data3DMemory() void updateStatistics() float32 *getData() float32 ***getData3D() @@ -228,8 +239,6 @@ cdef extern from "astra/Float32VolumeData3DMemory.h" namespace "astra": int getSliceCount() bool isInitialized() - - cdef extern from "astra/ParallelProjectionGeometry3D.h" namespace "astra": cdef cppclass CParallelProjectionGeometry3D: CParallelProjectionGeometry3D() @@ -260,12 +269,23 @@ cdef extern from "astra/Float32ProjectionData3DMemory.h" namespace "astra": int getAngleCount() bool isInitialized() -cdef extern from "astra/Float32Data3D.h" namespace "astra": - cdef cppclass CFloat32Data3D: - CFloat32Data3D() - bool isInitialized() - int getSize() - int getWidth() - int getHeight() - int getDepth() - void updateStatistics() +IF HAVE_CUDA==True: + cdef extern from "astra/Float32VolumeData3DGPU.h" namespace "astra": + cdef cppclass CFloat32VolumeData3DGPU: + CFloat32VolumeData3DGPU(CVolumeGeometry3D*, MemHandle3D) + CVolumeGeometry3D* getGeometry() + void changeGeometry(CVolumeGeometry3D*) + int getRowCount() + int getColCount() + int getSliceCount() + bool isInitialized() + + cdef extern from "astra/Float32ProjectionData3DGPU.h" namespace "astra": + cdef cppclass CFloat32ProjectionData3DGPU: + CFloat32ProjectionData3DGPU(CProjectionGeometry3D*, MemHandle3D) + CProjectionGeometry3D* getGeometry() + void changeGeometry(CProjectionGeometry3D*) + int getRowCount() + int getColCount() + int getSliceCount() + bool isInitialized() diff --git a/python/astra/data3d.py b/python/astra/data3d.py index 9c2bea4..a825700 100644 --- a/python/astra/data3d.py +++ b/python/astra/data3d.py @@ -26,6 +26,8 @@ from . import data3d_c as d import numpy as np +from .pythonutils import GPULink + def create(datatype,geometry,data=None): """Create a 3D object. @@ -52,11 +54,11 @@ def link(datatype, geometry, data): :returns: :class:`int` -- the ID of the constructed object. """ - if not isinstance(data,np.ndarray): + if not isinstance(data,np.ndarray) and not isinstance(data,GPULink): raise ValueError("Input should be a numpy array") - if not data.dtype==np.float32: + if not isinstance(data,GPULink) and not data.dtype==np.float32: raise ValueError("Numpy array should be float32") - if not (data.flags['C_CONTIGUOUS'] and data.flags['ALIGNED']): + if not isinstance(data,GPULink) and not (data.flags['C_CONTIGUOUS'] and data.flags['ALIGNED']): raise ValueError("Numpy array should be C_CONTIGUOUS and ALIGNED") return d.create(datatype,geometry,data,True) diff --git a/python/astra/data3d_c.pyx b/python/astra/data3d_c.pyx index 3934f22..56247de 100644 --- a/python/astra/data3d_c.pyx +++ b/python/astra/data3d_c.pyx @@ -45,12 +45,17 @@ from .PyXMLDocument cimport XMLDocument cimport utils from .utils import wrap_from_bytes -from .pythonutils import geom_size +from .pythonutils import geom_size, GPULink import operator from six.moves import reduce +include "config.pxi" + +cdef extern from "Python.h": + void* PyLong_AsVoidPtr(object) + cdef CData3DManager * man3d = PyData3DManager.getSingletonPtr() @@ -65,12 +70,19 @@ def create(datatype,geometry,data=None, link=False): cdef Config *cfg cdef CVolumeGeometry3D * pGeometry cdef CProjectionGeometry3D * ppGeometry - cdef CFloat32Data3DMemory * pDataObject3D + cdef CFloat32Data3D * pDataObject3D cdef CConeProjectionGeometry3D* pppGeometry - cdef CFloat32CustomMemory * pCustom - - if link and data.shape!=geom_size(geometry): - raise Exception("The dimensions of the data do not match those specified in the geometry.") + cdef CFloat32CustomMemory * pCustom = NULL + IF HAVE_CUDA==True: + cdef MemHandle3D hnd + + if link: + if isinstance(data, GPULink): + s = geom_size(geometry) + if geom_size(geometry) != ( data.z, data.y, data.x ): + raise Exception("The dimensions of the data do not match those specified in the geometry.") + elif data.shape!=geom_size(geometry): + raise Exception("The dimensions of the data do not match those specified in the geometry.") if datatype == '-vol': cfg = utils.dictToConfig(six.b('VolumeGeometry'), geometry) @@ -80,10 +92,18 @@ def create(datatype,geometry,data=None, link=False): del pGeometry raise Exception('Geometry class not initialized.') if link: - pCustom = new CFloat32CustomPython(data) - pDataObject3D = new CFloat32VolumeData3DMemory(pGeometry, pCustom) + if isinstance(data, GPULink): + IF HAVE_CUDA==True: + s = geom_size(geometry) + hnd = wrapHandle(PyLong_AsVoidPtr(data.ptr), data.x, data.y, data.z, data.pitch/4) + pDataObject3D = new CFloat32VolumeData3DGPU(pGeometry, hnd) + ELSE: + raise NotImplementedError("CUDA support is not enabled in ASTRA") + else: + pCustom = new CFloat32CustomPython(data) + pDataObject3D = new CFloat32VolumeData3DMemory(pGeometry, pCustom) else: - pDataObject3D = new CFloat32VolumeData3DMemory(pGeometry) + pDataObject3D = new CFloat32VolumeData3DMemory(pGeometry) del cfg del pGeometry elif datatype == '-sino' or datatype == '-proj3d' or datatype == '-sinocone': @@ -105,8 +125,16 @@ def create(datatype,geometry,data=None, link=False): del ppGeometry raise Exception('Geometry class not initialized.') if link: - pCustom = new CFloat32CustomPython(data) - pDataObject3D = new CFloat32ProjectionData3DMemory(ppGeometry, pCustom) + if isinstance(data, GPULink): + IF HAVE_CUDA==True: + s = geom_size(geometry) + hnd = wrapHandle(PyLong_AsVoidPtr(data.ptr), data.x, data.y, data.z, data.pitch/4) + pDataObject3D = new CFloat32ProjectionData3DGPU(ppGeometry, hnd) + ELSE: + raise NotImplementedError("CUDA support is not enabled in ASTRA") + else: + pCustom = new CFloat32CustomPython(data) + pDataObject3D = new CFloat32ProjectionData3DMemory(ppGeometry, pCustom) else: pDataObject3D = new CFloat32ProjectionData3DMemory(ppGeometry) del ppGeometry @@ -118,8 +146,7 @@ def create(datatype,geometry,data=None, link=False): del pDataObject3D raise Exception("Couldn't initialize data object.") - if not link: fillDataObject(pDataObject3D, data) - + if not link: fillDataObject(dynamic_cast_mem(pDataObject3D), data) return man3d.store(pDataObject3D) diff --git a/python/astra/experimental.pyx b/python/astra/experimental.pyx index b6c7881..0af3118 100644 --- a/python/astra/experimental.pyx +++ b/python/astra/experimental.pyx @@ -36,12 +36,20 @@ IF HAVE_CUDA==True: cdef extern from "astra/CompositeGeometryManager.h" namespace "astra": cdef cppclass CCompositeGeometryManager: - bool doFP(CProjector3D *, vector[CFloat32VolumeData3DMemory *], vector[CFloat32ProjectionData3DMemory *]) - bool doBP(CProjector3D *, vector[CFloat32VolumeData3DMemory *], vector[CFloat32ProjectionData3DMemory *]) + bool doFP(CProjector3D *, vector[CFloat32VolumeData3D *], vector[CFloat32ProjectionData3D *]) + bool doBP(CProjector3D *, vector[CFloat32VolumeData3D *], vector[CFloat32ProjectionData3D *]) cdef extern from *: - CFloat32VolumeData3DMemory * dynamic_cast_vol_mem "dynamic_cast" (CFloat32Data3D * ) except NULL - CFloat32ProjectionData3DMemory * dynamic_cast_proj_mem "dynamic_cast" (CFloat32Data3D * ) except NULL + CFloat32VolumeData3D * dynamic_cast_vol_mem "dynamic_cast" (CFloat32Data3D * ) except NULL + CFloat32ProjectionData3D * dynamic_cast_proj_mem "dynamic_cast" (CFloat32Data3D * ) except NULL + + cdef extern from "astra/Float32ProjectionData3D.h" namespace "astra": + cdef cppclass CFloat32ProjectionData3D: + bool isInitialized() + cdef extern from "astra/Float32VolumeData3D.h" namespace "astra": + cdef cppclass CFloat32VolumeData3D: + bool isInitialized() + cimport PyProjector3DManager from .PyProjector3DManager cimport CProjector3DManager @@ -52,9 +60,9 @@ IF HAVE_CUDA==True: cdef CData3DManager * man3d = PyData3DManager.getSingletonPtr() def do_composite(projector_id, vol_ids, proj_ids, t): - cdef vector[CFloat32VolumeData3DMemory *] vol - cdef CFloat32VolumeData3DMemory * pVolObject - cdef CFloat32ProjectionData3DMemory * pProjObject + cdef vector[CFloat32VolumeData3D *] vol + cdef CFloat32VolumeData3D * pVolObject + cdef CFloat32ProjectionData3D * pProjObject for v in vol_ids: pVolObject = dynamic_cast_vol_mem(man3d.get(v)) if pVolObject == NULL: @@ -62,7 +70,7 @@ IF HAVE_CUDA==True: if not pVolObject.isInitialized(): raise Exception("Data object not initialized properly") vol.push_back(pVolObject) - cdef vector[CFloat32ProjectionData3DMemory *] proj + cdef vector[CFloat32ProjectionData3D *] proj for v in proj_ids: pProjObject = dynamic_cast_proj_mem(man3d.get(v)) if pProjObject == NULL: diff --git a/python/astra/pythonutils.py b/python/astra/pythonutils.py index 3bd3321..27fa8fd 100644 --- a/python/astra/pythonutils.py +++ b/python/astra/pythonutils.py @@ -61,3 +61,21 @@ def geom_size(geom, dim=None): s = s[dim] return s + +class GPULink(object): + """Utility class for astra.data3d.link with a CUDA pointer + + The CUDA pointer ptr must point to an array of floats. + + x is the fastest-changing coordinate, z the slowest-changing. + + pitch is the width in bytes of the memory block. For a contiguous + memory block, pitch is equal to sizeof(float) * x. For a memory block + allocated by cudaMalloc3D, pitch is the pitch as returned by cudaMalloc3D. + """ + def __init__(self, ptr, x, y, z, pitch): + self.ptr = ptr + self.x = x + self.y = y + self.z = z + self.pitch = pitch -- cgit v1.2.3 From ae33f713a2dea236e28145dcd6007589feb618ed Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 8 Feb 2017 10:47:22 +0100 Subject: Make typechecks in data3d.create more robust --- python/astra/data3d_c.pyx | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'python/astra') diff --git a/python/astra/data3d_c.pyx b/python/astra/data3d_c.pyx index 56247de..73e75b9 100644 --- a/python/astra/data3d_c.pyx +++ b/python/astra/data3d_c.pyx @@ -77,12 +77,15 @@ def create(datatype,geometry,data=None, link=False): cdef MemHandle3D hnd if link: - if isinstance(data, GPULink): + if isinstance(data, np.ndarray): + if data.shape != geom_size(geometry): + raise Exception("The dimensions of the data do not match those specified in the geometry.") + elif isinstance(data, GPULink): s = geom_size(geometry) if geom_size(geometry) != ( data.z, data.y, data.x ): raise Exception("The dimensions of the data do not match those specified in the geometry.") - elif data.shape!=geom_size(geometry): - raise Exception("The dimensions of the data do not match those specified in the geometry.") + else: + raise TypeError("data should be a numpy.ndarray or a GPULink object") if datatype == '-vol': cfg = utils.dictToConfig(six.b('VolumeGeometry'), geometry) @@ -92,7 +95,10 @@ def create(datatype,geometry,data=None, link=False): del pGeometry raise Exception('Geometry class not initialized.') if link: - if isinstance(data, GPULink): + if isinstance(data, np.ndarray): + pCustom = new CFloat32CustomPython(data) + pDataObject3D = new CFloat32VolumeData3DMemory(pGeometry, pCustom) + elif isinstance(data, GPULink): IF HAVE_CUDA==True: s = geom_size(geometry) hnd = wrapHandle(PyLong_AsVoidPtr(data.ptr), data.x, data.y, data.z, data.pitch/4) @@ -100,8 +106,7 @@ def create(datatype,geometry,data=None, link=False): ELSE: raise NotImplementedError("CUDA support is not enabled in ASTRA") else: - pCustom = new CFloat32CustomPython(data) - pDataObject3D = new CFloat32VolumeData3DMemory(pGeometry, pCustom) + raise TypeError("data should be a numpy.ndarray or a GPULink object") else: pDataObject3D = new CFloat32VolumeData3DMemory(pGeometry) del cfg @@ -125,7 +130,10 @@ def create(datatype,geometry,data=None, link=False): del ppGeometry raise Exception('Geometry class not initialized.') if link: - if isinstance(data, GPULink): + if isinstance(data, np.ndarray): + pCustom = new CFloat32CustomPython(data) + pDataObject3D = new CFloat32ProjectionData3DMemory(ppGeometry, pCustom) + elif isinstance(data, GPULink): IF HAVE_CUDA==True: s = geom_size(geometry) hnd = wrapHandle(PyLong_AsVoidPtr(data.ptr), data.x, data.y, data.z, data.pitch/4) @@ -133,8 +141,7 @@ def create(datatype,geometry,data=None, link=False): ELSE: raise NotImplementedError("CUDA support is not enabled in ASTRA") else: - pCustom = new CFloat32CustomPython(data) - pDataObject3D = new CFloat32ProjectionData3DMemory(ppGeometry, pCustom) + raise TypeError("data should be a numpy.ndarray or a GPULink object") else: pDataObject3D = new CFloat32ProjectionData3DMemory(ppGeometry) del ppGeometry @@ -146,7 +153,8 @@ def create(datatype,geometry,data=None, link=False): del pDataObject3D raise Exception("Couldn't initialize data object.") - if not link: fillDataObject(dynamic_cast_mem(pDataObject3D), data) + if not link: + fillDataObject(dynamic_cast_mem(pDataObject3D), data) return man3d.store(pDataObject3D) -- cgit v1.2.3 From 2af27e7ba08a65cce15c7e0658712fbba8f447fd Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 8 Feb 2017 11:31:31 +0100 Subject: Improve data2d/data3d error messages --- python/astra/data2d_c.pyx | 57 +++++++++++++++++++++++------------------- python/astra/data3d.py | 11 +++++---- python/astra/data3d_c.pyx | 63 ++++++++++++++++++++++++----------------------- 3 files changed, 70 insertions(+), 61 deletions(-) (limited to 'python/astra') diff --git a/python/astra/data2d_c.pyx b/python/astra/data2d_c.pyx index 203fde2..9c88073 100644 --- a/python/astra/data2d_c.pyx +++ b/python/astra/data2d_c.pyx @@ -83,8 +83,10 @@ def create(datatype, geometry, data=None, link=False): cdef CFloat32Data2D * pDataObject2D cdef CFloat32CustomMemory * pCustom - if link and data.shape!=geom_size(geometry): - raise Exception("The dimensions of the data do not match those specified in the geometry.") + if link: + geom_shape = geom_size(geometry) + if data.shape != geom_shape: + raise ValueError("The dimensions of the data do not match those specified in the geometry: {} != {}".format(data.shape, geom_shape)) if datatype == '-vol': cfg = utils.dictToConfig(six.b('VolumeGeometry'), geometry) @@ -92,7 +94,7 @@ def create(datatype, geometry, data=None, link=False): if not pGeometry.initialize(cfg[0]): del cfg del pGeometry - raise Exception('Geometry class not initialized.') + raise RuntimeError('Geometry class not initialized.') if link: pCustom = new CFloat32CustomPython(data) pDataObject2D = new CFloat32VolumeData2D(pGeometry, pCustom) @@ -114,7 +116,7 @@ def create(datatype, geometry, data=None, link=False): if not ppGeometry.initialize(cfg[0]): del cfg del ppGeometry - raise Exception('Geometry class not initialized.') + raise RuntimeError('Geometry class not initialized.') if link: pCustom = new CFloat32CustomPython(data) pDataObject2D = new CFloat32ProjectionData2D(ppGeometry, pCustom) @@ -123,11 +125,11 @@ def create(datatype, geometry, data=None, link=False): del ppGeometry del cfg else: - raise Exception("Invalid datatype. Please specify '-vol' or '-sino'.") + raise ValueError("Invalid datatype. Please specify '-vol' or '-sino'.") if not pDataObject2D.isInitialized(): del pDataObject2D - raise Exception("Couldn't initialize data object.") + raise RuntimeError("Couldn't initialize data object.") if not link: fillDataObject(pDataObject2D, data) @@ -138,6 +140,10 @@ cdef fillDataObject(CFloat32Data2D * obj, data): fillDataObjectScalar(obj, 0) else: if isinstance(data, np.ndarray): + obj_shape = (obj.getHeight(), obj.getWidth()) + if data.shape != obj_shape: + raise ValueError( + "The dimensions of the data do not match those specified in the geometry: {} != {}".format(data.shape, obj_shape)) fillDataObjectArray(obj, np.ascontiguousarray(data,dtype=np.float32)) else: fillDataObjectScalar(obj, np.float32(data)) @@ -150,18 +156,15 @@ cdef fillDataObjectScalar(CFloat32Data2D * obj, float s): @cython.boundscheck(False) @cython.wraparound(False) cdef fillDataObjectArray(CFloat32Data2D * obj, float [:,::1] data): - if (not data.shape[0] == obj.getHeight()) or (not data.shape[1] == obj.getWidth()): - raise Exception( - "The dimensions of the data do not match those specified in the geometry.") cdef float [:,::1] cView = obj.getData2D()[0] cView[:] = data cdef CFloat32Data2D * getObject(i) except NULL: cdef CFloat32Data2D * pDataObject = man2d.get(i) if pDataObject == NULL: - raise Exception("Data object not found") + raise ValueError("Data object not found") if not pDataObject.isInitialized(): - raise Exception("Data object not initialized properly.") + raise RuntimeError("Data object not initialized properly.") return pDataObject @@ -180,15 +183,15 @@ def get_geometry(i): pDataObject3 = pDataObject geom = utils.configToDict(pDataObject3.getGeometry().getConfiguration()) else: - raise Exception("Not a known data object") + raise RuntimeError("Not a known data object") return geom cdef CProjector2D * getProjector(i) except NULL: cdef CProjector2D * proj = manProj.get(i) if proj == NULL: - raise Exception("Projector not initialized.") + raise RuntimeError("Projector not initialized.") if not proj.isInitialized(): - raise Exception("Projector not initialized.") + raise RuntimeError("Projector not initialized.") return proj def check_compatible(i, proj_id): @@ -203,7 +206,7 @@ def check_compatible(i, proj_id): pDataObject3 = pDataObject return pDataObject3.getGeometry().isEqual(proj.getVolumeGeometry()) else: - raise Exception("Not a known data object") + raise RuntimeError("Not a known data object") def change_geometry(i, geom): cdef Config *cfg @@ -227,12 +230,14 @@ def change_geometry(i, geom): if not ppGeometry.initialize(cfg[0]): del cfg del ppGeometry - raise Exception('Geometry class not initialized.') - if (ppGeometry.getDetectorCount() != pDataObject2.getDetectorCount() or ppGeometry.getProjectionAngleCount() != pDataObject2.getAngleCount()): + raise RuntimeError('Geometry class not initialized.') + geom_shape = (ppGeometry.getProjectionAngleCount(), ppGeometry.getDetectorCount()) + obj_shape = (pDataObject2.getAngleCount(), pDataObject2.getDetectorCount()) + if geom_shape != obj_shape: del ppGeometry del cfg - raise Exception( - "The dimensions of the data do not match those specified in the geometry.") + raise ValueError( + "The dimensions of the data do not match those specified in the geometry: {} != {}", obj_shape, geom_shape) pDataObject2.changeGeometry(ppGeometry) del ppGeometry del cfg @@ -243,17 +248,19 @@ def change_geometry(i, geom): if not pGeometry.initialize(cfg[0]): del cfg del pGeometry - raise Exception('Geometry class not initialized.') - if (pGeometry.getGridColCount() != pDataObject3.getWidth() or pGeometry.getGridRowCount() != pDataObject3.getHeight()): + raise RuntimeError('Geometry class not initialized.') + geom_shape = (pGeometry.getGridRowCount(), pGeometry.getGridColCount()) + obj_shape = (pDataObject3.getHeight(), pDataObject3.getWidth()) + if geom_shape != obj_shape: del cfg del pGeometry - raise Exception( - 'The dimensions of the data do not match those specified in the geometry.') + raise ValueError( + "The dimensions of the data do not match those specified in the geometry: {} != {}", obj_shape, geom_shape) pDataObject3.changeGeometry(pGeometry) del cfg del pGeometry else: - raise Exception("Not a known data object") + raise RuntimeError("Not a known data object") @cython.boundscheck(False) @cython.wraparound(False) @@ -274,7 +281,7 @@ def get_shared(i): def get_single(i): - raise Exception("Not yet implemented") + raise NotImplementedError("Not yet implemented") def info(): diff --git a/python/astra/data3d.py b/python/astra/data3d.py index a825700..ecb99d0 100644 --- a/python/astra/data3d.py +++ b/python/astra/data3d.py @@ -55,11 +55,12 @@ def link(datatype, geometry, data): """ if not isinstance(data,np.ndarray) and not isinstance(data,GPULink): - raise ValueError("Input should be a numpy array") - if not isinstance(data,GPULink) and not data.dtype==np.float32: - raise ValueError("Numpy array should be float32") - if not isinstance(data,GPULink) and not (data.flags['C_CONTIGUOUS'] and data.flags['ALIGNED']): - raise ValueError("Numpy array should be C_CONTIGUOUS and ALIGNED") + raise TypeError("Input should be a numpy ndarray or GPULink object") + if isinstance(data, np.ndarray): + if data.dtype != np.float32: + raise ValueError("Numpy array should be float32") + if not (data.flags['C_CONTIGUOUS'] and data.flags['ALIGNED']): + raise ValueError("Numpy array should be C_CONTIGUOUS and ALIGNED") return d.create(datatype,geometry,data,True) diff --git a/python/astra/data3d_c.pyx b/python/astra/data3d_c.pyx index 73e75b9..78ed620 100644 --- a/python/astra/data3d_c.pyx +++ b/python/astra/data3d_c.pyx @@ -77,15 +77,15 @@ def create(datatype,geometry,data=None, link=False): cdef MemHandle3D hnd if link: + geom_shape = geom_size(geometry) if isinstance(data, np.ndarray): - if data.shape != geom_size(geometry): - raise Exception("The dimensions of the data do not match those specified in the geometry.") + data_shape = data.shape elif isinstance(data, GPULink): - s = geom_size(geometry) - if geom_size(geometry) != ( data.z, data.y, data.x ): - raise Exception("The dimensions of the data do not match those specified in the geometry.") + data_shape = ( data.z, data.y, data.x ) else: raise TypeError("data should be a numpy.ndarray or a GPULink object") + if geom_shape != data_shape: + raise ValueError("The dimensions of the data do not match those specified in the geometry: {} != {}".format(data_shape, geom_shape)) if datatype == '-vol': cfg = utils.dictToConfig(six.b('VolumeGeometry'), geometry) @@ -93,7 +93,7 @@ def create(datatype,geometry,data=None, link=False): if not pGeometry.initialize(cfg[0]): del cfg del pGeometry - raise Exception('Geometry class not initialized.') + raise RuntimeError('Geometry class not initialized.') if link: if isinstance(data, np.ndarray): pCustom = new CFloat32CustomPython(data) @@ -123,12 +123,12 @@ def create(datatype,geometry,data=None, link=False): elif (tpe == "cone_vec"): ppGeometry = new CConeVecProjectionGeometry3D(); else: - raise Exception("Invalid geometry type.") + raise ValueError("Invalid geometry type.") if not ppGeometry.initialize(cfg[0]): del cfg del ppGeometry - raise Exception('Geometry class not initialized.') + raise RuntimeError('Geometry class not initialized.') if link: if isinstance(data, np.ndarray): pCustom = new CFloat32CustomPython(data) @@ -147,11 +147,11 @@ def create(datatype,geometry,data=None, link=False): del ppGeometry del cfg else: - raise Exception("Invalid datatype. Please specify '-vol' or '-proj3d'.") + raise ValueError("Invalid datatype. Please specify '-vol' or '-proj3d'.") if not pDataObject3D.isInitialized(): del pDataObject3D - raise Exception("Couldn't initialize data object.") + raise RuntimeError("Couldn't initialize data object.") if not link: fillDataObject(dynamic_cast_mem(pDataObject3D), data) @@ -169,7 +169,7 @@ def get_geometry(i): pDataObject3 = pDataObject geom = utils.configToDict(pDataObject3.getGeometry().getConfiguration()) else: - raise Exception("Not a known data object") + raise RuntimeError("Not a known data object") return geom def change_geometry(i, geom): @@ -190,18 +190,18 @@ def change_geometry(i, geom): elif (tpe == "cone_vec"): ppGeometry = new CConeVecProjectionGeometry3D(); else: - raise Exception("Invalid geometry type.") + raise ValueError("Invalid geometry type.") if not ppGeometry.initialize(cfg[0]): del cfg del ppGeometry - raise Exception('Geometry class not initialized.') + raise RuntimeError('Geometry class not initialized.') del cfg - if (ppGeometry.getDetectorColCount() != pDataObject2.getDetectorColCount() or \ - ppGeometry.getProjectionCount() != pDataObject2.getAngleCount() or \ - ppGeometry.getDetectorRowCount() != pDataObject2.getDetectorRowCount()): + geom_shape = (ppGeometry.getDetectorRowCount(), ppGeometry.getProjectionCount(), ppGeometry.getDetectorColCount()) + obj_shape = (pDataObject2.getDetectorRowCount(), pDataObject2.getAngleCount(), pDataObject2.getDetectorColCount()) + if geom_shape != obj_shape: del ppGeometry - raise Exception( - "The dimensions of the data do not match those specified in the geometry.") + raise ValueError( + "The dimensions of the data do not match those specified in the geometry: {} != {}".format(obj_shape, geom_shape)) pDataObject2.changeGeometry(ppGeometry) del ppGeometry @@ -212,19 +212,19 @@ def change_geometry(i, geom): if not pGeometry.initialize(cfg[0]): del cfg del pGeometry - raise Exception('Geometry class not initialized.') + raise RuntimeError('Geometry class not initialized.') del cfg - if (pGeometry.getGridColCount() != pDataObject3.getColCount() or \ - pGeometry.getGridRowCount() != pDataObject3.getRowCount() or \ - pGeometry.getGridSliceCount() != pDataObject3.getSliceCount()): + geom_shape = (pGeometry.getGridSliceCount(), pGeometry.getGridRowCount(), pGeometry.getGridColCount()) + obj_shape = (pDataObject3.getSliceCount(), pDataObject3.getRowCount(), pDataObject3.getColCount()) + if geom_shape != obj_shape: del pGeometry - raise Exception( - "The dimensions of the data do not match those specified in the geometry.") + raise ValueError( + "The dimensions of the data do not match those specified in the geometry.".format(obj_shape, geom_shape)) pDataObject3.changeGeometry(pGeometry) del pGeometry else: - raise Exception("Not a known data object") + raise RuntimeError("Not a known data object") cdef fillDataObject(CFloat32Data3DMemory * obj, data): @@ -232,6 +232,10 @@ cdef fillDataObject(CFloat32Data3DMemory * obj, data): fillDataObjectScalar(obj, 0) else: if isinstance(data, np.ndarray): + obj_shape = (obj.getDepth(), obj.getHeight(), obj.getWidth()) + if data.shape != obj_shape: + raise ValueError( + "The dimensions of the data do not match those specified in the geometry: {} != {}".format(data.shape, obj_shape)) fillDataObjectArray(obj, np.ascontiguousarray(data,dtype=np.float32)) else: fillDataObjectScalar(obj, np.float32(data)) @@ -244,18 +248,15 @@ cdef fillDataObjectScalar(CFloat32Data3DMemory * obj, float s): @cython.boundscheck(False) @cython.wraparound(False) cdef fillDataObjectArray(CFloat32Data3DMemory * obj, float [:,:,::1] data): - if (not data.shape[0] == obj.getDepth()) or (not data.shape[1] == obj.getHeight()) or (not data.shape[2] == obj.getWidth()): - raise Exception( - "The dimensions of the data do not match those specified in the geometry.") cdef float [:,:,::1] cView = obj.getData3D()[0][0] cView[:] = data cdef CFloat32Data3D * getObject(i) except NULL: cdef CFloat32Data3D * pDataObject = man3d.get(i) if pDataObject == NULL: - raise Exception("Data object not found") + raise ValueError("Data object not found") if not pDataObject.isInitialized(): - raise Exception("Data object not initialized properly.") + raise RuntimeError("Data object not initialized properly.") return pDataObject @cython.boundscheck(False) @@ -278,7 +279,7 @@ def get_shared(i): return np.PyArray_SimpleNewFromData(3,shape,np.NPY_FLOAT32,pDataObject.getData3D()[0][0]) def get_single(i): - raise Exception("Not yet implemented") + raise NotImplementedError("Not yet implemented") def store(i,data): cdef CFloat32Data3D * pDataObject = getObject(i) -- cgit v1.2.3 From 4c665b0d5af3841f20501a5dc01a23e671367856 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 8 Feb 2017 14:21:18 +0100 Subject: Remove tabs from python code --- python/astra/PyIncludes.pxd | 370 ++++++++++++++++++++++---------------------- python/astra/creators.py | 2 +- python/astra/extrautils.pyx | 32 ++-- 3 files changed, 202 insertions(+), 202 deletions(-) (limited to 'python/astra') diff --git a/python/astra/PyIncludes.pxd b/python/astra/PyIncludes.pxd index d5da17c..b40d787 100644 --- a/python/astra/PyIncludes.pxd +++ b/python/astra/PyIncludes.pxd @@ -30,262 +30,262 @@ from .PyXMLDocument cimport XMLNode include "config.pxi" cdef extern from "astra/Globals.h" namespace "astra": - ctypedef float float32 - ctypedef double float64 - ctypedef unsigned short int uint16 - ctypedef signed short int sint16 - ctypedef unsigned char uchar8 - ctypedef signed char schar8 - ctypedef int int32 - ctypedef short int int16 + ctypedef float float32 + ctypedef double float64 + ctypedef unsigned short int uint16 + ctypedef signed short int sint16 + ctypedef unsigned char uchar8 + ctypedef signed char schar8 + ctypedef int int32 + ctypedef short int int16 cdef extern from "astra/Config.h" namespace "astra": - cdef cppclass Config: - Config() - void initialize(string rootname) - XMLNode self + cdef cppclass Config: + Config() + void initialize(string rootname) + XMLNode self cdef extern from "astra/VolumeGeometry2D.h" namespace "astra": - cdef cppclass CVolumeGeometry2D: - bool initialize(Config) - int getGridColCount() - int getGridRowCount() - int getGridTotCount() - float32 getWindowLengthX() - float32 getWindowLengthY() - float32 getWindowArea() - float32 getPixelLengthX() - float32 getPixelLengthY() - float32 getPixelArea() - float32 getWindowMinX() - float32 getWindowMinY() - float32 getWindowMaxX() - float32 getWindowMaxY() - Config* getConfiguration() - bool isEqual(CVolumeGeometry2D*) + cdef cppclass CVolumeGeometry2D: + bool initialize(Config) + int getGridColCount() + int getGridRowCount() + int getGridTotCount() + float32 getWindowLengthX() + float32 getWindowLengthY() + float32 getWindowArea() + float32 getPixelLengthX() + float32 getPixelLengthY() + float32 getPixelArea() + float32 getWindowMinX() + float32 getWindowMinY() + float32 getWindowMaxX() + float32 getWindowMaxY() + Config* getConfiguration() + bool isEqual(CVolumeGeometry2D*) cdef extern from "astra/Float32Data2D.h" namespace "astra": - cdef cppclass CFloat32CustomMemory: - pass + cdef cppclass CFloat32CustomMemory: + pass cdef extern from "astra/Float32VolumeData2D.h" namespace "astra": - cdef cppclass CFloat32VolumeData2D: - CFloat32VolumeData2D(CVolumeGeometry2D*) - CFloat32VolumeData2D(CVolumeGeometry2D*, CFloat32CustomMemory*) - CVolumeGeometry2D * getGeometry() - int getWidth() - int getHeight() - void changeGeometry(CVolumeGeometry2D*) - Config* getConfiguration() + cdef cppclass CFloat32VolumeData2D: + CFloat32VolumeData2D(CVolumeGeometry2D*) + CFloat32VolumeData2D(CVolumeGeometry2D*, CFloat32CustomMemory*) + CVolumeGeometry2D * getGeometry() + int getWidth() + int getHeight() + void changeGeometry(CVolumeGeometry2D*) + Config* getConfiguration() cdef extern from "astra/ProjectionGeometry2D.h" namespace "astra": - cdef cppclass CProjectionGeometry2D: - CProjectionGeometry2D() - bool initialize(Config) - int getDetectorCount() - int getProjectionAngleCount() - bool isOfType(string) - float32 getProjectionAngle(int) - float32 getDetectorWidth() - Config* getConfiguration() - bool isEqual(CProjectionGeometry2D*) + cdef cppclass CProjectionGeometry2D: + CProjectionGeometry2D() + bool initialize(Config) + int getDetectorCount() + int getProjectionAngleCount() + bool isOfType(string) + float32 getProjectionAngle(int) + float32 getDetectorWidth() + Config* getConfiguration() + bool isEqual(CProjectionGeometry2D*) cdef extern from "astra/Float32Data2D.h" namespace "astra::CFloat32Data2D": - cdef enum TWOEDataType "astra::CFloat32Data2D::EDataType": - TWOPROJECTION "astra::CFloat32Data2D::PROJECTION" - TWOVOLUME "astra::CFloat32Data2D::VOLUME" + cdef enum TWOEDataType "astra::CFloat32Data2D::EDataType": + TWOPROJECTION "astra::CFloat32Data2D::PROJECTION" + TWOVOLUME "astra::CFloat32Data2D::VOLUME" cdef extern from "astra/Float32Data3D.h" namespace "astra::CFloat32Data3D": - cdef enum THREEEDataType "astra::CFloat32Data3D::EDataType": - THREEPROJECTION "astra::CFloat32Data3D::PROJECTION" - THREEVOLUME "astra::CFloat32Data3D::VOLUME" + cdef enum THREEEDataType "astra::CFloat32Data3D::EDataType": + THREEPROJECTION "astra::CFloat32Data3D::PROJECTION" + THREEVOLUME "astra::CFloat32Data3D::VOLUME" cdef extern from "astra/Float32Data2D.h" namespace "astra": - cdef cppclass CFloat32Data2D: - bool isInitialized() - int getSize() - float32 *getData() - float32 **getData2D() - int getWidth() - int getHeight() - TWOEDataType getType() + cdef cppclass CFloat32Data2D: + bool isInitialized() + int getSize() + float32 *getData() + float32 **getData2D() + int getWidth() + int getHeight() + TWOEDataType getType() cdef extern from "astra/SparseMatrixProjectionGeometry2D.h" namespace "astra": - cdef cppclass CSparseMatrixProjectionGeometry2D: - CSparseMatrixProjectionGeometry2D() + cdef cppclass CSparseMatrixProjectionGeometry2D: + CSparseMatrixProjectionGeometry2D() cdef extern from "astra/FanFlatProjectionGeometry2D.h" namespace "astra": - cdef cppclass CFanFlatProjectionGeometry2D: - CFanFlatProjectionGeometry2D() + cdef cppclass CFanFlatProjectionGeometry2D: + CFanFlatProjectionGeometry2D() cdef extern from "astra/FanFlatVecProjectionGeometry2D.h" namespace "astra": - cdef cppclass CFanFlatVecProjectionGeometry2D: - CFanFlatVecProjectionGeometry2D() + cdef cppclass CFanFlatVecProjectionGeometry2D: + CFanFlatVecProjectionGeometry2D() cdef extern from "astra/ParallelProjectionGeometry2D.h" namespace "astra": - cdef cppclass CParallelProjectionGeometry2D: - CParallelProjectionGeometry2D() + cdef cppclass CParallelProjectionGeometry2D: + CParallelProjectionGeometry2D() cdef extern from "astra/Float32ProjectionData2D.h" namespace "astra": - cdef cppclass CFloat32ProjectionData2D: - CFloat32ProjectionData2D(CProjectionGeometry2D*) - CFloat32ProjectionData2D(CProjectionGeometry2D*, CFloat32CustomMemory*) - CProjectionGeometry2D * getGeometry() - void changeGeometry(CProjectionGeometry2D*) - int getDetectorCount() - int getAngleCount() + cdef cppclass CFloat32ProjectionData2D: + CFloat32ProjectionData2D(CProjectionGeometry2D*) + CFloat32ProjectionData2D(CProjectionGeometry2D*, CFloat32CustomMemory*) + CProjectionGeometry2D * getGeometry() + void changeGeometry(CProjectionGeometry2D*) + int getDetectorCount() + int getAngleCount() cdef extern from "astra/Algorithm.h" namespace "astra": - cdef cppclass CAlgorithm: - bool initialize(Config) - void run(int) nogil - bool isInitialized() + cdef cppclass CAlgorithm: + bool initialize(Config) + void run(int) nogil + bool isInitialized() cdef extern from "astra/ReconstructionAlgorithm2D.h" namespace "astra": - cdef cppclass CReconstructionAlgorithm2D: - bool getResidualNorm(float32&) + cdef cppclass CReconstructionAlgorithm2D: + bool getResidualNorm(float32&) cdef extern from "astra/Projector2D.h" namespace "astra": - cdef cppclass CProjector2D: - bool isInitialized() - CProjectionGeometry2D* getProjectionGeometry() - CVolumeGeometry2D* getVolumeGeometry() - CSparseMatrix* getMatrix() + cdef cppclass CProjector2D: + bool isInitialized() + CProjectionGeometry2D* getProjectionGeometry() + CVolumeGeometry2D* getVolumeGeometry() + CSparseMatrix* getMatrix() cdef extern from "astra/Projector3D.h" namespace "astra": - cdef cppclass CProjector3D: - bool isInitialized() - CProjectionGeometry3D* getProjectionGeometry() - CVolumeGeometry3D* getVolumeGeometry() + cdef cppclass CProjector3D: + bool isInitialized() + CProjectionGeometry3D* getProjectionGeometry() + CVolumeGeometry3D* getVolumeGeometry() IF HAVE_CUDA==True: - cdef extern from "astra/CudaProjector3D.h" namespace "astra": - cdef cppclass CCudaProjector3D + cdef extern from "astra/CudaProjector3D.h" namespace "astra": + cdef cppclass CCudaProjector3D - cdef extern from "astra/CudaProjector2D.h" namespace "astra": - cdef cppclass CCudaProjector2D + cdef extern from "astra/CudaProjector2D.h" namespace "astra": + cdef cppclass CCudaProjector2D - cdef extern from "astra/Float32Data3DGPU.h" namespace "astraCUDA3d": - cdef cppclass MemHandle3D: - pass + cdef extern from "astra/Float32Data3DGPU.h" namespace "astraCUDA3d": + cdef cppclass MemHandle3D: + pass - cdef extern from "astra/Float32Data3DGPU.h" namespace "astraCUDA3d": - cdef MemHandle3D wrapHandle(float *D_ptr, unsigned int x, unsigned int y, unsigned int z, unsigned int pitch) + cdef extern from "astra/Float32Data3DGPU.h" namespace "astraCUDA3d": + cdef MemHandle3D wrapHandle(float *D_ptr, unsigned int x, unsigned int y, unsigned int z, unsigned int pitch) cdef extern from "astra/SparseMatrix.h" namespace "astra": - cdef cppclass CSparseMatrix: - CSparseMatrix(unsigned int,unsigned int,unsigned long) - unsigned int m_iWidth - unsigned int m_iHeight - unsigned long m_lSize - bool isInitialized() - float32* m_pfValues - unsigned int* m_piColIndices - unsigned long* m_plRowStarts + cdef cppclass CSparseMatrix: + CSparseMatrix(unsigned int,unsigned int,unsigned long) + unsigned int m_iWidth + unsigned int m_iHeight + unsigned long m_lSize + bool isInitialized() + float32* m_pfValues + unsigned int* m_piColIndices + unsigned long* m_plRowStarts cdef extern from "astra/Float32Data3D.h" namespace "astra": - cdef cppclass CFloat32Data3D: - bool isInitialized() - int getSize() - int getWidth() - int getHeight() - int getDepth() + cdef cppclass CFloat32Data3D: + bool isInitialized() + int getSize() + int getWidth() + int getHeight() + int getDepth() cdef extern from "astra/Float32Data3DMemory.h" namespace "astra": - cdef cppclass CFloat32Data3DMemory(CFloat32Data3D): - CFloat32Data3DMemory() - void updateStatistics() - float32 *getData() - float32 ***getData3D() - THREEEDataType getType() + cdef cppclass CFloat32Data3DMemory(CFloat32Data3D): + CFloat32Data3DMemory() + void updateStatistics() + float32 *getData() + float32 ***getData3D() + THREEEDataType getType() cdef extern from "astra/VolumeGeometry3D.h" namespace "astra": - cdef cppclass CVolumeGeometry3D: - CVolumeGeometry3D() - bool initialize(Config) - Config * getConfiguration() - int getGridColCount() - int getGridRowCount() - int getGridSliceCount() + cdef cppclass CVolumeGeometry3D: + CVolumeGeometry3D() + bool initialize(Config) + Config * getConfiguration() + int getGridColCount() + int getGridRowCount() + int getGridSliceCount() cdef extern from "astra/ProjectionGeometry3D.h" namespace "astra": - cdef cppclass CProjectionGeometry3D: - CProjectionGeometry3D() - bool initialize(Config) - Config * getConfiguration() - int getProjectionCount() - int getDetectorColCount() - int getDetectorRowCount() + cdef cppclass CProjectionGeometry3D: + CProjectionGeometry3D() + bool initialize(Config) + Config * getConfiguration() + int getProjectionCount() + int getDetectorColCount() + int getDetectorRowCount() cdef extern from "astra/Float32VolumeData3DMemory.h" namespace "astra": - cdef cppclass CFloat32VolumeData3DMemory: - CFloat32VolumeData3DMemory(CVolumeGeometry3D*) - CFloat32VolumeData3DMemory(CVolumeGeometry3D*, CFloat32CustomMemory*) - CVolumeGeometry3D* getGeometry() - void changeGeometry(CVolumeGeometry3D*) - int getRowCount() - int getColCount() - int getSliceCount() - bool isInitialized() + cdef cppclass CFloat32VolumeData3DMemory: + CFloat32VolumeData3DMemory(CVolumeGeometry3D*) + CFloat32VolumeData3DMemory(CVolumeGeometry3D*, CFloat32CustomMemory*) + CVolumeGeometry3D* getGeometry() + void changeGeometry(CVolumeGeometry3D*) + int getRowCount() + int getColCount() + int getSliceCount() + bool isInitialized() cdef extern from "astra/ParallelProjectionGeometry3D.h" namespace "astra": - cdef cppclass CParallelProjectionGeometry3D: - CParallelProjectionGeometry3D() + cdef cppclass CParallelProjectionGeometry3D: + CParallelProjectionGeometry3D() cdef extern from "astra/ParallelVecProjectionGeometry3D.h" namespace "astra": - cdef cppclass CParallelVecProjectionGeometry3D: - CParallelVecProjectionGeometry3D() + cdef cppclass CParallelVecProjectionGeometry3D: + CParallelVecProjectionGeometry3D() cdef extern from "astra/ConeProjectionGeometry3D.h" namespace "astra": - cdef cppclass CConeProjectionGeometry3D: - CConeProjectionGeometry3D() - bool initialize(Config) + cdef cppclass CConeProjectionGeometry3D: + CConeProjectionGeometry3D() + bool initialize(Config) cdef extern from "astra/ConeVecProjectionGeometry3D.h" namespace "astra": - cdef cppclass CConeVecProjectionGeometry3D: - CConeVecProjectionGeometry3D() + cdef cppclass CConeVecProjectionGeometry3D: + CConeVecProjectionGeometry3D() cdef extern from "astra/Float32ProjectionData3DMemory.h" namespace "astra": - cdef cppclass CFloat32ProjectionData3DMemory: - CFloat32ProjectionData3DMemory(CProjectionGeometry3D*) - CFloat32ProjectionData3DMemory(CConeProjectionGeometry3D*) - CFloat32ProjectionData3DMemory(CProjectionGeometry3D*, CFloat32CustomMemory*) - CFloat32ProjectionData3DMemory(CConeProjectionGeometry3D*, CFloat32CustomMemory*) - CProjectionGeometry3D* getGeometry() - void changeGeometry(CProjectionGeometry3D*) - int getDetectorColCount() - int getDetectorRowCount() - int getAngleCount() - bool isInitialized() + cdef cppclass CFloat32ProjectionData3DMemory: + CFloat32ProjectionData3DMemory(CProjectionGeometry3D*) + CFloat32ProjectionData3DMemory(CConeProjectionGeometry3D*) + CFloat32ProjectionData3DMemory(CProjectionGeometry3D*, CFloat32CustomMemory*) + CFloat32ProjectionData3DMemory(CConeProjectionGeometry3D*, CFloat32CustomMemory*) + CProjectionGeometry3D* getGeometry() + void changeGeometry(CProjectionGeometry3D*) + int getDetectorColCount() + int getDetectorRowCount() + int getAngleCount() + bool isInitialized() IF HAVE_CUDA==True: - cdef extern from "astra/Float32VolumeData3DGPU.h" namespace "astra": - cdef cppclass CFloat32VolumeData3DGPU: - CFloat32VolumeData3DGPU(CVolumeGeometry3D*, MemHandle3D) - CVolumeGeometry3D* getGeometry() - void changeGeometry(CVolumeGeometry3D*) - int getRowCount() - int getColCount() - int getSliceCount() - bool isInitialized() - - cdef extern from "astra/Float32ProjectionData3DGPU.h" namespace "astra": - cdef cppclass CFloat32ProjectionData3DGPU: - CFloat32ProjectionData3DGPU(CProjectionGeometry3D*, MemHandle3D) - CProjectionGeometry3D* getGeometry() - void changeGeometry(CProjectionGeometry3D*) - int getRowCount() - int getColCount() - int getSliceCount() - bool isInitialized() + cdef extern from "astra/Float32VolumeData3DGPU.h" namespace "astra": + cdef cppclass CFloat32VolumeData3DGPU: + CFloat32VolumeData3DGPU(CVolumeGeometry3D*, MemHandle3D) + CVolumeGeometry3D* getGeometry() + void changeGeometry(CVolumeGeometry3D*) + int getRowCount() + int getColCount() + int getSliceCount() + bool isInitialized() + + cdef extern from "astra/Float32ProjectionData3DGPU.h" namespace "astra": + cdef cppclass CFloat32ProjectionData3DGPU: + CFloat32ProjectionData3DGPU(CProjectionGeometry3D*, MemHandle3D) + CProjectionGeometry3D* getGeometry() + void changeGeometry(CProjectionGeometry3D*) + int getRowCount() + int getColCount() + int getSliceCount() + bool isInitialized() diff --git a/python/astra/creators.py b/python/astra/creators.py index f45fd52..aa16221 100644 --- a/python/astra/creators.py +++ b/python/astra/creators.py @@ -258,7 +258,7 @@ This method can be called in a number of ways: elif intype == 'cone': if len(args) < 7: raise Exception('not enough variables: astra_create_proj_geom(cone, detector_spacing_x, detector_spacing_y, det_row_count, det_col_count, angles, source_origin, origin_det)') - return {'type': 'cone','DetectorSpacingX':args[0], 'DetectorSpacingY':args[1], 'DetectorRowCount':args[2],'DetectorColCount':args[3],'ProjectionAngles':args[4],'DistanceOriginSource': args[5],'DistanceOriginDetector':args[6]} + return {'type': 'cone','DetectorSpacingX':args[0], 'DetectorSpacingY':args[1], 'DetectorRowCount':args[2],'DetectorColCount':args[3],'ProjectionAngles':args[4],'DistanceOriginSource': args[5],'DistanceOriginDetector':args[6]} elif intype == 'cone_vec': if len(args) < 3: raise Exception('not enough variables: astra_create_proj_geom(cone_vec, det_row_count, det_col_count, V)') diff --git a/python/astra/extrautils.pyx b/python/astra/extrautils.pyx index 502cc78..248c6ee 100644 --- a/python/astra/extrautils.pyx +++ b/python/astra/extrautils.pyx @@ -26,19 +26,19 @@ def clipCircle(img): - cdef int i,j - cdef double x2,y2,mid,bnd - cdef long sz,sz2 - sz = img.shape[0] - sz2 = sz*sz - bnd = sz2/4. - mid = (sz-1.)/2. - nDel=0 - for i in range(sz): - for j in range(sz): - x2 = (i-mid)*(i-mid) - y2 = (j-mid)*(j-mid) - if x2+y2>bnd: - img[i,j]=0 - nDel=nDel+1 - return nDel + cdef int i,j + cdef double x2,y2,mid,bnd + cdef long sz,sz2 + sz = img.shape[0] + sz2 = sz*sz + bnd = sz2/4. + mid = (sz-1.)/2. + nDel=0 + for i in range(sz): + for j in range(sz): + x2 = (i-mid)*(i-mid) + y2 = (j-mid)*(j-mid) + if x2+y2>bnd: + img[i,j]=0 + nDel=nDel+1 + return nDel -- cgit v1.2.3 From 4d0d9ca396378813f8559f479ff9a64b0881a627 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 1 Mar 2017 21:26:08 +0100 Subject: Fix python build --- python/astra/algorithm_c.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python/astra') diff --git a/python/astra/algorithm_c.pyx b/python/astra/algorithm_c.pyx index 84d742d..0a48de8 100644 --- a/python/astra/algorithm_c.pyx +++ b/python/astra/algorithm_c.pyx @@ -44,7 +44,7 @@ from .utils import wrap_from_bytes cdef CAlgorithmManager * manAlg = PyAlgorithmManager.getSingletonPtr() cdef extern from *: - CReconstructionAlgorithm2D * dynamic_cast_recAlg "dynamic_cast" (CAlgorithm * ) except NULL + CReconstructionAlgorithm2D * dynamic_cast_recAlg "dynamic_cast" (CAlgorithm * ) except NULL def create(config): -- cgit v1.2.3 From ee0118aceff644f7e5cdb0c7298c41064357d86a Mon Sep 17 00:00:00 2001 From: Nicola VIGANO Date: Wed, 8 Mar 2017 15:14:53 +0100 Subject: Python: added options for projector creation, like for the matlab interface Signed-off-by: Nicola VIGANO --- python/astra/creators.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'python/astra') diff --git a/python/astra/creators.py b/python/astra/creators.py index aa16221..a0d347b 100644 --- a/python/astra/creators.py +++ b/python/astra/creators.py @@ -533,7 +533,7 @@ def create_reconstruction(rec_type, proj_id, sinogram, iterations=1, use_mask='n return recon_id -def create_projector(proj_type, proj_geom, vol_geom): +def create_projector(proj_type, proj_geom, vol_geom, options=None): """Create a 2D or 3D projector. :param proj_type: Projector type, such as ``'line'``, ``'linear'``, ... @@ -542,6 +542,7 @@ def create_projector(proj_type, proj_geom, vol_geom): :type proj_geom: :class:`dict` :param vol_geom: Volume geometry. :type vol_geom: :class:`dict` +:param options: Projector options structure defining ``'VoxelSuperSampling'``, ``'DetectorSuperSampling'``, and ``'GPUindex'``. :returns: :class:`int` -- The ID of the projector. """ @@ -550,6 +551,8 @@ def create_projector(proj_type, proj_geom, vol_geom): cfg = astra_dict(proj_type) cfg['ProjectionGeometry'] = proj_geom cfg['VolumeGeometry'] = vol_geom + if options is not None: + cfg['options'] = options types3d = ['linear3d', 'linearcone', 'cuda3d'] if proj_type in types3d: return projector3d.create(cfg) -- cgit v1.2.3 From 52392c4997225e255490d30cc097fc1ddd57614d Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 29 Mar 2017 10:38:53 +0200 Subject: Update create_projector docstring --- python/astra/creators.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'python/astra') diff --git a/python/astra/creators.py b/python/astra/creators.py index a0d347b..53d98e0 100644 --- a/python/astra/creators.py +++ b/python/astra/creators.py @@ -542,7 +542,8 @@ def create_projector(proj_type, proj_geom, vol_geom, options=None): :type proj_geom: :class:`dict` :param vol_geom: Volume geometry. :type vol_geom: :class:`dict` -:param options: Projector options structure defining ``'VoxelSuperSampling'``, ``'DetectorSuperSampling'``, and ``'GPUindex'``. +:param options: Projector options structure defining ``'VoxelSuperSampling'``, ``'DetectorSuperSampling'``. +:type options: :class:`dict` :returns: :class:`int` -- The ID of the projector. """ -- cgit v1.2.3