diff options
author | Wim van Aarle <wimvanaarle@gmail.com> | 2015-02-26 16:11:38 +0100 |
---|---|---|
committer | Wim van Aarle <wimvanaarle@gmail.com> | 2015-02-26 16:11:38 +0100 |
commit | 169e912d2633cda7ffc234e78afba1b096e122ea (patch) | |
tree | b9dc0bdbf200056abb942e0be2840640a470b896 /matlab/mex/mexDataManagerHelpFunctions.cpp | |
parent | 2d11dcfc8d85cd562a36c192f5dda64c8378d160 (diff) | |
download | astra-169e912d2633cda7ffc234e78afba1b096e122ea.tar.gz astra-169e912d2633cda7ffc234e78afba1b096e122ea.tar.bz2 astra-169e912d2633cda7ffc234e78afba1b096e122ea.tar.xz astra-169e912d2633cda7ffc234e78afba1b096e122ea.zip |
code cleanup
Diffstat (limited to 'matlab/mex/mexDataManagerHelpFunctions.cpp')
-rw-r--r-- | matlab/mex/mexDataManagerHelpFunctions.cpp | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/matlab/mex/mexDataManagerHelpFunctions.cpp b/matlab/mex/mexDataManagerHelpFunctions.cpp index f9d971c..d482428 100644 --- a/matlab/mex/mexDataManagerHelpFunctions.cpp +++ b/matlab/mex/mexDataManagerHelpFunctions.cpp @@ -105,7 +105,7 @@ checkID(const astra::int32 & id, astra::CFloat32Data3DMemory *& pDataObj) bool checkDataType(const mxArray * const in) { - return (mex_is_scalar(in) || mxIsDouble(in) || mxIsSingle(in) || mxIsLogical(in)); + return (mexIsScalar(in) || mxIsDouble(in) || mxIsSingle(in) || mxIsLogical(in)); } //----------------------------------------------------------------------------------------- @@ -213,7 +213,7 @@ allocateDataObject(const std::string & sDataType, bool bUnshare = true; if (unshare) { - if (!mex_is_scalar(unshare)) + if (!mexIsScalar(unshare)) { mexErrMsgTxt("Argument 5 (read-only) must be scalar"); return NULL; @@ -225,7 +225,7 @@ allocateDataObject(const std::string & sDataType, mwIndex iZ = 0; if (zIndex) { - if (!mex_is_scalar(zIndex)) + if (!mexIsScalar(zIndex)) { mexErrMsgTxt("Argument 6 (Z) must be scalar"); return NULL; @@ -237,25 +237,19 @@ allocateDataObject(const std::string & sDataType, if (sDataType == "-vol") { // Read geometry - astra::XMLDocument* xml = struct2XML("VolumeGeometry", geometry); - if (!xml) { - return NULL; - } - astra::Config cfg; - cfg.self = xml->getRootNode(); - + astra::Config* cfg = structToConfig("VolumeGeometry3D", geometry); astra::CVolumeGeometry3D* pGeometry = new astra::CVolumeGeometry3D(); - if (!pGeometry->initialize(cfg)) + if (!pGeometry->initialize(*cfg)) { mexErrMsgTxt("Geometry class not initialized. \n"); delete pGeometry; - delete xml; + delete cfg; return NULL; } - delete xml; + delete cfg; // If data is specified, check dimensions - if (data && !mex_is_scalar(data)) + if (data && !mexIsScalar(data)) { if (! (zIndex ? checkDataSize(data, pGeometry, iZ) @@ -288,16 +282,10 @@ allocateDataObject(const std::string & sDataType, else if (sDataType == "-sino" || sDataType == "-proj3d" || sDataType == "-sinocone") { // Read geometry - astra::XMLDocument* xml = struct2XML("ProjectionGeometry", geometry); - if (!xml) { - return NULL; - } - astra::Config cfg; - cfg.self = xml->getRootNode(); - + astra::Config* cfg = structToConfig("ProjectionGeometry3D", geometry); // FIXME: Change how the base class is created. (This is duplicated // in Projector3D.cpp.) - std::string type = cfg.self->getAttribute("type"); + std::string type = cfg->self->getAttribute("type"); astra::CProjectionGeometry3D* pGeometry = 0; if (type == "parallel3d") { pGeometry = new astra::CParallelProjectionGeometry3D(); @@ -312,16 +300,16 @@ allocateDataObject(const std::string & sDataType, return NULL; } - if (!pGeometry->initialize(cfg)) { + if (!pGeometry->initialize(*cfg)) { mexErrMsgTxt("Geometry class not initialized. \n"); delete pGeometry; - delete xml; + delete cfg; return NULL; } - delete xml; + delete cfg; // If data is specified, check dimensions - if (data && !mex_is_scalar(data)) + if (data && !mexIsScalar(data)) { if (! (zIndex ? checkDataSize(data, pGeometry, iZ) |