From ef47dca509c1c26c5037b9b9024a6a84a3b7fe0b Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Sat, 20 Jun 2015 00:31:15 +0200 Subject: Fix wrong module name in documentation --- python/docSRC/operator.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/docSRC/operator.rst b/python/docSRC/operator.rst index f5369fa..65a5a99 100644 --- a/python/docSRC/operator.rst +++ b/python/docSRC/operator.rst @@ -1,7 +1,7 @@ OpTomo class: the :mod:`operator` module ============================================== -.. automodule:: astra.operator +.. automodule:: astra.optomo :members: :undoc-members: :show-inheritance: -- cgit v1.2.3 From ba3629c6c1bc1d03ccdc6ef2aeae6872ea59559f Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Sat, 20 Jun 2015 00:33:23 +0200 Subject: Fix matlab compilation without CUDA --- matlab/mex/astra_mex_c.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/matlab/mex/astra_mex_c.cpp b/matlab/mex/astra_mex_c.cpp index 4a331f5..a9b9654 100644 --- a/matlab/mex/astra_mex_c.cpp +++ b/matlab/mex/astra_mex_c.cpp @@ -36,9 +36,9 @@ $Id$ #include "mexInitFunctions.h" #include "astra/Globals.h" - +#ifdef ASTRA_CUDA #include "../cuda/2d/darthelper.h" - +#endif using namespace std; using namespace astra; -- cgit v1.2.3 From f6b6a2f84806a89fe6bacc583e13cb14629fb5dc Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Sat, 20 Jun 2015 00:35:16 +0200 Subject: Actually use the rec_type argument in astra_create_reconstruction_cuda --- matlab/tools/astra_create_reconstruction_cuda.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.2.3 From d931a89a97c599d5530f7ce0f83fc0d513842023 Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Sat, 20 Jun 2015 00:41:45 +0200 Subject: Add a .gitignore to ignore build files --- .gitignore | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ddfb628 --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +python/build/* +python/finalbuild/* +python/astra/*.pyc +python/astra/*.cpp +python/astra/*.c +python/astra/config.pxi + +build/linux/.libs/* +build/linux/Makefile +build/linux/aclocal.m4 +build/linux/autom4te.cache/* +build/linux/config.guess +build/linux/config.log +build/linux/config.status +build/linux/config.sub +build/linux/configure +build/linux/cuda/* +build/linux/install-sh +build/linux/libastra.la +build/linux/libtool +build/linux/ltmain.sh +build/linux/src/* +build/linux/matlab/* -- cgit v1.2.3 From 26198f7e1fbed9d294fc2856f796f408c85b66f3 Mon Sep 17 00:00:00 2001 From: Valerii Sokolov Date: Tue, 9 Jun 2015 11:26:42 +0200 Subject: Don't take address of temporary. --- python/astra/utils.pyx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/astra/utils.pyx b/python/astra/utils.pyx index ddb37aa..a8e9e4e 100644 --- a/python/astra/utils.pyx +++ b/python/astra/utils.pyx @@ -95,7 +95,8 @@ cdef void readDict(XMLNode root, _dc): if val.size == 0: break listbase = root.addChildNode(item) - data = np.PyArray_DATA(np.ascontiguousarray(val,dtype=np.float64)) + contig_data = np.ascontiguousarray(val,dtype=np.float64) + data = np.PyArray_DATA(contig_data) if val.ndim == 2: listbase.setContent(data, val.shape[1], val.shape[0], False) elif val.ndim == 1: @@ -129,7 +130,8 @@ cdef void readOptions(XMLNode node, dc): break listbase = node.addChildNode(six.b('Option')) listbase.addAttribute(< string > six.b('key'), < string > item) - data = np.PyArray_DATA(np.ascontiguousarray(val,dtype=np.float64)) + contig_data = np.ascontiguousarray(val,dtype=np.float64) + data = np.PyArray_DATA(contig_data) if val.ndim == 2: listbase.setContent(data, val.shape[1], val.shape[0], False) elif val.ndim == 1: -- cgit v1.2.3 From a9ea08c4a11592378b320cac45be8eede8addd6f Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Mon, 22 Jun 2015 17:54:23 +0200 Subject: Additional module name fix in documentation --- python/docSRC/operator.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/docSRC/operator.rst b/python/docSRC/operator.rst index 65a5a99..fe500ba 100644 --- a/python/docSRC/operator.rst +++ b/python/docSRC/operator.rst @@ -1,4 +1,4 @@ -OpTomo class: the :mod:`operator` module +OpTomo class: the :mod:`optomo` module ============================================== .. automodule:: astra.optomo -- cgit v1.2.3 From 8ad46dc9cb28067047838e06770707cf86ef6e56 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 23 Jun 2015 11:13:08 +0200 Subject: Add some common temporary file patterns to .gitignore. Also add leading slashes to full paths for consistency. --- .gitignore | 52 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index ddfb628..ec0eafb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,31 @@ -python/build/* -python/finalbuild/* -python/astra/*.pyc -python/astra/*.cpp -python/astra/*.c -python/astra/config.pxi +.*.swp +.*.swo +*~ +*.orig +*.rej +.nfs* -build/linux/.libs/* -build/linux/Makefile -build/linux/aclocal.m4 -build/linux/autom4te.cache/* -build/linux/config.guess -build/linux/config.log -build/linux/config.status -build/linux/config.sub -build/linux/configure -build/linux/cuda/* -build/linux/install-sh -build/linux/libastra.la -build/linux/libtool -build/linux/ltmain.sh -build/linux/src/* -build/linux/matlab/* +/python/build/* +/python/finalbuild/* +/python/dist/* +/python/astra/*.pyc +/python/astra/*.cpp +/python/astra/*.c +/python/astra/config.pxi + +/build/linux/.libs/* +/build/linux/Makefile +/build/linux/aclocal.m4 +/build/linux/autom4te.cache/* +/build/linux/config.guess +/build/linux/config.log +/build/linux/config.status +/build/linux/config.sub +/build/linux/configure +/build/linux/cuda/* +/build/linux/install-sh +/build/linux/libastra.la +/build/linux/libtool +/build/linux/ltmain.sh +/build/linux/src/* +/build/linux/matlab/* -- cgit v1.2.3 From 63d78fbaafa7d247347f9052db86f575d89260b7 Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Wed, 24 Jun 2015 20:28:46 +0200 Subject: Fix config to struct/dict translation for array options --- matlab/mex/mexHelpFunctions.cpp | 6 +++++- python/astra/utils.pyx | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/matlab/mex/mexHelpFunctions.cpp b/matlab/mex/mexHelpFunctions.cpp index 87a9672..58e84d2 100644 --- a/matlab/mex/mexHelpFunctions.cpp +++ b/matlab/mex/mexHelpFunctions.cpp @@ -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 diff --git a/python/astra/utils.pyx b/python/astra/utils.pyx index a8e9e4e..260c308 100644 --- a/python/astra/utils.pyx +++ b/python/astra/utils.pyx @@ -204,7 +204,10 @@ cdef XMLNode2dict(XMLNode node): while it != nodes.end(): subnode = deref(it) if castString(subnode.getName())=="Option": - opts[castString(subnode.getAttribute('key'))] = stringToPythonValue(subnode.getAttribute('value')) + if subnode.hasAttribute('value'): + opts[castString(subnode.getAttribute('key'))] = stringToPythonValue(subnode.getAttribute('value')) + else: + opts[castString(subnode.getAttribute('key'))] = stringToPythonValue(subnode.getContent()) else: dct[castString(subnode.getName())] = stringToPythonValue(subnode.getContent()) inc(it) -- cgit v1.2.3 From 26713deae284d6bb793b728c7af2db28a7484054 Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Wed, 24 Jun 2015 20:30:52 +0200 Subject: Include ExtraDetectorOffset in returned configuration --- src/ParallelProjectionGeometry2D.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ParallelProjectionGeometry2D.cpp b/src/ParallelProjectionGeometry2D.cpp index 699e141..5f51d08 100644 --- a/src/ParallelProjectionGeometry2D.cpp +++ b/src/ParallelProjectionGeometry2D.cpp @@ -180,6 +180,9 @@ Config* CParallelProjectionGeometry2D::getConfiguration() const cfg->self.addChildNode("DetectorCount", getDetectorCount()); cfg->self.addChildNode("DetectorWidth", getDetectorWidth()); cfg->self.addChildNode("ProjectionAngles", m_pfProjectionAngles, m_iProjectionAngleCount); + XMLNode opt = cfg->self.addChildNode("Option"); + opt.addAttribute("key","ExtraDetectorOffset"); + opt.setContent(m_pfExtraDetectorOffset, m_iProjectionAngleCount); return cfg; } //---------------------------------------------------------------------------------------- -- cgit v1.2.3 From f1a8bd8d2b62b089a90fef55268e3300581717ed Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Thu, 25 Jun 2015 21:38:46 +0200 Subject: Add extra null check for ExtraDetectorOffset --- src/ParallelProjectionGeometry2D.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ParallelProjectionGeometry2D.cpp b/src/ParallelProjectionGeometry2D.cpp index 5f51d08..7260b83 100644 --- a/src/ParallelProjectionGeometry2D.cpp +++ b/src/ParallelProjectionGeometry2D.cpp @@ -180,9 +180,11 @@ Config* CParallelProjectionGeometry2D::getConfiguration() const cfg->self.addChildNode("DetectorCount", getDetectorCount()); cfg->self.addChildNode("DetectorWidth", getDetectorWidth()); cfg->self.addChildNode("ProjectionAngles", m_pfProjectionAngles, m_iProjectionAngleCount); - XMLNode opt = cfg->self.addChildNode("Option"); - opt.addAttribute("key","ExtraDetectorOffset"); - opt.setContent(m_pfExtraDetectorOffset, m_iProjectionAngleCount); + if(m_pfExtraDetectorOffset!=NULL){ + XMLNode opt = cfg->self.addChildNode("Option"); + opt.addAttribute("key","ExtraDetectorOffset"); + opt.setContent(m_pfExtraDetectorOffset, m_iProjectionAngleCount); + } return cfg; } //---------------------------------------------------------------------------------------- -- cgit v1.2.3 From 9e3472ea9041b8755050427d8bdb8a4701019c55 Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Thu, 25 Jun 2015 21:52:07 +0200 Subject: Fix memory leak in configuration code --- matlab/mex/astra_mex_projector3d_c.cpp | 8 ++++++-- matlab/mex/astra_mex_projector_c.cpp | 9 ++++++--- python/astra/projector3d_c.pyx | 10 ++++++++-- python/astra/projector_c.pyx | 10 ++++++++-- 4 files changed, 28 insertions(+), 9 deletions(-) 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/python/astra/projector3d_c.pyx b/python/astra/projector3d_c.pyx index 8b978d7..aec9cde 100644 --- a/python/astra/projector3d_c.pyx +++ b/python/astra/projector3d_c.pyx @@ -87,12 +87,18 @@ cdef CProjector3D * getObject(i) except NULL: def projection_geometry(i): cdef CProjector3D * proj = getObject(i) - return utils.configToDict(proj.getProjectionGeometry().getConfiguration()) + cdef Config * cfg = proj.getProjectionGeometry().getConfiguration() + dct = utils.configToDict(cfg) + del cfg + return dct def volume_geometry(i): cdef CProjector3D * proj = getObject(i) - return utils.configToDict(proj.getVolumeGeometry().getConfiguration()) + cdef Config * cfg = proj.getVolumeGeometry().getConfiguration() + dct = utils.configToDict(cfg) + del cfg + return dct def weights_single_ray(i, projection_index, detector_index): diff --git a/python/astra/projector_c.pyx b/python/astra/projector_c.pyx index 9aa868e..77c64a4 100644 --- a/python/astra/projector_c.pyx +++ b/python/astra/projector_c.pyx @@ -91,12 +91,18 @@ cdef CProjector2D * getObject(i) except NULL: def projection_geometry(i): cdef CProjector2D * proj = getObject(i) - return utils.configToDict(proj.getProjectionGeometry().getConfiguration()) + cdef Config * cfg = proj.getProjectionGeometry().getConfiguration() + dct = utils.configToDict(cfg) + del cfg + return dct def volume_geometry(i): cdef CProjector2D * proj = getObject(i) - return utils.configToDict(proj.getVolumeGeometry().getConfiguration()) + cdef Config * cfg = proj.getVolumeGeometry().getConfiguration() + dct = utils.configToDict(cfg) + del cfg + return dct def weights_single_ray(i, projection_index, detector_index): -- cgit v1.2.3