summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml10
-rw-r--r--build/linux/Makefile.in8
-rw-r--r--include/astra/Utilities.h20
-rw-r--r--python/astra/data3d.py2
-rw-r--r--python/astra/functions.py2
-rw-r--r--python/astra/optomo.py4
-rw-r--r--python/astra/utils.pyx12
-rw-r--r--python/conda/build.sh10
-rw-r--r--python/conda/libastra/build.sh15
-rw-r--r--python/conda/libastra/meta.yaml22
-rw-r--r--python/conda/meta.yaml7
11 files changed, 76 insertions, 36 deletions
diff --git a/.travis.yml b/.travis.yml
index f7e09e2..4a179f1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,6 +13,10 @@ addons:
apt:
packages:
- libboost-all-dev
+ - nvidia-common
+ - nvidia-current
+ - nvidia-cuda-toolkit
+ - nvidia-cuda-dev
env:
- CUDA=yes
- CUDA=no
@@ -27,17 +31,15 @@ before_install:
- export PATH="$HOME/miniconda/bin:$PATH"
- conda config --set always_yes yes --set changeps1 no
- conda update conda
- - if [ $CUDA == yes ]; then wget http://developer.download.nvidia.com/compute/cuda/6_0/rel/installers/cuda_6.0.37_linux_64.run; fi
- - if [ $CUDA == yes ]; then bash cuda_6.0.37_linux_64.run -toolkit -toolkitpath=$HOME/cuda/ -silent; fi
install:
- conda install python=$TRAVIS_PYTHON_VERSION six numpy scipy cython
- conda info -a
- cd build/linux
- ./autogen.sh
- - if [ $CUDA == yes ]; then ./configure --prefix=$HOME/astra --with-python --with-cuda=$HOME/cuda/; else ./configure --prefix=$HOME/astra --with-python; fi
+ - if [ $CUDA == yes ]; then ./configure --prefix=$HOME/astra --with-python --with-cuda; else ./configure --prefix=$HOME/astra --with-python --without-cuda; fi
- make -j 4
- make install
script:
- - LD_LIBRARY_PATH=$HOME/astra/lib/:$HOME/cuda/lib64/:$HOME/cuda/lib/:$LD_LIBRARY_PATH PYTHONPATH=$HOME/astra/python/:$PYTHONPATH python -c "import astra"
+ - LD_LIBRARY_PATH=$HOME/astra/lib/:$LD_LIBRARY_PATH PYTHONPATH=$HOME/astra/python/:$PYTHONPATH python -c "import astra"
diff --git a/build/linux/Makefile.in b/build/linux/Makefile.in
index 9535b4c..a199bf6 100644
--- a/build/linux/Makefile.in
+++ b/build/linux/Makefile.in
@@ -150,6 +150,7 @@ BASE_OBJECTS=\
src/ParallelProjectionGeometry3D.lo \
src/ParallelVecProjectionGeometry3D.lo \
src/PlatformDepSystemCode.lo \
+ src/PluginAlgorithm.lo \
src/ProjectionGeometry2D.lo \
src/ProjectionGeometry3D.lo \
src/Projector2D.lo \
@@ -255,7 +256,6 @@ MATLAB_MEX=\
matlab/mex/astra_mex_direct_c.$(MEXSUFFIX)
ifeq ($(python),yes)
-ALL_OBJECTS+=src/PluginAlgorithm.lo
MATLAB_MEX+=matlab/mex/astra_mex_plugin_c.$(MEXSUFFIX)
endif
@@ -315,8 +315,10 @@ ifeq ($(cuda),yes)
ifeq ($(gen_static_libs),yes)
@$(NVCC) $(NVCCFLAGS) -c $(<) -o $*.o >/dev/null 2>&1
endif
- @# Generate a .d file, with target name $*.lo
- @$(NVCC) $(NVCCFLAGS) -M $(<) -MT $(*F).lo -odir $(*D) -o $(*D)/$(DEPDIR)/$(*F).d
+ @# Generate a .d file, and change the target name in it from .o to .lo
+ @$(NVCC) $(NVCCFLAGS) -M $(<) -odir $(*D) -o $(*D)/$(DEPDIR)/$(*F).d2
+ @sed '1s/\.o :/.lo :/' < $(*D)/$(DEPDIR)/$(*F).d2 > $(*D)/$(DEPDIR)/$(*F).d
+ @rm -f $(*D)/$(DEPDIR)/$(*F).d2
@# Generate empty targets for all dependencies listed in the .d file.
@# This mimics gcc's -MP option.
@for x in `cat $(*D)/$(DEPDIR)/$(*F).d`; do if test a$$x != a: -a a$$x != a\\; then echo -e "\n$$x:\n" >> $(*D)/$(DEPDIR)/$(*F).d; fi; done
diff --git a/include/astra/Utilities.h b/include/astra/Utilities.h
index 3ae0e6c..8d7c44d 100644
--- a/include/astra/Utilities.h
+++ b/include/astra/Utilities.h
@@ -50,40 +50,40 @@ public:
//< Parse string as int.
//< Throw exception on failure.
-int stringToInt(const std::string& s);
+_AstraExport int stringToInt(const std::string& s);
//< Parse string as float.
//< Throw exception on failure.
-float stringToFloat(const std::string& s);
+_AstraExport float stringToFloat(const std::string& s);
//< Parse string as double.
//< Throw exception on failure.
-double stringToDouble(const std::string& s);
+_AstraExport double stringToDouble(const std::string& s);
template<typename T>
-T stringTo(const std::string& s);
+_AstraExport T stringTo(const std::string& s);
//< Parse comma/semicolon-separated string as float vector.
//< Throw exception on failure.
-std::vector<float> stringToFloatVector(const std::string& s);
+_AstraExport std::vector<float> stringToFloatVector(const std::string& s);
//< Parse comma/semicolon-separated string as double vector.
//< Throw exception on failure.
-std::vector<double> stringToDoubleVector(const std::string& s);
+_AstraExport std::vector<double> stringToDoubleVector(const std::string& s);
template<typename T>
-std::vector<T> stringToVector(const std::string& s);
+_AstraExport std::vector<T> stringToVector(const std::string& s);
//< Generate string from float.
-std::string floatToString(float f);
+_AstraExport std::string floatToString(float f);
//< Generate string from double.
-std::string doubleToString(double f);
+_AstraExport std::string doubleToString(double f);
template<typename T>
-std::string toString(T f);
+_AstraExport std::string toString(T f);
}
diff --git a/python/astra/data3d.py b/python/astra/data3d.py
index e5ef6b0..f143659 100644
--- a/python/astra/data3d.py
+++ b/python/astra/data3d.py
@@ -89,7 +89,7 @@ def get_single(i):
:returns: :class:`numpy.ndarray` -- The object data.
"""
- return g.get_single(i)
+ return d.get_single(i)
def store(i,data):
"""Fill existing 3D object with data.
diff --git a/python/astra/functions.py b/python/astra/functions.py
index e38b5bc..3f4aa82 100644
--- a/python/astra/functions.py
+++ b/python/astra/functions.py
@@ -115,7 +115,7 @@ def add_noise_to_sino(sinogram_in, I0, seed=None):
sinogram_out = -max_sinogramRaw * np.log(sinogramCT_D)
if not isinstance(sinogram_in, np.ndarray):
- at.data2d.store(sinogram_in, sinogram_out)
+ data2d.store(sinogram_in, sinogram_out)
if not seed==None:
np.random.set_state(curstate)
diff --git a/python/astra/optomo.py b/python/astra/optomo.py
index 4a64150..dd10713 100644
--- a/python/astra/optomo.py
+++ b/python/astra/optomo.py
@@ -160,7 +160,7 @@ class OpTomo(scipy.sparse.linalg.LinearOperator):
return self._matvec(v)
return scipy.sparse.linalg.LinearOperator.__mul__(self, v)
- def reconstruct(self, method, s, iterations=1, extraOptions = {}):
+ def reconstruct(self, method, s, iterations=1, extraOptions = None):
"""Reconstruct an object.
:param method: Method to use for reconstruction.
@@ -172,6 +172,8 @@ class OpTomo(scipy.sparse.linalg.LinearOperator):
:param extraOptions: Extra options to use during reconstruction (i.e. for cfg['option']).
:type extraOptions: :class:`dict`
"""
+ if extraOptions is None:
+ extraOptions={}
s = self.__checkArray(s, self.sshape)
sid = self.data_mod.link('-sino',self.pg,s)
v = np.zeros(self.vshape,dtype=np.float32)
diff --git a/python/astra/utils.pyx b/python/astra/utils.pyx
index 52c2a8d..34d1902 100644
--- a/python/astra/utils.pyx
+++ b/python/astra/utils.pyx
@@ -32,7 +32,7 @@ import six
if six.PY3:
import builtins
else:
- import __builtin__
+ import __builtin__ as builtins
from libcpp.string cimport string
from libcpp.vector cimport vector
from libcpp.list cimport list
@@ -95,14 +95,14 @@ cdef void readDict(XMLNode root, _dc):
dc = convert_item(_dc)
for item in dc:
val = dc[item]
- if isinstance(val, __builtins__.list) or isinstance(val, tuple):
+ if isinstance(val, builtins.list) or isinstance(val, tuple):
val = np.array(val,dtype=np.float64)
if isinstance(val, np.ndarray):
if val.size == 0:
break
listbase = root.addChildNode(item)
contig_data = np.ascontiguousarray(val,dtype=np.float64)
- data = <double*>np.PyArray_DATA(contig_data)
+ data = <double*>np.PyArray_DATA(contig_data)
if val.ndim == 2:
listbase.setContent(data, val.shape[1], val.shape[0], False)
elif val.ndim == 1:
@@ -119,6 +119,8 @@ cdef void readDict(XMLNode root, _dc):
if item == six.b('type'):
root.addAttribute(< string > six.b('type'), <string> wrap_to_bytes(val))
else:
+ if isinstance(val, builtins.bool):
+ val = int(val)
itm = root.addChildNode(item, wrap_to_bytes(val))
cdef void readOptions(XMLNode node, dc):
@@ -131,7 +133,7 @@ cdef void readOptions(XMLNode node, dc):
val = dc[item]
if node.hasOption(item):
raise Exception('Duplicate Option: %s' % item)
- if isinstance(val, __builtins__.list) or isinstance(val, tuple):
+ if isinstance(val, builtins.list) or isinstance(val, tuple):
val = np.array(val,dtype=np.float64)
if isinstance(val, np.ndarray):
if val.size == 0:
@@ -147,6 +149,8 @@ cdef void readOptions(XMLNode node, dc):
else:
raise Exception("Only 1 or 2 dimensions are allowed")
else:
+ if isinstance(val, builtins.bool):
+ val = int(val)
node.addOption(item, wrap_to_bytes(val))
cdef configToDict(Config *cfg):
diff --git a/python/conda/build.sh b/python/conda/build.sh
index 814ea7e..13ae3f8 100644
--- a/python/conda/build.sh
+++ b/python/conda/build.sh
@@ -5,12 +5,4 @@ if [ $MAKEOPTS == '<UNDEFINED>' ]
then
MAKEOPTS=""
fi
-make $MAKEOPTS install-libraries
-make $MAKEOPTS python-root-install
-LIBPATH=lib
-if [ $ARCH == 64 ]
- then
- LIBPATH+=64
-fi
-cp -P $CUDA_ROOT/$LIBPATH/libcudart.so.* $PREFIX/lib
-cp -P $CUDA_ROOT/$LIBPATH/libcufft.so.* $PREFIX/lib
+make $MAKEOPTS python-root-install \ No newline at end of file
diff --git a/python/conda/libastra/build.sh b/python/conda/libastra/build.sh
new file mode 100644
index 0000000..e1d9700
--- /dev/null
+++ b/python/conda/libastra/build.sh
@@ -0,0 +1,15 @@
+cd build/linux
+./autogen.sh
+./configure --with-cuda=$CUDA_ROOT --prefix=$PREFIX
+if [ $MAKEOPTS == '<UNDEFINED>' ]
+ then
+ MAKEOPTS=""
+fi
+make $MAKEOPTS install-libraries
+LIBPATH=lib
+if [ $ARCH == 64 ]
+ then
+ LIBPATH+=64
+fi
+cp -P $CUDA_ROOT/$LIBPATH/libcudart.so.* $PREFIX/lib
+cp -P $CUDA_ROOT/$LIBPATH/libcufft.so.* $PREFIX/lib
diff --git a/python/conda/libastra/meta.yaml b/python/conda/libastra/meta.yaml
new file mode 100644
index 0000000..73fa0d7
--- /dev/null
+++ b/python/conda/libastra/meta.yaml
@@ -0,0 +1,22 @@
+package:
+ name: libastra
+ version: '1.8b'
+
+source:
+ git_url: https://github.com/astra-toolbox/astra-toolbox.git
+ #git_tag: v1.7.1 # Change to 1.8 after release
+
+build:
+ number: 0
+ script_env:
+ - CUDA_ROOT
+ - MAKEOPTS
+
+about:
+ home: http://www.astra-toolbox.com
+ license: GPLv3
+ summary: 'The ASTRA Toolbox is a Python toolbox of high-performance GPU primitives for 2D and 3D tomography.'
+
+# See
+# http://docs.continuum.io/conda/build.html for
+# more information about meta.yaml
diff --git a/python/conda/meta.yaml b/python/conda/meta.yaml
index 7e4679b..e6a7f52 100644
--- a/python/conda/meta.yaml
+++ b/python/conda/meta.yaml
@@ -1,10 +1,10 @@
package:
name: astra-toolbox
- version: '1.7.1'
+ version: '1.8b'
source:
git_url: https://github.com/astra-toolbox/astra-toolbox.git
- git_tag: v1.7.1
+ #git_tag: v1.7.1 # Change to 1.8 after release
build:
number: 0
@@ -29,10 +29,11 @@ requirements:
- numpy
- scipy
- six
+ - libastra ==1.8b
about:
- home: http://sourceforge.net/p/astra-toolbox/wiki/Home/
+ home: http://www.astra-toolbox.com
license: GPLv3
summary: 'The ASTRA Toolbox is a Python toolbox of high-performance GPU primitives for 2D and 3D tomography.'