summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/linux/Makefile.in3
-rw-r--r--build/linux/acinclude.m46
-rw-r--r--build/linux/configure.ac9
-rw-r--r--matlab/mex/astra_mex.cpp124
-rw-r--r--src/CompositeGeometryManager.cpp12
5 files changed, 22 insertions, 132 deletions
diff --git a/build/linux/Makefile.in b/build/linux/Makefile.in
index 8eb5ffe..01ef527 100644
--- a/build/linux/Makefile.in
+++ b/build/linux/Makefile.in
@@ -25,6 +25,7 @@ VPATH=../..
CPPFLAGS=@SAVED_CPPFLAGS@
CXXFLAGS=@SAVED_CXXFLAGS@
+NVCCFLAGS=@SAVED_NVCCFLAGS@
LDFLAGS=@SAVED_LDFLAGS@
LIBS=@SAVED_LIBS@
@@ -37,7 +38,7 @@ CPPFLAGS+=@CPPFLAGS_OS@
ifeq ($(cuda),yes)
CPPFLAGS += @CPPFLAGS_CUDA@ -DASTRA_CUDA
-NVCCFLAGS = @NVCCFLAGS@ @CPPFLAGS_CUDA@ -I../.. -I../../include -DASTRA_CUDA
+NVCCFLAGS += @NVCCFLAGS_EXTRA@ @CPPFLAGS_CUDA@ -I../.. -I../../include -DASTRA_CUDA
LDFLAGS += @LDFLAGS_CUDA@
LIBS += -lcudart -lcufft
NVCC = @NVCC@
diff --git a/build/linux/acinclude.m4 b/build/linux/acinclude.m4
index e4b6de7..d6866c3 100644
--- a/build/linux/acinclude.m4
+++ b/build/linux/acinclude.m4
@@ -93,13 +93,13 @@ int main() {
}
_ACEOF
$1="yes"
-ASTRA_RUN_STOREOUTPUT([$NVCC -c -o conftest.o conftest.cu $$2],conftest.nvcc.out) || {
+ASTRA_RUN_STOREOUTPUT([$NVCC -c -o conftest.o conftest.cu $NVCCFLAGS $$2],conftest.nvcc.out) || {
$1="no"
# Check if hack for gcc 4.4 helps
if grep -q __builtin_stdarg_start conftest.nvcc.out; then
AS_ECHO(["$as_me:${as_lineno-$LINENO}: Trying CUDA hack for gcc 4.4"]) >&AS_MESSAGE_LOG_FD
NVCC_OPT="-Xcompiler -D__builtin_stdarg_start=__builtin_va_start"
- ASTRA_RUN_LOGOUTPUT([$NVCC -c -o conftest.o conftest.cu $$2 $NVCC_OPT]) && {
+ ASTRA_RUN_LOGOUTPUT([$NVCC -c -o conftest.o conftest.cu $NVCCFLAGS $$2 $NVCC_OPT]) && {
$1="yes"
$2="$$2 $NVCC_OPT"
}
@@ -133,7 +133,7 @@ IFS=,
for arch in $1; do
IFS=$astra_save_IFS
NVCC_opt="-gencode=arch=compute_$arch,code=sm_$arch"
- $NVCC -c -o conftest.o conftest.cu $$2 $NVCC_opt >conftest.nvcc.out 2>&1 && {
+ $NVCC -c -o conftest.o conftest.cu $NVCCFLAGS $$2 $NVCC_opt >conftest.nvcc.out 2>&1 && {
NVCC_lastarch=$arch
NVCC_extra="$NVCC_extra $NVCC_opt"
NVCC_list="${NVCC_list:+$NVCC_list, }$arch"
diff --git a/build/linux/configure.ac b/build/linux/configure.ac
index 9b6f7ab..684a4c5 100644
--- a/build/linux/configure.ac
+++ b/build/linux/configure.ac
@@ -30,6 +30,7 @@ LT_INIT([disable-static])
SAVED_CPPFLAGS="$CPPFLAGS"
SAVED_CXXFLAGS="$CXXFLAGS"
+SAVED_NVCCFLAGS="$NVCCFLAGS"
SAVED_LDFLAGS="$LDFLAGS"
SAVED_LIBS="$LIBS"
@@ -123,10 +124,9 @@ if test x"$NVCC" != xno; then
AC_SUBST(NVCC)
fi
-NVCCFLAGS=""
if test x"$HAVECUDA" = xyes; then
AC_MSG_CHECKING([if nvcc works])
- ASTRA_CHECK_NVCC(HAVECUDA,NVCCFLAGS)
+ ASTRA_CHECK_NVCC(HAVECUDA,NVCCFLAGS_EXTRA)
AC_MSG_RESULT($HAVECUDA)
fi
@@ -137,7 +137,7 @@ if test x"$HAVECUDA" = xyes; then
if test x"$with_cuda_compute" = x; then
with_cuda_compute="10,12,20,30,35,50"
fi
- ASTRA_FIND_NVCC_ARCHS([$with_cuda_compute],NVCCFLAGS,NVCCARCHS)
+ ASTRA_FIND_NVCC_ARCHS([$with_cuda_compute],NVCCFLAGS_EXTRA,NVCCARCHS)
AC_MSG_RESULT([$NVCCARCHS])
fi
@@ -145,7 +145,7 @@ fi
AC_SUBST(HAVECUDA)
AC_SUBST(LDFLAGS_CUDA)
AC_SUBST(CPPFLAGS_CUDA)
-AC_SUBST(NVCCFLAGS)
+AC_SUBST(NVCCFLAGS_EXTRA)
# mex, matlab
@@ -248,6 +248,7 @@ AC_SUBST(CPPFLAGS_OS)
AC_SUBST(SAVED_CPPFLAGS)
AC_SUBST(SAVED_CXXFLAGS)
+AC_SUBST(SAVED_NVCCFLAGS)
AC_SUBST(SAVED_LDFLAGS)
AC_SUBST(SAVED_LIBS)
AC_CONFIG_FILES([Makefile])
diff --git a/matlab/mex/astra_mex.cpp b/matlab/mex/astra_mex.cpp
deleted file mode 100644
index 4bf42dd..0000000
--- a/matlab/mex/astra_mex.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
------------------------------------------------------------------------
-Copyright: 2010-2015, iMinds-Vision Lab, University of Antwerp
- 2014-2015, 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 <http://www.gnu.org/licenses/>.
-
------------------------------------------------------------------------
-$Id$
-*/
-
-#include <mex.h>
-#include "mexHelpFunctions.h"
-#include "mexInitFunctions.h"
-
-#include "astra/Globals.h"
-
-using namespace std;
-using namespace astra;
-
-
-//-----------------------------------------------------------------------------------------
-/** astra_mex('credits');
- *
- * Print Credits
- */
-void astra_mex_credits(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
-{
- cout << "All Scale Tomographic Reconstruction Antwerp Toolbox (ASTRA-Toolbox) was developed at the University of Antwerp by" << endl;
- cout << " * Joost Batenburg, PhD" << endl;
- cout << " * Gert Merckx" << endl;
- cout << " * Willem Jan Palenstijn" << endl;
- cout << " * Tom Roelandts" << endl;
- cout << " * Prof. Dr. Jan Sijbers" << endl;
- cout << " * Wim van Aarle" << endl;
- cout << " * Sander van der Maar" << endl;
- cout << " * Gert Van Gompel, PhD" << endl;
-}
-
-//-----------------------------------------------------------------------------------------
-/** use_cuda = astra_mex('use_cuda');
- *
- * Is CUDA enabled?
- */
-void astra_mex_use_cuda(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
-{
- if (1 <= nlhs) {
- plhs[0] = mxCreateDoubleScalar(astra::cudaEnabled() ? 1 : 0);
- }
-}
-
-//-----------------------------------------------------------------------------------------
-/** version_number = astra_mex('version');
- *
- * Fetch the version number of the toolbox.
- */
-void astra_mex_version(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
-{
- if (1 <= nlhs) {
- plhs[0] = mxCreateDoubleScalar(astra::getVersion());
- } else {
- cout << "astra toolbox version " << astra::getVersionString() << endl;
- }
-}
-
-//-----------------------------------------------------------------------------------------
-
-static void printHelp()
-{
- mexPrintf("Please specify a mode of operation.\n");
- mexPrintf(" Valid modes: version, use_cuda, credits\n");
-}
-
-//-----------------------------------------------------------------------------------------
-/**
- * ... = astra_mex(type,...);
- */
-void mexFunction(int nlhs, mxArray* plhs[],
- int nrhs, const mxArray* prhs[])
-{
-
- // INPUT0: Mode
- string sMode = "";
- if (1 <= nrhs) {
- sMode = mex_util_get_string(prhs[0]);
- } else {
- printHelp();
- return;
- }
-
- initASTRAMex();
-
- // SWITCH (MODE)
- if (sMode == std::string("version")) {
- astra_mex_version(nlhs, plhs, nrhs, prhs);
- } else if (sMode == std::string("use_cuda")) {
- astra_mex_use_cuda(nlhs, plhs, nrhs, prhs);
- } else if (sMode == std::string("credits")) {
- astra_mex_credits(nlhs, plhs, nrhs, prhs);
- } else {
- printHelp();
- }
-
- return;
-}
-
-
diff --git a/src/CompositeGeometryManager.cpp b/src/CompositeGeometryManager.cpp
index 9be4797..41f6319 100644
--- a/src/CompositeGeometryManager.cpp
+++ b/src/CompositeGeometryManager.cpp
@@ -247,6 +247,18 @@ CCompositeGeometryManager::CPart* CCompositeGeometryManager::CVolumePart::reduce
//ASTRA_DEBUG("coord extent: %f - %f", zmin, zmax);
+ // Clip both zmin and zmax to get rid of extreme (or infinite) values
+ // NB: When individual pz values are +/-Inf, the sign is determined
+ // by ray direction and on which side of the face the ray passes.
+ if (zmin < pGeom->getWindowMinZ() - 2*pixz)
+ zmin = pGeom->getWindowMinZ() - 2*pixz;
+ if (zmin > pGeom->getWindowMaxZ() + 2*pixz)
+ zmin = pGeom->getWindowMaxZ() + 2*pixz;
+ if (zmax < pGeom->getWindowMinZ() - 2*pixz)
+ zmax = pGeom->getWindowMinZ() - 2*pixz;
+ if (zmax > pGeom->getWindowMaxZ() + 2*pixz)
+ zmax = pGeom->getWindowMaxZ() + 2*pixz;
+
zmin = (zmin - pixz - pGeom->getWindowMinZ()) / pixz;
zmax = (zmax + pixz - pGeom->getWindowMinZ()) / pixz;