From e4614cf09b90cc9a0e38d370bb090a11f3877b33 Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Fri, 13 Mar 2015 14:21:53 +0100 Subject: Add logging support to Matlab --- matlab/mex/astra_mex_log_c.cpp | 302 +++++++++++++++++++++++++++++++++++++++++ matlab/tools/astra_mex_log.m | 33 +++++ 2 files changed, 335 insertions(+) create mode 100644 matlab/mex/astra_mex_log_c.cpp create mode 100644 matlab/tools/astra_mex_log.m (limited to 'matlab') diff --git a/matlab/mex/astra_mex_log_c.cpp b/matlab/mex/astra_mex_log_c.cpp new file mode 100644 index 0000000..14ae391 --- /dev/null +++ b/matlab/mex/astra_mex_log_c.cpp @@ -0,0 +1,302 @@ +/* +----------------------------------------------------------------------- +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 . + +----------------------------------------------------------------------- +$Id$ +*/ + +/** \file astra_mex_algorithm_c.cpp + * + * \brief Creates and manages algorithms (reconstruction,projection,...). + */ +#include +#include "mexHelpFunctions.h" + +#include "astra/Logging.h" + +using namespace std; +using namespace astra; +//----------------------------------------------------------------------------------------- +/** astra_mex_log('debug', file, line, message); + * + * Log a debug message. + * file: Originating file name + * line: Originating line number + * message: Log message. + */ +void astra_mex_log_debug(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) +{ + if (nrhs < 4) { + mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); + return; + } + 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_mex_log('info', file, line, message); + * + * Log an info message. + * file: Originating file name + * line: Originating line number + * message: Log message. + */ +void astra_mex_log_info(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) +{ + if (nrhs < 4) { + mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); + return; + } + 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_mex_log('warn', file, line, message); + * + * Log a warning message. + * file: Originating file name + * line: Originating line number + * message: Log message. + */ +void astra_mex_log_warn(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) +{ + if (nrhs < 4) { + mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); + return; + } + 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_mex_log('error', file, line, message); + * + * Log an error message. + * file: Originating file name + * line: Originating line number + * message: Log message. + */ +void astra_mex_log_error(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) +{ + if (nrhs < 4) { + mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); + return; + } + 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_mex_log('enable', type); + * + * Enable logging. + * type: which output to enable ('all', 'file', 'screen') + */ +void astra_mex_log_enable(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) +{ + if (nrhs < 2) { + mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); + return; + } + string sType = mexToString(prhs[1]); + if(sType == "all"){ + astra::CLogger::enable(); + }else if(sType == "file"){ + astra::CLogger::enableFile(); + }else if(sType == "screen"){ + astra::CLogger::enableScreen(); + } else { + mexErrMsgTxt("Specify which output to enable ('all', 'file', or 'screen')"); + } +} + +//----------------------------------------------------------------------------------------- +/** astra_mex_log('disable', type); + * + * Disable logging. + * type: which output to disable ('all', 'file', 'screen') + */ +void astra_mex_log_disable(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) +{ + if (nrhs < 2) { + mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); + return; + } + string sType = mexToString(prhs[1]); + if(sType == "all"){ + astra::CLogger::disable(); + }else if(sType == "file"){ + astra::CLogger::disableFile(); + }else if(sType == "screen"){ + astra::CLogger::disableScreen(); + } else { + mexErrMsgTxt("Specify which output to disable ('all', 'file', or 'screen')"); + } +} + +//----------------------------------------------------------------------------------------- +/** astra_mex_log('format', type, fmt); + * + * Enable logging. + * type: which output to format ('file', 'screen') + * fmt: format string + * Here are the substitutions you may use: + * %f: Source file name generating the log call. + * %n: Source line number where the log call was made. + * %m: The message text sent to the logger (after printf formatting). + * %d: The current date, formatted using the logger's date format. + * %t: The current time, formatted using the logger's time format. + * %l: The log level (one of "DEBUG", "INFO", "WARN", or "ERROR"). + * %%: A literal percent sign. + * The default format string is "%d %t %f(%n): %l: %m\n". + */ +void astra_mex_log_format(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) +{ + if (nrhs < 3) { + mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); + return; + } + string sType = mexToString(prhs[1]); + string sFormat = mexToString(prhs[2]); + if (!sFormat.empty()) + { + char lastChar = *sFormat.rbegin(); + if (lastChar!='\n'){ + sFormat += '\n'; + } + }else{ + sFormat += '\n'; + } + if(sType == "file"){ + astra::CLogger::setFormatFile(sFormat.c_str()); + }else if(sType == "screen"){ + astra::CLogger::setFormatScreen(sFormat.c_str()); + } else { + mexErrMsgTxt("Specify which output to format ('file' or 'screen')"); + } +} + +//----------------------------------------------------------------------------------------- +/** astra_mex_log('output', type, output, level); + * + * Set output file / output screen. + * type: which output to set ('file', 'screen') + * output: which output file / screen to use: + * 'file': filename + * 'screen': 'stdout' or 'stderr' + * level: logging level to use ('debug', 'info', 'warn', or 'error') + */ +void astra_mex_log_output(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) +{ + if (nrhs < 4) { + mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); + return; + } + string sType = mexToString(prhs[1]); + string sOutput = mexToString(prhs[2]); + string sLevel = mexToString(prhs[3]); + log_level eLevel; + if(sLevel == "debug"){ + eLevel = LOG_DEBUG; + }else if(sLevel == "info"){ + eLevel = LOG_INFO; + }else if(sLevel == "warn"){ + eLevel = LOG_WARN; + }else if(sLevel == "error"){ + eLevel = LOG_ERROR; + }else{ + mexErrMsgTxt("Specify which log level to use ('debug', 'info', 'warn', or 'error')"); + } + if(sType == "file"){ + astra::CLogger::setOutputFile(sOutput.c_str(),eLevel); + }else if(sType == "screen"){ + int fd; + if(sOutput == "stdout"){ + fd=1; + }else if(sOutput == "stderr"){ + fd=2; + }else{ + mexErrMsgTxt("Specify which screen to output to ('stdout' or 'stderr')"); + } + astra::CLogger::setOutputScreen(fd,eLevel); + } else { + mexErrMsgTxt("Specify which output to set ('file' or 'screen')"); + } +} + +//----------------------------------------------------------------------------------------- +static void printHelp() +{ + mexPrintf("Please specify a mode of operation.\n"); + mexPrintf("Valid modes: debug, info, warn, error, enable, disable, format, output\n"); +} + +//----------------------------------------------------------------------------------------- +/** + * ... = astra_mex_log(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; + } + + // SWITCH (MODE) + if (sMode == "debug") { + astra_mex_log_debug(nlhs, plhs, nrhs, prhs); + }else if (sMode == "info") { + astra_mex_log_info(nlhs, plhs, nrhs, prhs); + }else if (sMode == "warn") { + astra_mex_log_warn(nlhs, plhs, nrhs, prhs); + }else if (sMode == "error") { + astra_mex_log_error(nlhs, plhs, nrhs, prhs); + }else if (sMode == "enable") { + astra_mex_log_enable(nlhs, plhs, nrhs, prhs); + }else if (sMode == "disable") { + astra_mex_log_disable(nlhs, plhs, nrhs, prhs); + }else if (sMode == "format") { + astra_mex_log_format(nlhs, plhs, nrhs, prhs); + }else if (sMode == "output") { + astra_mex_log_output(nlhs, plhs, nrhs, prhs); + } else { + printHelp(); + } + return; +} diff --git a/matlab/tools/astra_mex_log.m b/matlab/tools/astra_mex_log.m new file mode 100644 index 0000000..28cfa18 --- /dev/null +++ b/matlab/tools/astra_mex_log.m @@ -0,0 +1,33 @@ +function [varargout] = astra_mex_log(varargin) +%------------------------------------------------------------------------ +% Reference page in Help browser +% astra_mex_log. +%------------------------------------------------------------------------ +%------------------------------------------------------------------------ +% 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 size(varargin,2)==2 && (strcmp(varargin{1},'debug') || strcmp(varargin{1},'info') || strcmp(varargin{1},'warn') || strcmp(varargin{1},'error')) + d = dbstack(1); + if size(d,1)==0 + astra_mex_log_c(varargin{1},'Unknown',0,varargin{2}) + else + astra_mex_log_c(varargin{1},d(1).file,d(1).line,varargin{2}) + end +else + if nargout == 0 + astra_mex_log_c(varargin{:}); + if exist('ans','var') + varargout{1} = ans; + end + else + varargout = cell(1,nargout); + [varargout{:}] = astra_mex_log_c(varargin{:}); + end +end \ No newline at end of file -- cgit v1.2.3 From f21700e00e81538d5510973a51b8ae97fb4a24dd Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Fri, 13 Mar 2015 17:12:42 +0100 Subject: Enable logging to Matlab window using callback function Also introduces a mex initialize function that is called at the first invocation of any mex method. --- matlab/mex/astra_mex.cpp | 3 +++ matlab/mex/astra_mex_algorithm_c.cpp | 3 +++ matlab/mex/astra_mex_c.cpp | 3 +++ matlab/mex/astra_mex_data2d_c.cpp | 3 +++ matlab/mex/astra_mex_data3d_c.cpp | 3 +++ matlab/mex/astra_mex_log_c.cpp | 3 +++ matlab/mex/astra_mex_matrix_c.cpp | 3 +++ matlab/mex/astra_mex_projector3d_c.cpp | 3 +++ matlab/mex/astra_mex_projector_c.cpp | 3 +++ matlab/mex/mexInitFunctions.cpp | 24 ++++++++++++++++++++++++ matlab/mex/mexInitFunctions.h | 6 ++++++ 11 files changed, 57 insertions(+) create mode 100644 matlab/mex/mexInitFunctions.cpp create mode 100644 matlab/mex/mexInitFunctions.h (limited to 'matlab') diff --git a/matlab/mex/astra_mex.cpp b/matlab/mex/astra_mex.cpp index 0eb5662..4bf42dd 100644 --- a/matlab/mex/astra_mex.cpp +++ b/matlab/mex/astra_mex.cpp @@ -28,6 +28,7 @@ $Id$ #include #include "mexHelpFunctions.h" +#include "mexInitFunctions.h" #include "astra/Globals.h" @@ -104,6 +105,8 @@ void mexFunction(int nlhs, mxArray* plhs[], return; } + initASTRAMex(); + // SWITCH (MODE) if (sMode == std::string("version")) { astra_mex_version(nlhs, plhs, nrhs, prhs); diff --git a/matlab/mex/astra_mex_algorithm_c.cpp b/matlab/mex/astra_mex_algorithm_c.cpp index 669af8c..e4afa63 100644 --- a/matlab/mex/astra_mex_algorithm_c.cpp +++ b/matlab/mex/astra_mex_algorithm_c.cpp @@ -32,6 +32,7 @@ $Id$ */ #include #include "mexHelpFunctions.h" +#include "mexInitFunctions.h" #include "astra/Globals.h" #define USE_MATLAB_UNDOCUMENTED @@ -325,6 +326,8 @@ void mexFunction(int nlhs, mxArray* plhs[], return; } + initASTRAMex(); + // SWITCH (MODE) if (sMode == "create") { astra_mex_algorithm_create(nlhs, plhs, nrhs, prhs); diff --git a/matlab/mex/astra_mex_c.cpp b/matlab/mex/astra_mex_c.cpp index 760bd51..4a331f5 100644 --- a/matlab/mex/astra_mex_c.cpp +++ b/matlab/mex/astra_mex_c.cpp @@ -33,6 +33,7 @@ $Id$ #include #include "mexHelpFunctions.h" +#include "mexInitFunctions.h" #include "astra/Globals.h" @@ -128,6 +129,8 @@ void mexFunction(int nlhs, mxArray* plhs[], return; } + initASTRAMex(); + // SWITCH (MODE) if (sMode == std::string("version")) { astra_mex_version(nlhs, plhs, nrhs, prhs); diff --git a/matlab/mex/astra_mex_data2d_c.cpp b/matlab/mex/astra_mex_data2d_c.cpp index 5f79e98..9576896 100644 --- a/matlab/mex/astra_mex_data2d_c.cpp +++ b/matlab/mex/astra_mex_data2d_c.cpp @@ -32,6 +32,7 @@ $Id$ */ #include #include "mexHelpFunctions.h" +#include "mexInitFunctions.h" #include @@ -635,6 +636,8 @@ void mexFunction(int nlhs, mxArray* plhs[], return; } + initASTRAMex(); + // SWITCH (MODE) if (sMode == std::string("get")) { astra_mex_data2d_get(nlhs, plhs, nrhs, prhs); diff --git a/matlab/mex/astra_mex_data3d_c.cpp b/matlab/mex/astra_mex_data3d_c.cpp index 0a3f85d..32b0ba7 100644 --- a/matlab/mex/astra_mex_data3d_c.cpp +++ b/matlab/mex/astra_mex_data3d_c.cpp @@ -32,6 +32,7 @@ $Id$ */ #include #include "mexHelpFunctions.h" +#include "mexInitFunctions.h" #include "mexCopyDataHelpFunctions.h" #include "mexDataManagerHelpFunctions.h" @@ -371,6 +372,8 @@ void mexFunction(int nlhs, mxArray* plhs[], return; } + initASTRAMex(); + // 3D data if (sMode == std::string("create")) { astra_mex_data3d_create(nlhs, plhs, nrhs, prhs); diff --git a/matlab/mex/astra_mex_log_c.cpp b/matlab/mex/astra_mex_log_c.cpp index 14ae391..79fe3d5 100644 --- a/matlab/mex/astra_mex_log_c.cpp +++ b/matlab/mex/astra_mex_log_c.cpp @@ -32,6 +32,7 @@ $Id$ */ #include #include "mexHelpFunctions.h" +#include "mexInitFunctions.h" #include "astra/Logging.h" @@ -278,6 +279,8 @@ void mexFunction(int nlhs, mxArray* plhs[], return; } + initASTRAMex(); + // SWITCH (MODE) if (sMode == "debug") { astra_mex_log_debug(nlhs, plhs, nrhs, prhs); diff --git a/matlab/mex/astra_mex_matrix_c.cpp b/matlab/mex/astra_mex_matrix_c.cpp index 01ad08b..aa31383 100644 --- a/matlab/mex/astra_mex_matrix_c.cpp +++ b/matlab/mex/astra_mex_matrix_c.cpp @@ -32,6 +32,7 @@ $Id$ */ #include #include "mexHelpFunctions.h" +#include "mexInitFunctions.h" #include @@ -412,6 +413,8 @@ void mexFunction(int nlhs, mxArray* plhs[], return; } + initASTRAMex(); + // SWITCH (MODE) if (sMode == std::string("get")) { astra_mex_matrix_get(nlhs, plhs, nrhs, prhs); diff --git a/matlab/mex/astra_mex_projector3d_c.cpp b/matlab/mex/astra_mex_projector3d_c.cpp index 5381cf6..c3b547f 100644 --- a/matlab/mex/astra_mex_projector3d_c.cpp +++ b/matlab/mex/astra_mex_projector3d_c.cpp @@ -33,6 +33,7 @@ $Id$ #include #include "mexHelpFunctions.h" +#include "mexInitFunctions.h" #include "astra/Globals.h" @@ -403,6 +404,8 @@ void mexFunction(int nlhs, mxArray* plhs[], return; } + initASTRAMex(); + // SWITCH (MODE) if (sMode == "create") { astra_mex_projector3d_create(nlhs, plhs, nrhs, prhs); diff --git a/matlab/mex/astra_mex_projector_c.cpp b/matlab/mex/astra_mex_projector_c.cpp index 58cd953..204ba8e 100644 --- a/matlab/mex/astra_mex_projector_c.cpp +++ b/matlab/mex/astra_mex_projector_c.cpp @@ -34,6 +34,7 @@ $Id$ #include #include "mexHelpFunctions.h" +#include "mexInitFunctions.h" #include "astra/AstraObjectManager.h" #include "astra/Projector2D.h" @@ -476,6 +477,8 @@ void mexFunction(int nlhs, mxArray* plhs[], return; } + initASTRAMex(); + // SWITCH (MODE) if (sMode == "create") { astra_mex_projector_create(nlhs, plhs, nrhs, prhs); diff --git a/matlab/mex/mexInitFunctions.cpp b/matlab/mex/mexInitFunctions.cpp new file mode 100644 index 0000000..d8a50d7 --- /dev/null +++ b/matlab/mex/mexInitFunctions.cpp @@ -0,0 +1,24 @@ +#include +#include "astra/Logging.h" + +bool mexIsInitialized=false; + +/** + * Callback to print log message to Matlab window. + * + */ +void logCallBack(const char *msg, size_t len){ + mexPrintf(msg); +} + +/** + * Initialize mex functions. + * + */ +void initASTRAMex(){ + if(mexIsInitialized) return; + if(!astra::CLogger::setCallbackScreen(&logCallBack)){ + mexErrMsgTxt("Error initializing mex functions."); + } + mexIsInitialized=true; +} diff --git a/matlab/mex/mexInitFunctions.h b/matlab/mex/mexInitFunctions.h new file mode 100644 index 0000000..f16e9c9 --- /dev/null +++ b/matlab/mex/mexInitFunctions.h @@ -0,0 +1,6 @@ +#ifndef _INC_ASTRA_MEX_INITFUNCTIONS +#define _INC_ASTRA_MEX_INITFUNCTIONS + +void initASTRAMex(); + +#endif \ No newline at end of file -- cgit v1.2.3 From dc391ca18771ad2e2270aeeb1c0a5ee14319a38a Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 19 Mar 2015 17:47:12 +0100 Subject: Add MSVC project files --- matlab/mex/astra_mex_algorithm_vc09.vcproj | 8 + matlab/mex/astra_mex_algorithm_vc11.vcxproj | 2 + matlab/mex/astra_mex_data2d_vc09.vcproj | 8 + matlab/mex/astra_mex_data2d_vc11.vcxproj | 2 + matlab/mex/astra_mex_data3d_vc09.vcproj | 8 + matlab/mex/astra_mex_data3d_vc11.vcxproj | 2 + matlab/mex/astra_mex_log_vc09.vcproj | 612 ++++++++++++++++++++++++++ matlab/mex/astra_mex_log_vc11.vcxproj | 306 +++++++++++++ matlab/mex/astra_mex_matrix_vc09.vcproj | 8 + matlab/mex/astra_mex_matrix_vc11.vcxproj | 2 + matlab/mex/astra_mex_projector3d_vc09.vcproj | 8 + matlab/mex/astra_mex_projector3d_vc11.vcxproj | 2 + matlab/mex/astra_mex_projector_vc09.vcproj | 8 + matlab/mex/astra_mex_projector_vc11.vcxproj | 2 + matlab/mex/astra_mex_vc09.vcproj | 8 + matlab/mex/astra_mex_vc11.vcxproj | 2 + 16 files changed, 988 insertions(+) create mode 100644 matlab/mex/astra_mex_log_vc09.vcproj create mode 100644 matlab/mex/astra_mex_log_vc11.vcxproj (limited to 'matlab') diff --git a/matlab/mex/astra_mex_algorithm_vc09.vcproj b/matlab/mex/astra_mex_algorithm_vc09.vcproj index 40fcf62..d5cebc0 100644 --- a/matlab/mex/astra_mex_algorithm_vc09.vcproj +++ b/matlab/mex/astra_mex_algorithm_vc09.vcproj @@ -598,6 +598,14 @@ RelativePath=".\mexHelpFunctions.h" > + + + + diff --git a/matlab/mex/astra_mex_algorithm_vc11.vcxproj b/matlab/mex/astra_mex_algorithm_vc11.vcxproj index a297e6d..c133e26 100644 --- a/matlab/mex/astra_mex_algorithm_vc11.vcxproj +++ b/matlab/mex/astra_mex_algorithm_vc11.vcxproj @@ -294,9 +294,11 @@ + + diff --git a/matlab/mex/astra_mex_data2d_vc09.vcproj b/matlab/mex/astra_mex_data2d_vc09.vcproj index 5611ccc..2c8a63f 100644 --- a/matlab/mex/astra_mex_data2d_vc09.vcproj +++ b/matlab/mex/astra_mex_data2d_vc09.vcproj @@ -614,6 +614,14 @@ RelativePath=".\mexDataManagerHelpFunctions.h" > + + + + diff --git a/matlab/mex/astra_mex_data2d_vc11.vcxproj b/matlab/mex/astra_mex_data2d_vc11.vcxproj index 0ecc6ce..636780a 100644 --- a/matlab/mex/astra_mex_data2d_vc11.vcxproj +++ b/matlab/mex/astra_mex_data2d_vc11.vcxproj @@ -296,11 +296,13 @@ + + diff --git a/matlab/mex/astra_mex_data3d_vc09.vcproj b/matlab/mex/astra_mex_data3d_vc09.vcproj index 74a35f4..fd861a3 100644 --- a/matlab/mex/astra_mex_data3d_vc09.vcproj +++ b/matlab/mex/astra_mex_data3d_vc09.vcproj @@ -614,6 +614,14 @@ RelativePath=".\mexDataManagerHelpFunctions.h" > + + + + diff --git a/matlab/mex/astra_mex_data3d_vc11.vcxproj b/matlab/mex/astra_mex_data3d_vc11.vcxproj index 8ac6f7c..1c3c620 100644 --- a/matlab/mex/astra_mex_data3d_vc11.vcxproj +++ b/matlab/mex/astra_mex_data3d_vc11.vcxproj @@ -296,11 +296,13 @@ + + diff --git a/matlab/mex/astra_mex_log_vc09.vcproj b/matlab/mex/astra_mex_log_vc09.vcproj new file mode 100644 index 0000000..0e0d469 --- /dev/null +++ b/matlab/mex/astra_mex_log_vc09.vcproj @@ -0,0 +1,612 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/matlab/mex/astra_mex_log_vc11.vcxproj b/matlab/mex/astra_mex_log_vc11.vcxproj new file mode 100644 index 0000000..0a939cf --- /dev/null +++ b/matlab/mex/astra_mex_log_vc11.vcxproj @@ -0,0 +1,306 @@ + + + + + Debug_CUDA + Win32 + + + Debug_CUDA + x64 + + + Debug + Win32 + + + Debug + x64 + + + Release_CUDA + Win32 + + + Release_CUDA + x64 + + + Release + Win32 + + + Release + x64 + + + + astra_mex_log + {03B833F5-4FD6-4FBE-AAF4-E3305CD56D2E} + astraMatlab + + + + DynamicLibrary + v110 + + + DynamicLibrary + v110 + + + DynamicLibrary + v110 + + + DynamicLibrary + v110 + + + DynamicLibrary + v110 + + + DynamicLibrary + v110 + + + DynamicLibrary + v110 + + + DynamicLibrary + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>11.0.60610.1 + + + $(SolutionDir)bin\$(Platform)\$(Configuration)\ + $(OutDir)obj\$(ProjectName)\ + $(ProjectName)_c + .mexw32 + + + $(SolutionDir)bin\$(Platform)\$(Configuration)\ + $(OutDir)obj\$(ProjectName)\ + $(ProjectName)_c + .mexw64 + + + $(SolutionDir)bin\$(Platform)\$(Configuration)\ + $(OutDir)obj\$(ProjectName)\ + $(ProjectName)_c + .mexw32 + + + $(SolutionDir)bin\$(Platform)\$(Configuration)\ + $(OutDir)obj\$(ProjectName)\ + $(ProjectName)_c + .mexw64 + + + $(SolutionDir)bin\$(Platform)\$(Configuration)\ + $(OutDir)obj\$(ProjectName)\ + $(ProjectName)_c + .mexw32 + + + $(SolutionDir)bin\$(Platform)\$(Configuration)\ + $(OutDir)obj\$(ProjectName)\ + $(ProjectName)_c + .mexw64 + + + $(SolutionDir)bin\$(Platform)\$(Configuration)\ + $(OutDir)obj\$(ProjectName)\ + $(ProjectName)_c + .mexw32 + + + $(SolutionDir)bin\$(Platform)\$(Configuration)\ + $(OutDir)obj\$(ProjectName)\ + $(ProjectName)_c + .mexw64 + + + + MultiThreadedDebugDLL + $(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories) + true + StreamingSIMDExtensions2 + Disabled + ASTRA_CUDA;__SSE2__;%(PreprocessorDefinitions) + true + + + $(OutDir)$(ProjectName)_c.mexw32 + AstraCuda32D.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies) + ..\..\lib\win32\;..\..\bin\win32\Debug_CUDA;$(MATLAB_ROOT)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories) + mex.def + true + + + + + MultiThreadedDebugDLL + $(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories) + true + Disabled + ASTRA_CUDA;__SSE2__;%(PreprocessorDefinitions) + true + + + $(OutDir)$(ProjectName)_c.mexw64 + AstraCuda64D.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies) + ..\..\lib\x64\;..\..\bin\x64\Debug_CUDA;$(MATLAB_ROOT)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories) + mex.def + true + + + + + MultiThreadedDebugDLL + $(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories) + true + StreamingSIMDExtensions2 + Disabled + __SSE2__;%(PreprocessorDefinitions) + true + + + $(OutDir)$(ProjectName)_c.mexw32 + Astra32D.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies) + ..\..\lib\win32\;..\..\bin\win32\Debug;$(MATLAB_ROOT)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories) + mex.def + true + + + + + MultiThreadedDebugDLL + $(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories) + true + Disabled + __SSE2__;%(PreprocessorDefinitions) + true + + + $(OutDir)$(ProjectName)_c.mexw64 + Astra64D.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies) + ..\..\lib\x64\;..\..\bin\x64\Debug;$(MATLAB_ROOT)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories) + mex.def + true + + + + + MultiThreadedDLL + $(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories) + true + StreamingSIMDExtensions2 + MaxSpeed + ASTRA_CUDA;__SSE2__;%(PreprocessorDefinitions) + true + + + $(OutDir)$(ProjectName)_c.mexw32 + AstraCuda32.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies) + ..\..\lib\win32\;..\..\bin\win32\Release_CUDA;$(MATLAB_ROOT)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories) + mex.def + true + + + + + MultiThreadedDLL + $(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories) + true + MaxSpeed + ASTRA_CUDA;__SSE2__;%(PreprocessorDefinitions) + true + + + $(OutDir)$(ProjectName)_c.mexw64 + AstraCuda64.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies) + ..\..\lib\x64\;..\..\bin\x64\Release_CUDA;$(MATLAB_ROOT)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories) + mex.def + true + + + + + MultiThreadedDLL + $(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories) + true + StreamingSIMDExtensions2 + MaxSpeed + __SSE2__;%(PreprocessorDefinitions) + true + + + $(OutDir)$(ProjectName)_c.mexw32 + Astra32.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies) + ..\..\lib\win32\;..\..\bin\win32\Release;$(MATLAB_ROOT)\extern\lib\win32\microsoft;%(AdditionalLibraryDirectories) + mex.def + true + + + + + MultiThreadedDLL + $(MATLAB_ROOT)\extern\include\;$(CUDA_PATH)\include;..\..\lib\include;..\..\include;%(AdditionalIncludeDirectories) + true + MaxSpeed + __SSE2__;%(PreprocessorDefinitions) + true + + + $(OutDir)$(ProjectName)_c.mexw64 + Astra64.lib;libmex.lib;libmx.lib;libut.lib;%(AdditionalDependencies) + ..\..\lib\x64\;..\..\bin\x64\Release;$(MATLAB_ROOT)\extern\lib\win64\microsoft;%(AdditionalLibraryDirectories) + mex.def + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/matlab/mex/astra_mex_matrix_vc09.vcproj b/matlab/mex/astra_mex_matrix_vc09.vcproj index e4b57e9..3aa17a5 100644 --- a/matlab/mex/astra_mex_matrix_vc09.vcproj +++ b/matlab/mex/astra_mex_matrix_vc09.vcproj @@ -598,6 +598,14 @@ RelativePath=".\mexHelpFunctions.h" > + + + + diff --git a/matlab/mex/astra_mex_matrix_vc11.vcxproj b/matlab/mex/astra_mex_matrix_vc11.vcxproj index 91e32bd..abf86a7 100644 --- a/matlab/mex/astra_mex_matrix_vc11.vcxproj +++ b/matlab/mex/astra_mex_matrix_vc11.vcxproj @@ -294,9 +294,11 @@ + + diff --git a/matlab/mex/astra_mex_projector3d_vc09.vcproj b/matlab/mex/astra_mex_projector3d_vc09.vcproj index 09fa3c6..b9464a2 100644 --- a/matlab/mex/astra_mex_projector3d_vc09.vcproj +++ b/matlab/mex/astra_mex_projector3d_vc09.vcproj @@ -598,6 +598,14 @@ RelativePath=".\mexHelpFunctions.h" > + + + + diff --git a/matlab/mex/astra_mex_projector3d_vc11.vcxproj b/matlab/mex/astra_mex_projector3d_vc11.vcxproj index b8e8001..42eb0f1 100644 --- a/matlab/mex/astra_mex_projector3d_vc11.vcxproj +++ b/matlab/mex/astra_mex_projector3d_vc11.vcxproj @@ -294,9 +294,11 @@ + + diff --git a/matlab/mex/astra_mex_projector_vc09.vcproj b/matlab/mex/astra_mex_projector_vc09.vcproj index c0a5cd8..05c207f 100644 --- a/matlab/mex/astra_mex_projector_vc09.vcproj +++ b/matlab/mex/astra_mex_projector_vc09.vcproj @@ -598,6 +598,14 @@ RelativePath=".\mexHelpFunctions.h" > + + + + diff --git a/matlab/mex/astra_mex_projector_vc11.vcxproj b/matlab/mex/astra_mex_projector_vc11.vcxproj index 03a574d..e944949 100644 --- a/matlab/mex/astra_mex_projector_vc11.vcxproj +++ b/matlab/mex/astra_mex_projector_vc11.vcxproj @@ -294,9 +294,11 @@ + + diff --git a/matlab/mex/astra_mex_vc09.vcproj b/matlab/mex/astra_mex_vc09.vcproj index 9615f53..e4d7d07 100644 --- a/matlab/mex/astra_mex_vc09.vcproj +++ b/matlab/mex/astra_mex_vc09.vcproj @@ -598,6 +598,14 @@ RelativePath=".\mexHelpFunctions.h" > + + + + diff --git a/matlab/mex/astra_mex_vc11.vcxproj b/matlab/mex/astra_mex_vc11.vcxproj index 04df41c..f1324b4 100644 --- a/matlab/mex/astra_mex_vc11.vcxproj +++ b/matlab/mex/astra_mex_vc11.vcxproj @@ -294,9 +294,11 @@ + + -- cgit v1.2.3 From 2929e3eb5c398819163727d94981105f0c979f58 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 20 Mar 2015 14:00:10 +0100 Subject: Fix comment --- matlab/mex/astra_mex_log_c.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'matlab') diff --git a/matlab/mex/astra_mex_log_c.cpp b/matlab/mex/astra_mex_log_c.cpp index 79fe3d5..71b8234 100644 --- a/matlab/mex/astra_mex_log_c.cpp +++ b/matlab/mex/astra_mex_log_c.cpp @@ -26,9 +26,9 @@ along with the ASTRA Toolbox. If not, see . $Id$ */ -/** \file astra_mex_algorithm_c.cpp +/** \file astra_mex_log_c.cpp * - * \brief Creates and manages algorithms (reconstruction,projection,...). + * \brief Manages astra logging */ #include #include "mexHelpFunctions.h" -- cgit v1.2.3 From 10d35e96221675fc62299ba0cfdb0d731c9c7531 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 20 Mar 2015 14:03:44 +0100 Subject: Fix indentation --- matlab/mex/astra_mex_log_c.cpp | 184 ++++++++++++++++++++--------------------- 1 file changed, 92 insertions(+), 92 deletions(-) (limited to 'matlab') diff --git a/matlab/mex/astra_mex_log_c.cpp b/matlab/mex/astra_mex_log_c.cpp index 71b8234..ea4621e 100644 --- a/matlab/mex/astra_mex_log_c.cpp +++ b/matlab/mex/astra_mex_log_c.cpp @@ -52,10 +52,10 @@ void astra_mex_log_debug(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prh mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); return; } - 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()); + 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()); } //----------------------------------------------------------------------------------------- @@ -72,10 +72,10 @@ void astra_mex_log_info(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); return; } - 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()); + 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()); } //----------------------------------------------------------------------------------------- @@ -92,10 +92,10 @@ void astra_mex_log_warn(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); return; } - 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()); + 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()); } //----------------------------------------------------------------------------------------- @@ -112,10 +112,10 @@ void astra_mex_log_error(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prh mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); return; } - 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()); + 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()); } //----------------------------------------------------------------------------------------- @@ -130,15 +130,15 @@ void astra_mex_log_enable(int nlhs, mxArray* plhs[], int nrhs, const mxArray* pr mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); return; } - string sType = mexToString(prhs[1]); - if(sType == "all"){ - astra::CLogger::enable(); - }else if(sType == "file"){ - astra::CLogger::enableFile(); - }else if(sType == "screen"){ - astra::CLogger::enableScreen(); - } else { - mexErrMsgTxt("Specify which output to enable ('all', 'file', or 'screen')"); + string sType = mexToString(prhs[1]); + if(sType == "all"){ + astra::CLogger::enable(); + }else if(sType == "file"){ + astra::CLogger::enableFile(); + }else if(sType == "screen"){ + astra::CLogger::enableScreen(); + } else { + mexErrMsgTxt("Specify which output to enable ('all', 'file', or 'screen')"); } } @@ -154,15 +154,15 @@ void astra_mex_log_disable(int nlhs, mxArray* plhs[], int nrhs, const mxArray* p mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); return; } - string sType = mexToString(prhs[1]); - if(sType == "all"){ - astra::CLogger::disable(); - }else if(sType == "file"){ - astra::CLogger::disableFile(); - }else if(sType == "screen"){ - astra::CLogger::disableScreen(); - } else { - mexErrMsgTxt("Specify which output to disable ('all', 'file', or 'screen')"); + string sType = mexToString(prhs[1]); + if(sType == "all"){ + astra::CLogger::disable(); + }else if(sType == "file"){ + astra::CLogger::disableFile(); + }else if(sType == "screen"){ + astra::CLogger::disableScreen(); + } else { + mexErrMsgTxt("Specify which output to disable ('all', 'file', or 'screen')"); } } @@ -188,23 +188,23 @@ void astra_mex_log_format(int nlhs, mxArray* plhs[], int nrhs, const mxArray* pr mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); return; } - string sType = mexToString(prhs[1]); - string sFormat = mexToString(prhs[2]); - if (!sFormat.empty()) - { - char lastChar = *sFormat.rbegin(); - if (lastChar!='\n'){ - sFormat += '\n'; - } - }else{ - sFormat += '\n'; - } - if(sType == "file"){ - astra::CLogger::setFormatFile(sFormat.c_str()); - }else if(sType == "screen"){ - astra::CLogger::setFormatScreen(sFormat.c_str()); - } else { - mexErrMsgTxt("Specify which output to format ('file' or 'screen')"); + string sType = mexToString(prhs[1]); + string sFormat = mexToString(prhs[2]); + if (!sFormat.empty()) + { + char lastChar = *sFormat.rbegin(); + if (lastChar!='\n'){ + sFormat += '\n'; + } + }else{ + sFormat += '\n'; + } + if(sType == "file"){ + astra::CLogger::setFormatFile(sFormat.c_str()); + }else if(sType == "screen"){ + astra::CLogger::setFormatScreen(sFormat.c_str()); + } else { + mexErrMsgTxt("Specify which output to format ('file' or 'screen')"); } } @@ -224,35 +224,35 @@ void astra_mex_log_output(int nlhs, mxArray* plhs[], int nrhs, const mxArray* pr mexErrMsgTxt("Not enough arguments. See the help document for a detailed argument list. \n"); return; } - string sType = mexToString(prhs[1]); - string sOutput = mexToString(prhs[2]); - string sLevel = mexToString(prhs[3]); - log_level eLevel; - if(sLevel == "debug"){ - eLevel = LOG_DEBUG; - }else if(sLevel == "info"){ - eLevel = LOG_INFO; - }else if(sLevel == "warn"){ - eLevel = LOG_WARN; - }else if(sLevel == "error"){ - eLevel = LOG_ERROR; - }else{ - mexErrMsgTxt("Specify which log level to use ('debug', 'info', 'warn', or 'error')"); - } - if(sType == "file"){ - astra::CLogger::setOutputFile(sOutput.c_str(),eLevel); - }else if(sType == "screen"){ - int fd; - if(sOutput == "stdout"){ - fd=1; - }else if(sOutput == "stderr"){ - fd=2; - }else{ - mexErrMsgTxt("Specify which screen to output to ('stdout' or 'stderr')"); - } - astra::CLogger::setOutputScreen(fd,eLevel); - } else { - mexErrMsgTxt("Specify which output to set ('file' or 'screen')"); + string sType = mexToString(prhs[1]); + string sOutput = mexToString(prhs[2]); + string sLevel = mexToString(prhs[3]); + log_level eLevel; + if(sLevel == "debug"){ + eLevel = LOG_DEBUG; + }else if(sLevel == "info"){ + eLevel = LOG_INFO; + }else if(sLevel == "warn"){ + eLevel = LOG_WARN; + }else if(sLevel == "error"){ + eLevel = LOG_ERROR; + }else{ + mexErrMsgTxt("Specify which log level to use ('debug', 'info', 'warn', or 'error')"); + } + if(sType == "file"){ + astra::CLogger::setOutputFile(sOutput.c_str(),eLevel); + }else if(sType == "screen"){ + int fd; + if(sOutput == "stdout"){ + fd=1; + }else if(sOutput == "stderr"){ + fd=2; + }else{ + mexErrMsgTxt("Specify which screen to output to ('stdout' or 'stderr')"); + } + astra::CLogger::setOutputScreen(fd,eLevel); + } else { + mexErrMsgTxt("Specify which output to set ('file' or 'screen')"); } } @@ -286,18 +286,18 @@ void mexFunction(int nlhs, mxArray* plhs[], astra_mex_log_debug(nlhs, plhs, nrhs, prhs); }else if (sMode == "info") { astra_mex_log_info(nlhs, plhs, nrhs, prhs); - }else if (sMode == "warn") { - astra_mex_log_warn(nlhs, plhs, nrhs, prhs); - }else if (sMode == "error") { - astra_mex_log_error(nlhs, plhs, nrhs, prhs); - }else if (sMode == "enable") { - astra_mex_log_enable(nlhs, plhs, nrhs, prhs); - }else if (sMode == "disable") { - astra_mex_log_disable(nlhs, plhs, nrhs, prhs); - }else if (sMode == "format") { - astra_mex_log_format(nlhs, plhs, nrhs, prhs); - }else if (sMode == "output") { - astra_mex_log_output(nlhs, plhs, nrhs, prhs); + }else if (sMode == "warn") { + astra_mex_log_warn(nlhs, plhs, nrhs, prhs); + }else if (sMode == "error") { + astra_mex_log_error(nlhs, plhs, nrhs, prhs); + }else if (sMode == "enable") { + astra_mex_log_enable(nlhs, plhs, nrhs, prhs); + }else if (sMode == "disable") { + astra_mex_log_disable(nlhs, plhs, nrhs, prhs); + }else if (sMode == "format") { + astra_mex_log_format(nlhs, plhs, nrhs, prhs); + }else if (sMode == "output") { + astra_mex_log_output(nlhs, plhs, nrhs, prhs); } else { printHelp(); } -- cgit v1.2.3