summaryrefslogtreecommitdiffstats
path: root/matlab
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2016-07-28 17:05:24 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2016-07-28 17:05:24 +0200
commitb2611a03577c285ddf48edab0d05dafa09ab362c (patch)
treec1d2f1b5166ba23f55e68e8faf0832f7c540f787 /matlab
parent1ff4a270a7df1edb54dd91fe653d6a936b959b3a (diff)
parent53249b3ad63f0d08b9862a75602acf263d230d77 (diff)
downloadastra-b2611a03577c285ddf48edab0d05dafa09ab362c.tar.gz
astra-b2611a03577c285ddf48edab0d05dafa09ab362c.tar.bz2
astra-b2611a03577c285ddf48edab0d05dafa09ab362c.tar.xz
astra-b2611a03577c285ddf48edab0d05dafa09ab362c.zip
Merge branch 'master' into parvec
Diffstat (limited to 'matlab')
-rw-r--r--matlab/mex/astra_mex.cpp124
-rw-r--r--matlab/mex/astra_mex_c.cpp117
-rw-r--r--matlab/mex/astra_mex_data2d_c.cpp4
-rw-r--r--matlab/mex/astra_mex_direct_c.cpp348
-rw-r--r--matlab/mex/astra_mex_direct_vc09.vcproj628
-rw-r--r--matlab/mex/astra_mex_direct_vc11.vcxproj310
-rw-r--r--matlab/mex/astra_mex_log_c.cpp8
-rw-r--r--matlab/mex/astra_mex_matrix_c.cpp2
-rw-r--r--matlab/mex/astra_mex_plugin_c.cpp200
-rw-r--r--matlab/mex/astra_mex_projector3d_c.cpp8
-rw-r--r--matlab/mex/astra_mex_projector_c.cpp9
-rw-r--r--matlab/mex/mexHelpFunctions.cpp14
-rw-r--r--matlab/mex/mexHelpFunctions.h1
-rw-r--r--matlab/mex/mexInitFunctions.cpp13
-rw-r--r--matlab/tools/astra_create_fbp_reconstruction.m1
-rw-r--r--matlab/tools/astra_create_projector.m9
-rw-r--r--matlab/tools/astra_create_reconstruction_cuda.m2
-rw-r--r--matlab/tools/astra_create_vol_geom.m15
-rw-r--r--matlab/tools/astra_mex_direct.m24
-rw-r--r--matlab/tools/astra_mex_plugin.m24
-rw-r--r--matlab/tools/opTomo.m79
21 files changed, 1728 insertions, 212 deletions
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/matlab/mex/astra_mex_c.cpp b/matlab/mex/astra_mex_c.cpp
index 4a331f5..f499528 100644
--- a/matlab/mex/astra_mex_c.cpp
+++ b/matlab/mex/astra_mex_c.cpp
@@ -36,8 +36,13 @@ $Id$
#include "mexInitFunctions.h"
#include "astra/Globals.h"
+#include "astra/AstraObjectManager.h"
+#ifdef ASTRA_CUDA
#include "../cuda/2d/darthelper.h"
+#include "astra/CompositeGeometryManager.h"
+#endif
+
using namespace std;
using namespace astra;
@@ -50,16 +55,19 @@ using namespace astra;
*/
void astra_mex_credits(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
{
- mexPrintf("All Scale Tomographic Reconstruction Antwerp Toolbox (ASTRA-Toolbox) was developed at the University of Antwerp by\n");
+ mexPrintf("The ASTRA Toolbox has been developed at the University of Antwerp and CWI, Amsterdam by\n");
mexPrintf(" * Prof. dr. Joost Batenburg\n");
- mexPrintf(" * Andrei Dabravolski\n");
- mexPrintf(" * Gert Merckx\n");
- mexPrintf(" * Willem Jan Palenstijn\n");
- mexPrintf(" * Tom Roelandts\n");
mexPrintf(" * Prof. dr. Jan Sijbers\n");
- mexPrintf(" * dr. Wim van Aarle\n");
- mexPrintf(" * Sander van der Maar\n");
- mexPrintf(" * dr. Gert Van Gompel\n");
+ mexPrintf(" * Dr. Jeroen Bedorf\n");
+ mexPrintf(" * Dr. Folkert Bleichrodt\n");
+ mexPrintf(" * Dr. Andrei Dabravolski\n");
+ mexPrintf(" * Dr. Willem Jan Palenstijn\n");
+ mexPrintf(" * Dr. Tom Roelandts\n");
+ mexPrintf(" * Dr. Wim van Aarle\n");
+ mexPrintf(" * Dr. Gert Van Gompel\n");
+ mexPrintf(" * Sander van der Maar, MSc.\n");
+ mexPrintf(" * Gert Merckx, MSc.\n");
+ mexPrintf(" * Daan Pelt, MSc.\n");
}
//-----------------------------------------------------------------------------------------
@@ -80,12 +88,46 @@ void astra_mex_use_cuda(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs
* Set active GPU
*/
void astra_mex_set_gpu_index(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
-{
+{
#ifdef ASTRA_CUDA
- if (nrhs >= 2) {
- bool ret = astraCUDA::setGPUIndex((int)mxGetScalar(prhs[1]));
- if (!ret)
- mexPrintf("Failed to set GPU %d\n", (int)mxGetScalar(prhs[1]));
+ bool usage = false;
+ if (nrhs != 2 && nrhs != 4) {
+ usage = true;
+ }
+
+ astra::SGPUParams params;
+ params.memory = 0;
+
+ if (!usage && nrhs >= 4) {
+ std::string s = mexToString(prhs[2]);
+ if (s != "memory") {
+ usage = true;
+ } else {
+ params.memory = (size_t)mxGetScalar(prhs[3]);
+ }
+ }
+
+ if (!usage && nrhs >= 2) {
+ int n = mxGetN(prhs[1]) * mxGetM(prhs[1]);
+ params.GPUIndices.resize(n);
+ double* pdMatlabData = mxGetPr(prhs[1]);
+ for (int i = 0; i < n; ++i)
+ params.GPUIndices[i] = (int)pdMatlabData[i];
+
+
+ astra::CCompositeGeometryManager::setGlobalGPUParams(params);
+
+
+ // Set first GPU
+ if (n >= 1) {
+ bool ret = astraCUDA::setGPUIndex((int)pdMatlabData[0]);
+ if (!ret)
+ mexPrintf("Failed to set GPU %d\n", (int)pdMatlabData[0]);
+ }
+ }
+
+ if (usage) {
+ mexPrintf("Usage: astra_mex('set_gpu_index', index/indices [, 'memory', memory])");
}
#endif
}
@@ -100,16 +142,57 @@ void astra_mex_version(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[
if (1 <= nlhs) {
plhs[0] = mxCreateDoubleScalar(astra::getVersion());
} else {
- mexPrintf("astra toolbox version %s\n", astra::getVersionString());
+ mexPrintf("ASTRA Toolbox version %s\n", astra::getVersionString());
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+
+void astra_mex_info(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
+{
+ if (nrhs < 2) {
+ mexErrMsgTxt("Usage: astra_mex('info', index/indices);\n");
+ return;
+ }
+
+ for (int i = 1; i < nrhs; i++) {
+ int iDataID = (int)(mxGetScalar(prhs[i]));
+ CAstraObjectManagerBase *ptr;
+ ptr = CAstraIndexManager::getSingleton().get(iDataID);
+ if (ptr) {
+ mexPrintf("%s\t%s\n", ptr->getType().c_str(), ptr->getInfo(iDataID).c_str());
+ }
}
+
}
//-----------------------------------------------------------------------------------------
+void astra_mex_delete(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
+{
+ if (nrhs < 2) {
+ mexErrMsgTxt("Usage: astra_mex('delete', index/indices);\n");
+ return;
+ }
+
+ for (int i = 1; i < nrhs; i++) {
+ int iDataID = (int)(mxGetScalar(prhs[i]));
+ CAstraObjectManagerBase *ptr;
+ ptr = CAstraIndexManager::getSingleton().get(iDataID);
+ if (ptr)
+ ptr->remove(iDataID);
+ }
+
+}
+
+
+
+//-----------------------------------------------------------------------------------------
+
static void printHelp()
{
mexPrintf("Please specify a mode of operation.\n");
- mexPrintf(" Valid modes: version, use_cuda, credits\n");
+ mexPrintf(" Valid modes: version, use_cuda, credits, set_gpu_index, info, delete\n");
}
//-----------------------------------------------------------------------------------------
@@ -140,6 +223,10 @@ void mexFunction(int nlhs, mxArray* plhs[],
astra_mex_credits(nlhs, plhs, nrhs, prhs);
} else if (sMode == std::string("set_gpu_index")) {
astra_mex_set_gpu_index(nlhs, plhs, nrhs, prhs);
+ } else if (sMode == std::string("info")) {
+ astra_mex_info(nlhs, plhs, nrhs, prhs);
+ } else if (sMode == std::string("delete")) {
+ astra_mex_delete(nlhs, plhs, nrhs, prhs);
} else {
printHelp();
}
diff --git a/matlab/mex/astra_mex_data2d_c.cpp b/matlab/mex/astra_mex_data2d_c.cpp
index 6863b7a..6371c9e 100644
--- a/matlab/mex/astra_mex_data2d_c.cpp
+++ b/matlab/mex/astra_mex_data2d_c.cpp
@@ -225,7 +225,7 @@ void astra_mex_data2d_create(int& nlhs, mxArray* plhs[], int& nrhs, const mxArra
// logical data
if (mxIsLogical(prhs[3])) {
- bool* pbMatlabData = mxGetLogicals(prhs[3]);
+ mxLogical* pbMatlabData = mxGetLogicals(prhs[3]);
int i = 0;
int col, row;
for (col = 0; col < dims[1]; ++col) {
@@ -325,7 +325,7 @@ void astra_mex_data2d_store(int nlhs, mxArray* plhs[], int nrhs, const mxArray*
// logical data
if (mxIsLogical(prhs[2])) {
- bool* pbMatlabData = mxGetLogicals(prhs[2]);
+ mxLogical* pbMatlabData = mxGetLogicals(prhs[2]);
int i = 0;
int col, row;
for (col = 0; col < dims[1]; ++col) {
diff --git a/matlab/mex/astra_mex_direct_c.cpp b/matlab/mex/astra_mex_direct_c.cpp
new file mode 100644
index 0000000..38b3f59
--- /dev/null
+++ b/matlab/mex/astra_mex_direct_c.cpp
@@ -0,0 +1,348 @@
+/*
+-----------------------------------------------------------------------
+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$
+*/
+
+/** \file astra_mex_direct_c.cpp
+ *
+ * \brief Utility functions for low-overhead FP and BP calls.
+ */
+#include <mex.h>
+#include "mexHelpFunctions.h"
+#include "mexCopyDataHelpFunctions.h"
+#include "mexDataManagerHelpFunctions.h"
+
+#include <list>
+
+#include "astra/Globals.h"
+
+#include "astra/AstraObjectManager.h"
+
+#include "astra/Float32ProjectionData2D.h"
+#include "astra/Float32VolumeData2D.h"
+#include "astra/CudaProjector3D.h"
+#include "astra/Projector3D.h"
+#include "astra/Float32ProjectionData3DMemory.h"
+#include "astra/Float32VolumeData3DMemory.h"
+
+#include "astra/CudaForwardProjectionAlgorithm3D.h"
+
+#include "astra/CudaBackProjectionAlgorithm3D.h"
+
+using namespace std;
+using namespace astra;
+
+#define USE_MATLAB_UNDOCUMENTED
+
+
+class CFloat32CustomMemory_simple : public astra::CFloat32CustomMemory {
+public:
+ CFloat32CustomMemory_simple(float *ptr) { m_fPtr = ptr; }
+ ~CFloat32CustomMemory_simple() { }
+};
+
+#ifdef ASTRA_CUDA
+
+//-----------------------------------------------------------------------------------------
+/**
+ * projection = astra_mex_direct_c('FP3D', projector_id, volume);
+ * Both 'projection' and 'volume' are Matlab arrays.
+ */
+void astra_mex_direct_fp3d(int& nlhs, mxArray* plhs[], int& nrhs, const mxArray* prhs[])
+{
+ // TODO: Add an optional way of specifying extra options
+
+ if (nrhs < 3) {
+ mexErrMsgTxt("Not enough arguments. Syntax: astra_mex_direct_c('FP3D', projector_id, data)");
+ return;
+ }
+
+ int iPid = (int)(mxGetScalar(prhs[1]));
+ astra::CProjector3D* pProjector;
+ pProjector = astra::CProjector3DManager::getSingleton().get(iPid);
+ if (!pProjector) {
+ mexErrMsgTxt("Projector not found.");
+ return;
+ }
+ if (!pProjector->isInitialized()) {
+ mexErrMsgTxt("Projector not initialized.");
+ return;
+ }
+ bool isCuda = false;
+ if (dynamic_cast<CCudaProjector3D*>(pProjector))
+ isCuda = true;
+ if (!isCuda) {
+ mexErrMsgTxt("Only CUDA projectors are currently supported.");
+ return;
+ }
+
+ astra::CVolumeGeometry3D* pVolGeom = pProjector->getVolumeGeometry();
+ astra::CProjectionGeometry3D* pProjGeom = pProjector->getProjectionGeometry();
+
+ const mxArray* const data = prhs[2];
+ if (!checkDataType(data)) {
+ mexErrMsgTxt("Data must be single or double.");
+ return;
+ }
+
+ if (!checkDataSize(data, pVolGeom)) {
+ mexErrMsgTxt("The dimensions of the data do not match those specified in the geometry.");
+ return;
+ }
+
+
+ // Allocate input data
+ astra::CFloat32VolumeData3DMemory* pInput;
+ if (mxIsSingle(data)) {
+ astra::CFloat32CustomMemory* m = new CFloat32CustomMemory_simple((float *)mxGetData(data));
+ pInput = new astra::CFloat32VolumeData3DMemory(pVolGeom, m);
+ } else {
+ pInput = new astra::CFloat32VolumeData3DMemory(pVolGeom);
+ copyMexToCFloat32Array(data, pInput->getData(), pInput->getSize());
+ }
+
+
+ // Allocate output data
+ // If the input is single, we also allocate single output.
+ // Otherwise, double.
+ astra::CFloat32ProjectionData3DMemory* pOutput;
+ mxArray *pOutputMx;
+ if (mxIsSingle(data)) {
+ mwSize dims[3];
+ dims[0] = pProjGeom->getDetectorColCount();
+ dims[1] = pProjGeom->getProjectionCount();
+ dims[2] = pProjGeom->getDetectorRowCount();
+
+ // Allocate uninitialized mxArray of size dims.
+ // (It will be zeroed by CudaForwardProjectionAlgorithm3D)
+ const mwSize zero_dims[2] = {0, 0};
+ pOutputMx = mxCreateNumericArray(2, zero_dims, mxSINGLE_CLASS, mxREAL);
+ mxSetDimensions(pOutputMx, dims, 3);
+ const mwSize num_elems = mxGetNumberOfElements(pOutputMx);
+ const mwSize elem_size = mxGetElementSize(pOutputMx);
+ mxSetData(pOutputMx, mxMalloc(elem_size * num_elems));
+
+ astra::CFloat32CustomMemory* m = new CFloat32CustomMemory_simple((float *)mxGetData(pOutputMx));
+ pOutput = new astra::CFloat32ProjectionData3DMemory(pProjGeom, m);
+ } else {
+ pOutput = new astra::CFloat32ProjectionData3DMemory(pProjGeom);
+ }
+
+ // Perform FP
+
+ astra::CCudaForwardProjectionAlgorithm3D* pAlg;
+ pAlg = new astra::CCudaForwardProjectionAlgorithm3D();
+ pAlg->initialize(pProjector, pOutput, pInput);
+
+ if (!pAlg->isInitialized()) {
+ mexErrMsgTxt("Error initializing algorithm.");
+ // TODO: Delete pOutputMx?
+ delete pAlg;
+ delete pInput;
+ delete pOutput;
+ return;
+ }
+
+ pAlg->run();
+
+ delete pAlg;
+
+
+ if (mxIsSingle(data)) {
+
+ } else {
+ pOutputMx = createEquivMexArray<mxDOUBLE_CLASS>(pOutput);
+ copyCFloat32ArrayToMex(pOutput->getData(), pOutputMx);
+ }
+ plhs[0] = pOutputMx;
+
+ delete pOutput;
+ delete pInput;
+}
+//-----------------------------------------------------------------------------------------
+/**
+ * projection = astra_mex_direct_c('BP3D', projector_id, volume);
+ * Both 'projection' and 'volume' are Matlab arrays.
+ */
+void astra_mex_direct_bp3d(int& nlhs, mxArray* plhs[], int& nrhs, const mxArray* prhs[])
+{
+ // TODO: Add an optional way of specifying extra options
+
+ if (nrhs < 3) {
+ mexErrMsgTxt("Not enough arguments. Syntax: astra_mex_direct_c('BP3D', projector_id, data)");
+ return;
+ }
+
+ int iPid = (int)(mxGetScalar(prhs[1]));
+ astra::CProjector3D* pProjector;
+ pProjector = astra::CProjector3DManager::getSingleton().get(iPid);
+ if (!pProjector) {
+ mexErrMsgTxt("Projector not found.");
+ return;
+ }
+ if (!pProjector->isInitialized()) {
+ mexErrMsgTxt("Projector not initialized.");
+ return;
+ }
+ bool isCuda = false;
+ if (dynamic_cast<CCudaProjector3D*>(pProjector))
+ isCuda = true;
+ if (!isCuda) {
+ mexErrMsgTxt("Only CUDA projectors are currently supported.");
+ return;
+ }
+
+ astra::CVolumeGeometry3D* pVolGeom = pProjector->getVolumeGeometry();
+ astra::CProjectionGeometry3D* pProjGeom = pProjector->getProjectionGeometry();
+
+ const mxArray* const data = prhs[2];
+ if (!checkDataType(data)) {
+ mexErrMsgTxt("Data must be single or double.");
+ return;
+ }
+
+ if (!checkDataSize(data, pProjGeom)) {
+ mexErrMsgTxt("The dimensions of the data do not match those specified in the geometry.");
+ return;
+ }
+
+
+ // Allocate input data
+ astra::CFloat32ProjectionData3DMemory* pInput;
+ if (mxIsSingle(data)) {
+ astra::CFloat32CustomMemory* m = new CFloat32CustomMemory_simple((float *)mxGetData(data));
+ pInput = new astra::CFloat32ProjectionData3DMemory(pProjGeom, m);
+ } else {
+ pInput = new astra::CFloat32ProjectionData3DMemory(pProjGeom);
+ copyMexToCFloat32Array(data, pInput->getData(), pInput->getSize());
+ }
+
+
+ // Allocate output data
+ // If the input is single, we also allocate single output.
+ // Otherwise, double.
+ astra::CFloat32VolumeData3DMemory* pOutput;
+ mxArray *pOutputMx;
+ if (mxIsSingle(data)) {
+ mwSize dims[3];
+ dims[0] = pVolGeom->getGridColCount();
+ dims[1] = pVolGeom->getGridRowCount();
+ dims[2] = pVolGeom->getGridSliceCount();
+
+ // Allocate uninitialized mxArray of size dims.
+ // (It will be zeroed by CudaBackProjectionAlgorithm3D)
+ const mwSize zero_dims[2] = {0, 0};
+ pOutputMx = mxCreateNumericArray(2, zero_dims, mxSINGLE_CLASS, mxREAL);
+ mxSetDimensions(pOutputMx, dims, 3);
+ const mwSize num_elems = mxGetNumberOfElements(pOutputMx);
+ const mwSize elem_size = mxGetElementSize(pOutputMx);
+ mxSetData(pOutputMx, mxMalloc(elem_size * num_elems));
+
+ astra::CFloat32CustomMemory* m = new CFloat32CustomMemory_simple((float *)mxGetData(pOutputMx));
+ pOutput = new astra::CFloat32VolumeData3DMemory(pVolGeom, m);
+ } else {
+ pOutput = new astra::CFloat32VolumeData3DMemory(pVolGeom);
+ }
+
+ // Perform BP
+
+ astra::CCudaBackProjectionAlgorithm3D* pAlg;
+ pAlg = new astra::CCudaBackProjectionAlgorithm3D();
+ pAlg->initialize(pProjector, pInput, pOutput);
+
+ if (!pAlg->isInitialized()) {
+ mexErrMsgTxt("Error initializing algorithm.");
+ // TODO: Delete pOutputMx?
+ delete pAlg;
+ delete pInput;
+ delete pOutput;
+ return;
+ }
+
+ pAlg->run();
+
+ delete pAlg;
+
+
+ if (mxIsSingle(data)) {
+
+ } else {
+ pOutputMx = createEquivMexArray<mxDOUBLE_CLASS>(pOutput);
+ copyCFloat32ArrayToMex(pOutput->getData(), pOutputMx);
+ }
+ plhs[0] = pOutputMx;
+
+ delete pOutput;
+ delete pInput;
+}
+
+#endif
+
+//-----------------------------------------------------------------------------------------
+
+static void printHelp()
+{
+ mexPrintf("Please specify a mode of operation.\n");
+ mexPrintf("Valid modes: FP3D, BP3D\n");
+}
+
+
+//-----------------------------------------------------------------------------------------
+/**
+ * ... = astra_mex_direct_c(mode,...);
+ */
+void mexFunction(int nlhs, mxArray* plhs[],
+ int nrhs, const mxArray* prhs[])
+{
+
+ // INPUT: Mode
+ string sMode;
+ if (1 <= nrhs) {
+ sMode = mexToString(prhs[0]);
+ } else {
+ printHelp();
+ return;
+ }
+
+#ifndef ASTRA_CUDA
+ mexErrMsgTxt("Only CUDA projectors are currently supported.");
+ return;
+#else
+
+ // 3D data
+ if (sMode == "FP3D") {
+ astra_mex_direct_fp3d(nlhs, plhs, nrhs, prhs);
+ } else if (sMode == "BP3D") {
+ astra_mex_direct_bp3d(nlhs, plhs, nrhs, prhs);
+ } else {
+ printHelp();
+ }
+#endif
+
+ return;
+}
+
+
diff --git a/matlab/mex/astra_mex_direct_vc09.vcproj b/matlab/mex/astra_mex_direct_vc09.vcproj
new file mode 100644
index 0000000..5d27c65
--- /dev/null
+++ b/matlab/mex/astra_mex_direct_vc09.vcproj
@@ -0,0 +1,628 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="astra_mex_direct"
+ ProjectGUID="{85FE09A6-FA49-4314-A2B1-59D77C7442A8}"
+ RootNamespace="astraMatlab"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ <Platform
+ Name="x64"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug_CUDA|Win32"
+ OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\$(ProjectName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(MATLAB_ROOT)\extern\include\;&quot;$(CUDA_INC_PATH)&quot;;..\..\lib\include;..\..\include"
+ PreprocessorDefinitions="ASTRA_CUDA;__SSE2__"
+ Optimization="0"
+ RuntimeLibrary="3"
+ EnableEnhancedInstructionSet="2"
+ OpenMP="true"
+ AdditionalOptions="/MP"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="AstraCuda32D.lib libmex.lib libmx.lib libut.lib"
+ OutputFile="$(OutDir)\$(ProjectName)_c.mexw32"
+ AdditionalLibraryDirectories="..\..\bin\win32;$(MATLAB_ROOT)\extern\lib\win32\microsoft;..\..\lib\win32"
+ ModuleDefinitionFile="mex.def"
+ GenerateDebugInformation="true"
+ TargetMachine="1"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_CUDA|x64"
+ OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\$(ProjectName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(MATLAB_ROOT)\extern\include\;&quot;$(CUDA_INC_PATH)&quot;;..\..\lib\include;..\..\include"
+ PreprocessorDefinitions="ASTRA_CUDA;__SSE2__"
+ Optimization="0"
+ RuntimeLibrary="3"
+ OpenMP="true"
+ AdditionalOptions="/MP"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="AstraCuda64D.lib libmex.lib libmx.lib libut.lib"
+ OutputFile="$(OutDir)\$(ProjectName)_c.mexw64"
+ AdditionalLibraryDirectories="..\..\bin\x64;$(MATLAB_ROOT)\extern\lib\win64\microsoft;..\..\lib\x64"
+ ModuleDefinitionFile="mex.def"
+ GenerateDebugInformation="true"
+ TargetMachine="17"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\$(ProjectName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(MATLAB_ROOT)\extern\include\;..\..\lib\include;..\..\include"
+ PreprocessorDefinitions="__SSE2__"
+ Optimization="0"
+ RuntimeLibrary="3"
+ EnableEnhancedInstructionSet="2"
+ OpenMP="true"
+ AdditionalOptions="/MP"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Astra32D.lib libmex.lib libmx.lib libut.lib"
+ OutputFile="$(OutDir)\$(ProjectName)_c.mexw32"
+ AdditionalLibraryDirectories="..\..\bin\win32;$(MATLAB_ROOT)\extern\lib\win32\microsoft;..\..\lib\win32"
+ ModuleDefinitionFile="mex.def"
+ GenerateDebugInformation="true"
+ TargetMachine="1"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug|x64"
+ OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\$(ProjectName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(MATLAB_ROOT)\extern\include\;..\..\lib\include;..\..\include"
+ PreprocessorDefinitions="__SSE2__"
+ Optimization="0"
+ RuntimeLibrary="3"
+ OpenMP="true"
+ AdditionalOptions="/MP"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Astra64D.lib libmex.lib libmx.lib libut.lib"
+ OutputFile="$(OutDir)\$(ProjectName)_c.mexw64"
+ AdditionalLibraryDirectories="..\..\bin\x64;$(MATLAB_ROOT)\extern\lib\win64\microsoft;..\..\lib\x64"
+ ModuleDefinitionFile="mex.def"
+ GenerateDebugInformation="true"
+ TargetMachine="17"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_CUDA|Win32"
+ OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\$(ProjectName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(MATLAB_ROOT)\extern\include\;&quot;$(CUDA_INC_PATH)&quot;;..\..\lib\include;..\..\include"
+ PreprocessorDefinitions="ASTRA_CUDA;__SSE2__"
+ Optimization="2"
+ RuntimeLibrary="2"
+ EnableEnhancedInstructionSet="2"
+ OpenMP="true"
+ AdditionalOptions="/MP"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="AstraCuda32.lib libmex.lib libmx.lib libut.lib"
+ OutputFile="$(OutDir)\$(ProjectName)_c.mexw32"
+ AdditionalLibraryDirectories="..\..\bin\win32;$(MATLAB_ROOT)\extern\lib\win32\microsoft;..\..\lib\win32"
+ ModuleDefinitionFile="mex.def"
+ GenerateDebugInformation="false"
+ TargetMachine="1"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release_CUDA|x64"
+ OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\$(ProjectName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(MATLAB_ROOT)\extern\include\;&quot;$(CUDA_INC_PATH)&quot;;..\..\lib\include;..\..\include"
+ PreprocessorDefinitions="ASTRA_CUDA;__SSE2__"
+ Optimization="2"
+ RuntimeLibrary="2"
+ OpenMP="true"
+ AdditionalOptions="/MP"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="AstraCuda64.lib libmex.lib libmx.lib libut.lib"
+ OutputFile="$(OutDir)\$(ProjectName)_c.mexw64"
+ AdditionalLibraryDirectories="..\..\bin\x64;$(MATLAB_ROOT)\extern\lib\win64\microsoft;..\..\lib\x64"
+ ModuleDefinitionFile="mex.def"
+ GenerateDebugInformation="false"
+ TargetMachine="17"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\$(ProjectName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(MATLAB_ROOT)\extern\include\;..\..\lib\include;..\..\include"
+ PreprocessorDefinitions="__SSE2__"
+ Optimization="2"
+ RuntimeLibrary="2"
+ EnableEnhancedInstructionSet="2"
+ OpenMP="true"
+ AdditionalOptions="/MP"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Astra32.lib libmex.lib libmx.lib libut.lib"
+ OutputFile="$(OutDir)\$(ProjectName)_c.mexw32"
+ AdditionalLibraryDirectories="..\..\bin\win32;$(MATLAB_ROOT)\extern\lib\win32\microsoft;..\..\lib\win32"
+ ModuleDefinitionFile="mex.def"
+ GenerateDebugInformation="false"
+ TargetMachine="1"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|x64"
+ OutputDirectory="$(SolutionDir)bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="$(OutDir)\obj\$(ProjectName)"
+ ConfigurationType="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(MATLAB_ROOT)\extern\include\;..\..\lib\include;..\..\include"
+ PreprocessorDefinitions="__SSE2__"
+ Optimization="2"
+ RuntimeLibrary="2"
+ OpenMP="true"
+ AdditionalOptions="/MP"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Astra64.lib libmex.lib libmx.lib libut.lib"
+ OutputFile="$(OutDir)\$(ProjectName)_c.mexw64"
+ AdditionalLibraryDirectories="..\..\bin\x64;$(MATLAB_ROOT)\extern\lib\win64\microsoft;..\..\lib\x64"
+ ModuleDefinitionFile="mex.def"
+ GenerateDebugInformation="false"
+ TargetMachine="17"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\astra_mex_direct_c.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\mexHelpFunctions.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\mexHelpFunctions.h"
+ >
+ </File>
+ <File
+ RelativePath=".\mexCopyDataHelpFunctions.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\mexCopyDataHelpFunctions.h"
+ >
+ </File>
+ <File
+ RelativePath=".\mexDataManagerHelpFunctions.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\mexDataManagerHelpFunctions.h"
+ >
+ </File>
+ <File
+ RelativePath=".\mexInitFunctions.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\mexInitFunctions.h"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/matlab/mex/astra_mex_direct_vc11.vcxproj b/matlab/mex/astra_mex_direct_vc11.vcxproj
new file mode 100644
index 0000000..bc2db62
--- /dev/null
+++ b/matlab/mex/astra_mex_direct_vc11.vcxproj
@@ -0,0 +1,310 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug_CUDA|Win32">
+ <Configuration>Debug_CUDA</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug_CUDA|x64">
+ <Configuration>Debug_CUDA</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release_CUDA|Win32">
+ <Configuration>Release_CUDA</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release_CUDA|x64">
+ <Configuration>Release_CUDA</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectName>astra_mex_direct</ProjectName>
+ <ProjectGuid>{0F68F4E2-BE1B-4A9A-B101-AECF4C069CC7}</ProjectGuid>
+ <RootNamespace>astraMatlab</RootNamespace>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_CUDA|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_CUDA|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_CUDA|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_CUDA|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug_CUDA|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug_CUDA|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release_CUDA|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release_CUDA|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>11.0.60610.1</_ProjectFileVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_CUDA|Win32'">
+ <OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <TargetName>$(ProjectName)_c</TargetName>
+ <TargetExt>.mexw32</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_CUDA|x64'">
+ <OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <TargetName>$(ProjectName)_c</TargetName>
+ <TargetExt>.mexw64</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <TargetName>$(ProjectName)_c</TargetName>
+ <TargetExt>.mexw32</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <TargetName>$(ProjectName)_c</TargetName>
+ <TargetExt>.mexw64</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_CUDA|Win32'">
+ <OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <TargetName>$(ProjectName)_c</TargetName>
+ <TargetExt>.mexw32</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_CUDA|x64'">
+ <OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <TargetName>$(ProjectName)_c</TargetName>
+ <TargetExt>.mexw64</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <TargetName>$(ProjectName)_c</TargetName>
+ <TargetExt>.mexw32</TargetExt>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
+ <IntDir>$(OutDir)obj\$(ProjectName)\</IntDir>
+ <TargetName>$(ProjectName)_c</TargetName>
+ <TargetExt>.mexw64</TargetExt>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_CUDA|Win32'">
+ <ClCompile>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <AdditionalIncludeDirectories>$(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <OpenMPSupport>true</OpenMPSupport>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>ASTRA_CUDA;__SSE2__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(OutDir)$(ProjectName)_c.mexw32</OutputFile>
+ <AdditionalDependencies>AstraCuda32D.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\lib\win32\;..\..\bin\win32\Debug_CUDA;$(MATLAB_ROOT)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ModuleDefinitionFile>mex.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_CUDA|x64'">
+ <ClCompile>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <AdditionalIncludeDirectories>$(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <OpenMPSupport>true</OpenMPSupport>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>ASTRA_CUDA;__SSE2__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(OutDir)$(ProjectName)_c.mexw64</OutputFile>
+ <AdditionalDependencies>AstraCuda64D.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\lib\x64\;..\..\bin\x64\Debug_CUDA;$(MATLAB_ROOT)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ModuleDefinitionFile>mex.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <AdditionalIncludeDirectories>$(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <OpenMPSupport>true</OpenMPSupport>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>__SSE2__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(OutDir)$(ProjectName)_c.mexw32</OutputFile>
+ <AdditionalDependencies>Astra32D.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\lib\win32\;..\..\bin\win32\Debug;$(MATLAB_ROOT)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ModuleDefinitionFile>mex.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <AdditionalIncludeDirectories>$(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <OpenMPSupport>true</OpenMPSupport>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>__SSE2__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(OutDir)$(ProjectName)_c.mexw64</OutputFile>
+ <AdditionalDependencies>Astra64D.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\lib\x64\;..\..\bin\x64\Debug;$(MATLAB_ROOT)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ModuleDefinitionFile>mex.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_CUDA|Win32'">
+ <ClCompile>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <AdditionalIncludeDirectories>$(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <OpenMPSupport>true</OpenMPSupport>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>ASTRA_CUDA;__SSE2__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(OutDir)$(ProjectName)_c.mexw32</OutputFile>
+ <AdditionalDependencies>AstraCuda32.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\lib\win32\;..\..\bin\win32\Release_CUDA;$(MATLAB_ROOT)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ModuleDefinitionFile>mex.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_CUDA|x64'">
+ <ClCompile>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <AdditionalIncludeDirectories>$(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <OpenMPSupport>true</OpenMPSupport>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>ASTRA_CUDA;__SSE2__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(OutDir)$(ProjectName)_c.mexw64</OutputFile>
+ <AdditionalDependencies>AstraCuda64.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\lib\x64\;..\..\bin\x64\Release_CUDA;$(MATLAB_ROOT)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ModuleDefinitionFile>mex.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <AdditionalIncludeDirectories>$(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <OpenMPSupport>true</OpenMPSupport>
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>__SSE2__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(OutDir)$(ProjectName)_c.mexw32</OutputFile>
+ <AdditionalDependencies>Astra32.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\lib\win32\;..\..\bin\win32\Release;$(MATLAB_ROOT)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ModuleDefinitionFile>mex.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+ <AdditionalIncludeDirectories>$(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <OpenMPSupport>true</OpenMPSupport>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>__SSE2__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>
+ </ClCompile>
+ <Link>
+ <OutputFile>$(OutDir)$(ProjectName)_c.mexw64</OutputFile>
+ <AdditionalDependencies>Astra64.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalLibraryDirectories>..\..\lib\x64\;..\..\bin\x64\Release;$(MATLAB_ROOT)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ModuleDefinitionFile>mex.def</ModuleDefinitionFile>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="astra_mex_direct_c.cpp" />
+ <ClCompile Include="mexHelpFunctions.cpp" />
+ <ClCompile Include="mexCopyDataHelpFunctions.cpp" />
+ <ClCompile Include="mexDataManagerHelpFunctions.cpp" />
+ <ClCompile Include="mexInitFunctions.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="mexHelpFunctions.h" />
+ <ClInclude Include="mexCopyDataHelpFunctions.h" />
+ <ClInclude Include="mexDataManagerHelpFunctions.h" />
+ <ClInclude Include="mexInitFunctions.h" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/matlab/mex/astra_mex_log_c.cpp b/matlab/mex/astra_mex_log_c.cpp
index ea4621e..905612c 100644
--- a/matlab/mex/astra_mex_log_c.cpp
+++ b/matlab/mex/astra_mex_log_c.cpp
@@ -55,7 +55,7 @@ void astra_mex_log_debug(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prh
string filename = mexToString(prhs[1]);
int linenumber = (int)mxGetScalar(prhs[2]);
string message = mexToString(prhs[3]);
- astra::CLogger::debug(filename.c_str(),linenumber,message.c_str());
+ astra::CLogger::debug(filename.c_str(),linenumber,"%s",message.c_str());
}
//-----------------------------------------------------------------------------------------
@@ -75,7 +75,7 @@ void astra_mex_log_info(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs
string filename = mexToString(prhs[1]);
int linenumber = (int)mxGetScalar(prhs[2]);
string message = mexToString(prhs[3]);
- astra::CLogger::info(filename.c_str(),linenumber,message.c_str());
+ astra::CLogger::info(filename.c_str(),linenumber,"%s",message.c_str());
}
//-----------------------------------------------------------------------------------------
@@ -95,7 +95,7 @@ void astra_mex_log_warn(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs
string filename = mexToString(prhs[1]);
int linenumber = (int)mxGetScalar(prhs[2]);
string message = mexToString(prhs[3]);
- astra::CLogger::warn(filename.c_str(),linenumber,message.c_str());
+ astra::CLogger::warn(filename.c_str(),linenumber,"%s",message.c_str());
}
//-----------------------------------------------------------------------------------------
@@ -115,7 +115,7 @@ void astra_mex_log_error(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prh
string filename = mexToString(prhs[1]);
int linenumber = (int)mxGetScalar(prhs[2]);
string message = mexToString(prhs[3]);
- astra::CLogger::error(filename.c_str(),linenumber,message.c_str());
+ astra::CLogger::error(filename.c_str(),linenumber,"%s",message.c_str());
}
//-----------------------------------------------------------------------------------------
diff --git a/matlab/mex/astra_mex_matrix_c.cpp b/matlab/mex/astra_mex_matrix_c.cpp
index aa31383..e07ddb6 100644
--- a/matlab/mex/astra_mex_matrix_c.cpp
+++ b/matlab/mex/astra_mex_matrix_c.cpp
@@ -112,7 +112,7 @@ static bool matlab_to_astra(const mxArray* _rhs, CSparseMatrix* _pMatrix)
mwIndex *colStarts = mxGetJc(_rhs);
mwIndex *rowIndices = mxGetIr(_rhs);
double *floatValues = 0;
- bool *boolValues = 0;
+ mxLogical *boolValues = 0;
bool bLogical = mxIsLogical(_rhs);
if (bLogical)
boolValues = mxGetLogicals(_rhs);
diff --git a/matlab/mex/astra_mex_plugin_c.cpp b/matlab/mex/astra_mex_plugin_c.cpp
new file mode 100644
index 0000000..4ed534e
--- /dev/null
+++ b/matlab/mex/astra_mex_plugin_c.cpp
@@ -0,0 +1,200 @@
+/*
+-----------------------------------------------------------------------
+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$
+*/
+
+/** \file astra_mex_plugin_c.cpp
+ *
+ * \brief Manages Python plugins.
+ */
+
+#include <mex.h>
+#include "mexHelpFunctions.h"
+#include "mexInitFunctions.h"
+
+#include "astra/PluginAlgorithm.h"
+
+#include <Python.h>
+
+using namespace std;
+using namespace astra;
+
+static void fixLapackLoading()
+{
+ // When running in Matlab, we need to force numpy
+ // to use its internal lapack library instead of
+ // Matlab's MKL library to avoid errors. To do this,
+ // we set Python's dlopen flags to RTLD_NOW|RTLD_DEEPBIND
+ // and import 'numpy.linalg.lapack_lite' here. We reset
+ // Python's dlopen flags afterwards.
+ PyObject *sys = PyImport_ImportModule("sys");
+ if (sys != NULL) {
+ PyObject *curFlags = PyObject_CallMethod(sys, "getdlopenflags", NULL);
+ if (curFlags != NULL) {
+ PyObject *retVal = PyObject_CallMethod(sys, "setdlopenflags", "i", 10); // RTLD_NOW|RTLD_DEEPBIND
+ if (retVal != NULL) {
+ PyObject *lapack = PyImport_ImportModule("numpy.linalg.lapack_lite");
+ if (lapack != NULL) {
+ Py_DECREF(lapack);
+ }
+ PyObject *retVal2 = PyObject_CallMethod(sys, "setdlopenflags", "O",curFlags);
+ if (retVal2 != NULL) {
+ Py_DECREF(retVal2);
+ }
+ Py_DECREF(retVal);
+ }
+ Py_DECREF(curFlags);
+ }
+ Py_DECREF(sys);
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+/** astra_mex_plugin('init');
+ *
+ * Initialize plugin support by initializing python and importing astra
+ */
+void astra_mex_plugin_init()
+{
+ if(!Py_IsInitialized()){
+ Py_Initialize();
+ PyEval_InitThreads();
+ }
+
+#ifndef _MSC_VER
+ fixLapackLoading();
+#endif
+
+ // Importing astra may be overkill, since we only need to initialize
+ // PythonPluginAlgorithmFactory from astra.plugin_c.
+ PyObject *mod = PyImport_ImportModule("astra");
+ Py_XDECREF(mod);
+}
+
+
+//-----------------------------------------------------------------------------------------
+/** astra_mex_plugin('get_registered');
+ *
+ * Print registered plugins.
+ */
+void astra_mex_plugin_get_registered(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
+{
+ astra::CPluginAlgorithmFactory *fact = astra::CPluginAlgorithmFactory::getFactory();
+ if (!fact) {
+ mexPrintf("Plugin support not initialized.");
+ return;
+ }
+ std::map<std::string, std::string> mp = fact->getRegisteredMap();
+ for(std::map<std::string,std::string>::iterator it=mp.begin();it!=mp.end();it++){
+ mexPrintf("%s: %s\n",it->first.c_str(), it->second.c_str());
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+/** astra_mex_plugin('register', class_name);
+ *
+ * Register plugin.
+ */
+void astra_mex_plugin_register(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
+{
+ astra::CPluginAlgorithmFactory *fact = astra::CPluginAlgorithmFactory::getFactory();
+ if (!fact) {
+ mexPrintf("Plugin support not initialized.");
+ return;
+ }
+ if (2 <= nrhs) {
+ string class_name = mexToString(prhs[1]);
+ fact->registerPlugin(class_name);
+ }else{
+ mexPrintf("astra_mex_plugin('register', class_name);\n");
+ }
+}
+
+//-----------------------------------------------------------------------------------------
+/** astra_mex_plugin('get_help', name);
+ *
+ * Get help about plugin.
+ */
+void astra_mex_plugin_get_help(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
+{
+ astra::CPluginAlgorithmFactory *fact = astra::CPluginAlgorithmFactory::getFactory();
+ if (!fact) {
+ mexPrintf("Plugin support not initialized.");
+ return;
+ }
+ if (2 <= nrhs) {
+ string name = mexToString(prhs[1]);
+ mexPrintf((fact->getHelp(name)+"\n").c_str());
+ }else{
+ mexPrintf("astra_mex_plugin('get_help', name);\n");
+ }
+}
+
+
+//-----------------------------------------------------------------------------------------
+
+static void printHelp()
+{
+ mexPrintf("Please specify a mode of operation.\n");
+ mexPrintf(" Valid modes: register, get_registered, get_help\n");
+}
+
+//-----------------------------------------------------------------------------------------
+/**
+ * ... = astra_mex(type,...);
+ */
+void mexFunction(int nlhs, mxArray* plhs[],
+ int nrhs, const mxArray* prhs[])
+{
+
+ // INPUT0: Mode
+ string sMode = "";
+ if (1 <= nrhs) {
+ sMode = mexToString(prhs[0]);
+ } else {
+ printHelp();
+ return;
+ }
+
+ initASTRAMex();
+
+ // SWITCH (MODE)
+ if (sMode == "init") {
+ astra_mex_plugin_init();
+ } else if (sMode == std::string("get_registered")) {
+ astra_mex_plugin_get_registered(nlhs, plhs, nrhs, prhs);
+ }else if (sMode == std::string("get_help")) {
+ astra_mex_plugin_get_help(nlhs, plhs, nrhs, prhs);
+ }else if (sMode == std::string("register")) {
+ astra_mex_plugin_register(nlhs, plhs, nrhs, prhs);
+ } else {
+ printHelp();
+ }
+
+ return;
+}
+
+
diff --git a/matlab/mex/astra_mex_projector3d_c.cpp b/matlab/mex/astra_mex_projector3d_c.cpp
index c3b547f..e25802c 100644
--- a/matlab/mex/astra_mex_projector3d_c.cpp
+++ b/matlab/mex/astra_mex_projector3d_c.cpp
@@ -137,7 +137,9 @@ void astra_mex_projector3d_get_projection_geometry(int nlhs, mxArray* plhs[], in
// step3: get projection_geometry and turn it into a MATLAB struct
if (1 <= nlhs) {
- plhs[0] = configToStruct(pProjector->getProjectionGeometry()->getConfiguration());
+ Config *cfg = pProjector->getProjectionGeometry()->getConfiguration();
+ plhs[0] = configToStruct(cfg);
+ delete cfg;
}
}
@@ -163,7 +165,9 @@ void astra_mex_projector3d_get_volume_geometry(int nlhs, mxArray* plhs[], int nr
// step3: get projection_geometry and turn it into a MATLAB struct
if (1 <= nlhs) {
- plhs[0] = configToStruct(pProjector->getVolumeGeometry()->getConfiguration());
+ Config *cfg = pProjector->getVolumeGeometry()->getConfiguration();
+ plhs[0] = configToStruct(cfg);
+ delete cfg;
}
}
diff --git a/matlab/mex/astra_mex_projector_c.cpp b/matlab/mex/astra_mex_projector_c.cpp
index 204ba8e..bf701af 100644
--- a/matlab/mex/astra_mex_projector_c.cpp
+++ b/matlab/mex/astra_mex_projector_c.cpp
@@ -160,7 +160,9 @@ void astra_mex_projector_projection_geometry(int nlhs, mxArray* plhs[], int nrhs
// step3: get projection_geometry and turn it into a MATLAB struct
if (1 <= nlhs) {
- plhs[0] = configToStruct(pProjector->getProjectionGeometry()->getConfiguration());
+ Config *cfg = pProjector->getProjectionGeometry()->getConfiguration();
+ plhs[0] = configToStruct(cfg);
+ delete cfg;
}
}
@@ -189,8 +191,9 @@ void astra_mex_projector_volume_geometry(int nlhs, mxArray* plhs[], int nrhs, co
// step3: get projection_geometry and turn it into a MATLAB struct
if (1 <= nlhs) {
- plhs[0] = configToStruct(pProjector->getVolumeGeometry()->getConfiguration());
-
+ Config *cfg = pProjector->getVolumeGeometry()->getConfiguration();
+ plhs[0] = configToStruct(cfg);
+ delete cfg;
}
}
diff --git a/matlab/mex/mexHelpFunctions.cpp b/matlab/mex/mexHelpFunctions.cpp
index 87a9672..13c4ade 100644
--- a/matlab/mex/mexHelpFunctions.cpp
+++ b/matlab/mex/mexHelpFunctions.cpp
@@ -31,9 +31,9 @@ $Id$
* \brief Contains some functions for interfacing matlab with c data structures
*/
#include "mexHelpFunctions.h"
+#include "astra/Utilities.h"
#include <algorithm>
-#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/classification.hpp>
@@ -58,7 +58,7 @@ string mexToString(const mxArray* pInput)
// is scalar?
if (mxIsNumeric(pInput) && mxGetM(pInput)*mxGetN(pInput) == 1) {
- return boost::lexical_cast<string>(mxGetScalar(pInput));
+ return StringUtil::doubleToString(mxGetScalar(pInput));
}
return "";
@@ -336,7 +336,11 @@ mxArray* XMLNodeToStruct(astra::XMLNode node)
// option
if (subnode.getName() == "Option") {
- mOptions[subnode.getAttribute("key")] = stringToMxArray(subnode.getAttribute("value"));
+ if(subnode.hasAttribute("value")){
+ mOptions[subnode.getAttribute("key")] = stringToMxArray(subnode.getAttribute("value"));
+ }else{
+ mOptions[subnode.getAttribute("key")] = stringToMxArray(subnode.getContent());
+ }
}
// regular content
@@ -374,7 +378,7 @@ mxArray* stringToMxArray(std::string input)
boost::split(col_strings, row_strings[row], boost::is_any_of(","));
// check size
for (unsigned int col = 0; col < col_strings.size(); col++) {
- out[col*rows + row] = boost::lexical_cast<float32>(col_strings[col]);
+ out[col*rows + row] = StringUtil::stringToFloat(col_strings[col]);
}
}
return pMatrix;
@@ -393,7 +397,7 @@ mxArray* stringToMxArray(std::string input)
// loop elements
for (unsigned int i = 0; i < items.size(); i++) {
- out[i] = boost::lexical_cast<float32>(items[i]);
+ out[i] = StringUtil::stringToFloat(items[i]);
}
return pVector;
}
diff --git a/matlab/mex/mexHelpFunctions.h b/matlab/mex/mexHelpFunctions.h
index 3ac5bd8..07edc64 100644
--- a/matlab/mex/mexHelpFunctions.h
+++ b/matlab/mex/mexHelpFunctions.h
@@ -37,7 +37,6 @@ $Id$
#include <algorithm>
#include <mex.h>
-#include <boost/lexical_cast.hpp>
#include <boost/any.hpp>
#include "astra/Globals.h"
diff --git a/matlab/mex/mexInitFunctions.cpp b/matlab/mex/mexInitFunctions.cpp
index d8a50d7..7245af2 100644
--- a/matlab/mex/mexInitFunctions.cpp
+++ b/matlab/mex/mexInitFunctions.cpp
@@ -8,7 +8,7 @@ bool mexIsInitialized=false;
*
*/
void logCallBack(const char *msg, size_t len){
- mexPrintf(msg);
+ mexPrintf("%s",msg);
}
/**
@@ -17,8 +17,19 @@ void logCallBack(const char *msg, size_t len){
*/
void initASTRAMex(){
if(mexIsInitialized) return;
+
+ astra::running_in_matlab=true;
+
if(!astra::CLogger::setCallbackScreen(&logCallBack)){
mexErrMsgTxt("Error initializing mex functions.");
}
+
mexIsInitialized=true;
+
+
+ // If we have support for plugins, initialize them.
+ // (NB: Call this after setting mexIsInitialized, to avoid recursively
+ // calling initASTRAMex)
+ mexEvalString("if exist('astra_mex_plugin_c') == 3; astra_mex_plugin_c('init'); end");
+
}
diff --git a/matlab/tools/astra_create_fbp_reconstruction.m b/matlab/tools/astra_create_fbp_reconstruction.m
index 5540f27..a2561b7 100644
--- a/matlab/tools/astra_create_fbp_reconstruction.m
+++ b/matlab/tools/astra_create_fbp_reconstruction.m
@@ -19,6 +19,7 @@ cfg.ProjectorId = proj_id;
cfg.Options.GPUindex = 0;
alg_id = astra_mex_algorithm('create', cfg);
astra_mex_algorithm('run', alg_id);
+astra_mex_algorithm('delete', alg_id);
if numel(sinogram) ~= 1
astra_mex_data2d('delete', sinogram_id);
diff --git a/matlab/tools/astra_create_projector.m b/matlab/tools/astra_create_projector.m
index da9c083..9bbef9e 100644
--- a/matlab/tools/astra_create_projector.m
+++ b/matlab/tools/astra_create_projector.m
@@ -1,7 +1,7 @@
-function proj_id = astra_create_projector(type, proj_geom, vol_geom)
+function proj_id = astra_create_projector(type, proj_geom, vol_geom, options)
%--------------------------------------------------------------------------
-% proj_id = astra_create_projector(type, proj_geom, vol_geom)
+% proj_id = astra_create_projector(type, proj_geom, vol_geom, options)
%
% Create a new projector object based on projection and volume geometry.
% Used when the default values of each projector are sufficient.
@@ -9,6 +9,7 @@ function proj_id = astra_create_projector(type, proj_geom, vol_geom)
% type: type of the projector. 'blob', 'line', 'linear' 'strip', ... See API for more information.
% proj_geom: MATLAB struct containing the projection geometry.
% vol_geom: MATLAB struct containing the volume geometry.
+% options: Optional MATLAB struct containing projector options (like: 'GPUindex', 'DetectorSuperSampling', and 'VoxelSuperSampling')
% proj_id: identifier of the projector as it is now stored in the astra-library.
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
@@ -38,6 +39,10 @@ if strcmp(type,'blob')
cfg_proj.Kernel.KernelValues = blob_values;
end
+if exist('options', 'var')
+ cfg_proj.options = options;
+end
+
if strcmp(type,'linear3d') || strcmp(type,'linearcone') || strcmp(type,'cuda3d')
proj_id = astra_mex_projector3d('create', cfg_proj);
else
diff --git a/matlab/tools/astra_create_reconstruction_cuda.m b/matlab/tools/astra_create_reconstruction_cuda.m
index 7d9e1dd..7d0421c 100644
--- a/matlab/tools/astra_create_reconstruction_cuda.m
+++ b/matlab/tools/astra_create_reconstruction_cuda.m
@@ -45,7 +45,7 @@ if strcmp(rec_type,'')
end
% configure
-cfg = astra_struct('SIRT_CUDA');
+cfg = astra_struct(rec_type);
cfg.ProjectionGeometry = proj_geom;
cfg.ReconstructionGeometry = vol_geom;
cfg.ProjectionDataId = sinogram_id;
diff --git a/matlab/tools/astra_create_vol_geom.m b/matlab/tools/astra_create_vol_geom.m
index ea975e6..a3ba7de 100644
--- a/matlab/tools/astra_create_vol_geom.m
+++ b/matlab/tools/astra_create_vol_geom.m
@@ -15,6 +15,7 @@ function vol_geom = astra_create_vol_geom(varargin)
% vol_geom: MATLAB struct containing all information of the geometry.
%--------------------------------------------------------------------------
% vol_geom = astra_create_vol_geom(row_count, col_count, slice_count);
+% vol_geom = astra_create_vol_geom(row_count, col_count, slice_count, min_x, max_x, min_y, max_y, min_z, max_z);
%
% Create a 3D volume geometry. See the API for more information.
% row_count: number of rows.
@@ -93,4 +94,18 @@ elseif numel(varargin) == 3
vol_geom.GridRowCount = varargin{1};
vol_geom.GridColCount = varargin{2};
vol_geom.GridSliceCount = varargin{3};
+
+% astra_create_vol_geom(row_count, col_count, slice_count, min_x, max_x, min_y, max_y, min_z, max_z)
+elseif numel(varargin) == 9
+ vol_geom = struct();
+ vol_geom.GridRowCount = varargin{1};
+ vol_geom.GridColCount = varargin{2};
+ vol_geom.GridSliceCount = varargin{3};
+ vol_geom.option.WindowMinX = varargin{4};
+ vol_geom.option.WindowMaxX = varargin{5};
+ vol_geom.option.WindowMinY = varargin{6};
+ vol_geom.option.WindowMaxY = varargin{7};
+ vol_geom.option.WindowMinZ = varargin{8};
+ vol_geom.option.WindowMaxZ = varargin{9};
+
end
diff --git a/matlab/tools/astra_mex_direct.m b/matlab/tools/astra_mex_direct.m
new file mode 100644
index 0000000..58c4fd2
--- /dev/null
+++ b/matlab/tools/astra_mex_direct.m
@@ -0,0 +1,24 @@
+function [varargout] = astra_mex_direct(varargin)
+%------------------------------------------------------------------------
+% Reference page in Help browser
+% <a href="matlab:docsearch('astra_mex_direct' )">astra_mex_data3d</a>.
+%------------------------------------------------------------------------
+%------------------------------------------------------------------------
+% This file is part of the ASTRA Toolbox
+%
+% Copyright: 2010-2015, iMinds-Vision Lab, University of Antwerp
+% 2014-2015, CWI, Amsterdam
+% License: Open Source under GPLv3
+% Contact: astra@uantwerpen.be
+% Website: http://sf.net/projects/astra-toolbox
+%------------------------------------------------------------------------
+% $Id$
+if nargout == 0
+ astra_mex_direct_c(varargin{:});
+ if exist('ans','var')
+ varargout{1} = ans;
+ end
+else
+ varargout = cell(1,nargout);
+ [varargout{:}] = astra_mex_direct_c(varargin{:});
+end
diff --git a/matlab/tools/astra_mex_plugin.m b/matlab/tools/astra_mex_plugin.m
new file mode 100644
index 0000000..4159365
--- /dev/null
+++ b/matlab/tools/astra_mex_plugin.m
@@ -0,0 +1,24 @@
+function [varargout] = astra_mex_plugin(varargin)
+%------------------------------------------------------------------------
+% Reference page in Help browser
+% <a href="matlab:docsearch('astra_mex_plugin' )">astra_mex_plugin</a>.
+%------------------------------------------------------------------------
+%------------------------------------------------------------------------
+% This file is part of the ASTRA Toolbox
+%
+% Copyright: 2010-2015, iMinds-Vision Lab, University of Antwerp
+% 2014-2015, CWI, Amsterdam
+% License: Open Source under GPLv3
+% Contact: astra@uantwerpen.be
+% Website: http://sf.net/projects/astra-toolbox
+%------------------------------------------------------------------------
+% $Id$
+if nargout == 0
+ astra_mex_plugin_c(varargin{:});
+ if exist('ans','var')
+ varargout{1} = ans;
+ end
+else
+ varargout = cell(1,nargout);
+ [varargout{:}] = astra_mex_plugin_c(varargin{:});
+end \ No newline at end of file
diff --git a/matlab/tools/opTomo.m b/matlab/tools/opTomo.m
index 14128d2..04b3634 100644
--- a/matlab/tools/opTomo.m
+++ b/matlab/tools/opTomo.m
@@ -44,11 +44,9 @@ classdef opTomo < opSpot
vol_id
fp_alg_id
bp_alg_id
+ proj_id
% ASTRA IDs handle
astra_handle
- % geometries
- proj_geom;
- vol_geom;
end % properties
properties ( SetAccess = private, GetAccess = public )
@@ -139,6 +137,17 @@ classdef opTomo < opSpot
error(['Only type ' 39 'cuda' 39 ' is supported ' ...
'for 3D geometries.'])
end
+
+ % setup projector
+ cfg = astra_struct('cuda3d');
+ cfg.ProjectionGeometry = proj_geom;
+ cfg.VolumeGeometry = vol_geom;
+ cfg.option.GPUindex = gpu_index;
+
+ % create projector
+ op.proj_id = astra_mex_projector3d('create', cfg);
+ % create handle to ASTRA object, for cleaning up
+ op.astra_handle = opTomo_helper_handle(op.proj_id);
% create a function handle
op.funHandle = @opTomo_intrnl3D;
@@ -148,8 +157,6 @@ classdef opTomo < opSpot
% pass object properties
op.proj_size = proj_size;
op.vol_size = vol_size;
- op.proj_geom = proj_geom;
- op.vol_geom = vol_geom;
op.cflag = false;
op.sweepflag = false;
@@ -169,10 +176,12 @@ classdef opTomo < opSpot
if issparse(x)
x = full(x);
end
-
- % convert input to single
- if isa(x, 'single') == false
+
+ if isa(x, 'double')
+ isdouble = true;
x = single(x);
+ else
+ isdouble = false;
end
% the multiplication
@@ -180,6 +189,10 @@ classdef opTomo < opSpot
% make sure output is column vector
y = y(:);
+
+ if isdouble
+ y = double(y);
+ end
end % multiply
@@ -194,7 +207,7 @@ classdef opTomo < opSpot
function y = opTomo_intrnl2D(op,x,mode)
if mode == 1
- % X is passed as a vector, reshape it into an image.
+ % x is passed as a vector, reshape it into an image.
x = reshape(x, op.vol_size);
% Matlab data copied to ASTRA data
@@ -206,7 +219,7 @@ classdef opTomo < opSpot
% retrieve Matlab array
y = astra_mex_data2d('get_single', op.sino_id);
else
- % X is passed as a vector, reshape it into a sinogram.
+ % x is passed as a vector, reshape it into a sinogram.
x = reshape(x, op.proj_size);
% Matlab data copied to ASTRA data
@@ -218,6 +231,7 @@ classdef opTomo < opSpot
% retrieve Matlab array
y = astra_mex_data2d('get_single', op.vol_id);
end
+
end % opTomo_intrnl2D
@@ -225,53 +239,16 @@ classdef opTomo < opSpot
function y = opTomo_intrnl3D(op,x,mode)
if mode == 1
- % X is passed as a vector, reshape it into an image
+ % x is passed as a vector, reshape it into an image
x = reshape(x, op.vol_size);
- % initialize output
- y = zeros(op.proj_size, 'single');
-
- % link matlab array to ASTRA
- vol_id = astra_mex_data3d_c('link', '-vol', op.vol_geom, x, 0);
- sino_id = astra_mex_data3d_c('link', '-sino', op.proj_geom, y, 1);
-
- % initialize fp algorithm
- cfg = astra_struct('FP3D_CUDA');
- cfg.ProjectionDataId = sino_id;
- cfg.VolumeDataId = vol_id;
-
- alg_id = astra_mex_algorithm('create', cfg);
-
% forward projection
- astra_mex_algorithm('iterate', alg_id);
-
- % cleanup
- astra_mex_data3d('delete', vol_id);
- astra_mex_data3d('delete', sino_id);
+ y = astra_mex_direct('FP3D', op.proj_id, x);
else
- % X is passed as a vector, reshape it into projection data
+ % x is passed as a vector, reshape it into projection data
x = reshape(x, op.proj_size);
-
- % initialize output
- y = zeros(op.vol_size,'single');
-
- % link matlab array to ASTRA
- vol_id = astra_mex_data3d_c('link', '-vol', op.vol_geom, y, 1);
- sino_id = astra_mex_data3d_c('link', '-sino', op.proj_geom, x, 0);
- % initialize bp algorithm
- cfg = astra_struct('BP3D_CUDA');
- cfg.ProjectionDataId = sino_id;
- cfg.ReconstructionDataId = vol_id;
-
- alg_id = astra_mex_algorithm('create', cfg);
-
- % backprojection
- astra_mex_algorithm('iterate', alg_id);
-
- % cleanup
- astra_mex_data3d('delete', vol_id);
- astra_mex_data3d('delete', sino_id);
+ y = astra_mex_direct('BP3D', op.proj_id, x);
end
end % opTomo_intrnl3D