From 3f5e4b145c22d2dd512d584cd71bd4ae60c08a49 Mon Sep 17 00:00:00 2001 From: Wim van Aarle Date: Tue, 24 Feb 2015 14:54:11 +0100 Subject: added get_geometry for 3d volume objects --- matlab/mex/mexHelpFunctions.cpp | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) (limited to 'matlab/mex/mexHelpFunctions.cpp') diff --git a/matlab/mex/mexHelpFunctions.cpp b/matlab/mex/mexHelpFunctions.cpp index e919dd9..9b65e77 100644 --- a/matlab/mex/mexHelpFunctions.cpp +++ b/matlab/mex/mexHelpFunctions.cpp @@ -331,28 +331,47 @@ astra::CVolumeGeometry2D* parseVolumeGeometryStruct(const mxArray* prhs) } //----------------------------------------------------------------------------------------- -// create reconstruction geometry data -mxArray* createVolumeGeometryStruct(astra::CVolumeGeometry2D* _pReconGeom) +// create 2D volume geometry struct +mxArray* createVolumeGeometryStruct(astra::CVolumeGeometry2D* _pVolGeom) { - // temporary map to store the data for the MATLAB struct std::map mGeometryInfo; - // fill up map - mGeometryInfo["GridColCount"] = mxCreateDoubleScalar(_pReconGeom->getGridColCount()); - mGeometryInfo["GridRowCount"] = mxCreateDoubleScalar(_pReconGeom->getGridRowCount()); + mGeometryInfo["GridColCount"] = mxCreateDoubleScalar(_pVolGeom->getGridColCount()); + mGeometryInfo["GridRowCount"] = mxCreateDoubleScalar(_pVolGeom->getGridRowCount()); std::map mGeometryOptions; - mGeometryOptions["WindowMinX"] = mxCreateDoubleScalar(_pReconGeom->getWindowMinX()); - mGeometryOptions["WindowMaxX"] = mxCreateDoubleScalar(_pReconGeom->getWindowMaxX()); - mGeometryOptions["WindowMinY"] = mxCreateDoubleScalar(_pReconGeom->getWindowMinY()); - mGeometryOptions["WindowMaxY"] = mxCreateDoubleScalar(_pReconGeom->getWindowMaxY()); + mGeometryOptions["WindowMinX"] = mxCreateDoubleScalar(_pVolGeom->getWindowMinX()); + mGeometryOptions["WindowMaxX"] = mxCreateDoubleScalar(_pVolGeom->getWindowMaxX()); + mGeometryOptions["WindowMinY"] = mxCreateDoubleScalar(_pVolGeom->getWindowMinY()); + mGeometryOptions["WindowMaxY"] = mxCreateDoubleScalar(_pVolGeom->getWindowMaxY()); mGeometryInfo["option"] = buildStruct(mGeometryOptions); - // build and return the MATLAB struct return buildStruct(mGeometryInfo); } +//----------------------------------------------------------------------------------------- +// create 3D volume geometry struct +mxArray* createVolumeGeometryStruct(astra::CVolumeGeometry3D* _pVolGeom) +{ + std::map mGeometryInfo; + + mGeometryInfo["GridColCount"] = mxCreateDoubleScalar(_pVolGeom->getGridColCount()); + mGeometryInfo["GridRowCount"] = mxCreateDoubleScalar(_pVolGeom->getGridRowCount()); + mGeometryInfo["GridSliceCount"] = mxCreateDoubleScalar(_pVolGeom->getGridRowCount()); + + std::map mGeometryOptions; + mGeometryOptions["WindowMinX"] = mxCreateDoubleScalar(_pVolGeom->getWindowMinX()); + mGeometryOptions["WindowMaxX"] = mxCreateDoubleScalar(_pVolGeom->getWindowMaxX()); + mGeometryOptions["WindowMinY"] = mxCreateDoubleScalar(_pVolGeom->getWindowMinY()); + mGeometryOptions["WindowMaxY"] = mxCreateDoubleScalar(_pVolGeom->getWindowMaxY()); + mGeometryOptions["WindowMinZ"] = mxCreateDoubleScalar(_pVolGeom->getWindowMinZ()); + mGeometryOptions["WindowMaxZ"] = mxCreateDoubleScalar(_pVolGeom->getWindowMaxZ()); + + mGeometryInfo["option"] = buildStruct(mGeometryOptions); + + return buildStruct(mGeometryInfo); +} //----------------------------------------------------------------------------------------- string matlab2string(const mxArray* pField) -- cgit v1.2.3