From ed24fb72a0f506a02a1e4a9df8e63ce62f36efef Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 22 Nov 2017 17:07:17 +0100 Subject: Update version to 1.9.0dev --- build/linux/configure.ac | 2 +- include/astra/Globals.h | 4 ++-- python/astra/__init__.py | 2 +- python/builder.py | 2 +- python/conda/astra-toolbox/meta.yaml | 4 ++-- python/conda/libastra/meta.yaml | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build/linux/configure.ac b/build/linux/configure.ac index 0091388..7959792 100644 --- a/build/linux/configure.ac +++ b/build/linux/configure.ac @@ -23,7 +23,7 @@ dnl along with the ASTRA Toolbox. If not, see . dnl dnl ----------------------------------------------------------------------- -AC_INIT(astra, 1.8.3) +AC_INIT(astra, 1.9.0dev) AC_CONFIG_SRCDIR([Makefile.in]) LT_INIT([disable-static]) diff --git a/include/astra/Globals.h b/include/astra/Globals.h index f447fd8..128422c 100644 --- a/include/astra/Globals.h +++ b/include/astra/Globals.h @@ -58,9 +58,9 @@ along with the ASTRA Toolbox. If not, see . // macro's #define ASTRA_TOOLBOXVERSION_MAJOR 1 -#define ASTRA_TOOLBOXVERSION_MINOR 8 +#define ASTRA_TOOLBOXVERSION_MINOR 9 #define ASTRA_TOOLBOXVERSION ((ASTRA_TOOLBOXVERSION_MAJOR)*100 + (ASTRA_TOOLBOXVERSION_MINOR)) -#define ASTRA_TOOLBOXVERSION_STRING "1.8.3" +#define ASTRA_TOOLBOXVERSION_STRING "1.9.0dev" #define ASTRA_ASSERT(a) assert(a) diff --git a/python/astra/__init__.py b/python/astra/__init__.py index 5e52a1c..4675229 100644 --- a/python/astra/__init__.py +++ b/python/astra/__init__.py @@ -41,7 +41,7 @@ from . import log from .optomo import OpTomo from .tests import test_noCUDA, test_CUDA -__version__ = '1.8.3' +__version__ = '1.9.0dev' import os diff --git a/python/builder.py b/python/builder.py index 01f4203..310f3c3 100644 --- a/python/builder.py +++ b/python/builder.py @@ -71,7 +71,7 @@ for m in ext_modules: 'PythonPluginAlgorithm.cpp')) setup(name='astra-toolbox', - version='1.8.3', + version='1.9.0dev', description='Python interface to the ASTRA Toolbox', author='D.M. Pelt', author_email='D.M.Pelt@cwi.nl', diff --git a/python/conda/astra-toolbox/meta.yaml b/python/conda/astra-toolbox/meta.yaml index 88a9172..7331e0f 100644 --- a/python/conda/astra-toolbox/meta.yaml +++ b/python/conda/astra-toolbox/meta.yaml @@ -1,10 +1,10 @@ package: name: astra-toolbox - version: '1.8.3' + version: '1.9.0dev' source: git_url: https://github.com/astra-toolbox/astra-toolbox.git - git_tag: v1.8.3 + git_tag: master build: number: 0 diff --git a/python/conda/libastra/meta.yaml b/python/conda/libastra/meta.yaml index e4622b7..2135376 100644 --- a/python/conda/libastra/meta.yaml +++ b/python/conda/libastra/meta.yaml @@ -1,10 +1,10 @@ package: name: libastra - version: '1.8.3' + version: '1.9.0dev' source: git_url: https://github.com/astra-toolbox/astra-toolbox.git - git_tag: v1.8.3 + git_tag: master build: number: 0 -- cgit v1.2.3 From 845b398d9e2e078d7cb2a1da84fadceca66306a2 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 3 Oct 2017 14:52:24 +0200 Subject: Add experimental accumulate_FP/BP/FDK python functions --- include/astra/CompositeGeometryManager.h | 18 +++++++------ python/astra/experimental.pyx | 45 ++++++++++++++++++++++++++------ src/CompositeGeometryManager.cpp | 36 +++++++++++++------------ 3 files changed, 66 insertions(+), 33 deletions(-) diff --git a/include/astra/CompositeGeometryManager.h b/include/astra/CompositeGeometryManager.h index 08eb7af..35d1da2 100644 --- a/include/astra/CompositeGeometryManager.h +++ b/include/astra/CompositeGeometryManager.h @@ -140,7 +140,7 @@ public: enum { JOB_FP, JOB_BP, JOB_FDK, JOB_NOP } eType; - enum { + enum EMode { MODE_ADD, MODE_SET } eMode; @@ -154,22 +154,24 @@ public: SJob createJobFP(CProjector3D *pProjector, CFloat32VolumeData3D *pVolData, - CFloat32ProjectionData3D *pProjData); + CFloat32ProjectionData3D *pProjData, + SJob::EMode eMode); SJob createJobBP(CProjector3D *pProjector, CFloat32VolumeData3D *pVolData, - CFloat32ProjectionData3D *pProjData); + CFloat32ProjectionData3D *pProjData, + SJob::EMode eMode); // Convenience functions for creating and running a single FP or BP job bool doFP(CProjector3D *pProjector, CFloat32VolumeData3D *pVolData, - CFloat32ProjectionData3D *pProjData); + CFloat32ProjectionData3D *pProjData, SJob::EMode eMode = SJob::MODE_SET); bool doBP(CProjector3D *pProjector, CFloat32VolumeData3D *pVolData, - CFloat32ProjectionData3D *pProjData); + CFloat32ProjectionData3D *pProjData, SJob::EMode eMode = SJob::MODE_SET); bool doFDK(CProjector3D *pProjector, CFloat32VolumeData3D *pVolData, CFloat32ProjectionData3D *pProjData, bool bShortScan, - const float *pfFilter = 0); + const float *pfFilter = 0, SJob::EMode eMode = SJob::MODE_SET); - bool doFP(CProjector3D *pProjector, const std::vector& volData, const std::vector& projData); - bool doBP(CProjector3D *pProjector, const std::vector& volData, const std::vector& projData); + bool doFP(CProjector3D *pProjector, const std::vector& volData, const std::vector& projData, SJob::EMode eMode = SJob::MODE_SET); + bool doBP(CProjector3D *pProjector, const std::vector& volData, const std::vector& projData, SJob::EMode eMode = SJob::MODE_SET); void setGPUIndices(const std::vector& GPUIndices); diff --git a/python/astra/experimental.pyx b/python/astra/experimental.pyx index 136165b..80dae9a 100644 --- a/python/astra/experimental.pyx +++ b/python/astra/experimental.pyx @@ -34,10 +34,15 @@ IF HAVE_CUDA==True: from .PyIncludes cimport * from libcpp.vector cimport vector + cdef extern from "astra/CompositeGeometryManager.h" namespace "astra::CCompositeGeometryManager::SJob": + cdef enum EMode: + MODE_SET = 0 + MODE_ADD = 1 cdef extern from "astra/CompositeGeometryManager.h" namespace "astra": cdef cppclass CCompositeGeometryManager: - bool doFP(CProjector3D *, vector[CFloat32VolumeData3D *], vector[CFloat32ProjectionData3D *]) - bool doBP(CProjector3D *, vector[CFloat32VolumeData3D *], vector[CFloat32ProjectionData3D *]) + bool doFP(CProjector3D *, vector[CFloat32VolumeData3D *], vector[CFloat32ProjectionData3D *], EMode) + bool doBP(CProjector3D *, vector[CFloat32VolumeData3D *], vector[CFloat32ProjectionData3D *], EMode) + bool doFDK(CProjector3D *, CFloat32VolumeData3D *, CFloat32ProjectionData3D *, bool, const float*, EMode) cdef extern from *: CFloat32VolumeData3D * dynamic_cast_vol_mem "dynamic_cast" (CFloat32Data3D * ) @@ -59,7 +64,7 @@ IF HAVE_CUDA==True: cdef CProjector3DManager * manProj = PyProjector3DManager.getSingletonPtr() cdef CData3DManager * man3d = PyData3DManager.getSingletonPtr() - def do_composite(projector_id, vol_ids, proj_ids, t): + def do_composite(projector_id, vol_ids, proj_ids, mode, t): cdef vector[CFloat32VolumeData3D *] vol cdef CFloat32VolumeData3D * pVolObject cdef CFloat32ProjectionData3D * pProjObject @@ -81,14 +86,38 @@ IF HAVE_CUDA==True: cdef CCompositeGeometryManager m cdef CProjector3D * projector = manProj.get(projector_id) # may be NULL if t == "FP": - if not m.doFP(projector, vol, proj): + if not m.doFP(projector, vol, proj, mode): raise Exception("Failed to perform FP") - else: - if not m.doBP(projector, vol, proj): + elif t == "BP": + if not m.doBP(projector, vol, proj, mode): raise Exception("Failed to perform BP") + else: + raise RuntimeError("internal error: wrong composite op type") def do_composite_FP(projector_id, vol_ids, proj_ids): - do_composite(projector_id, vol_ids, proj_ids, "FP") + do_composite(projector_id, vol_ids, proj_ids, MODE_SET, "FP") def do_composite_BP(projector_id, vol_ids, proj_ids): - do_composite(projector_id, vol_ids, proj_ids, "BP") + do_composite(projector_id, vol_ids, proj_ids, MODE_SET, "BP") + + def accumulate_FP(projector_id, vol_id, proj_id): + do_composite(projector_id, [vol_id], [proj_id], MODE_ADD, "FP") + def accumulate_BP(projector_id, vol_id, proj_id): + do_composite(projector_id, [vol_id], [proj_id], MODE_ADD, "BP") + def accumulate_FDK(projector_id, vol_id, proj_id): + cdef CFloat32VolumeData3D * pVolObject + cdef CFloat32ProjectionData3D * pProjObject + pVolObject = dynamic_cast_vol_mem(man3d.get(vol_id)) + if pVolObject == NULL: + raise Exception("Data object not found") + if not pVolObject.isInitialized(): + raise Exception("Data object not initialized properly") + pProjObject = dynamic_cast_proj_mem(man3d.get(proj_id)) + if pProjObject == NULL: + raise Exception("Data object not found") + if not pProjObject.isInitialized(): + raise Exception("Data object not initialized properly") + cdef CCompositeGeometryManager m + cdef CProjector3D * projector = manProj.get(projector_id) # may be NULL + if not m.doFDK(projector, pVolObject, pProjObject, False, NULL, MODE_ADD): + raise Exception("Failed to perform FDK") diff --git a/src/CompositeGeometryManager.cpp b/src/CompositeGeometryManager.cpp index 184144c..470476e 100644 --- a/src/CompositeGeometryManager.cpp +++ b/src/CompositeGeometryManager.cpp @@ -1115,7 +1115,8 @@ CCompositeGeometryManager::CProjectionPart* CCompositeGeometryManager::CProjecti CCompositeGeometryManager::SJob CCompositeGeometryManager::createJobFP(CProjector3D *pProjector, CFloat32VolumeData3D *pVolData, - CFloat32ProjectionData3D *pProjData) + CFloat32ProjectionData3D *pProjData, + SJob::EMode eMode) { ASTRA_DEBUG("CCompositeGeometryManager::createJobFP"); // Create single job for FP @@ -1141,14 +1142,15 @@ CCompositeGeometryManager::SJob CCompositeGeometryManager::createJobFP(CProjecto FP.pOutput = boost::shared_ptr(output); FP.pProjector = pProjector; FP.eType = SJob::JOB_FP; - FP.eMode = SJob::MODE_SET; + FP.eMode = eMode; return FP; } CCompositeGeometryManager::SJob CCompositeGeometryManager::createJobBP(CProjector3D *pProjector, CFloat32VolumeData3D *pVolData, - CFloat32ProjectionData3D *pProjData) + CFloat32ProjectionData3D *pProjData, + SJob::EMode eMode) { ASTRA_DEBUG("CCompositeGeometryManager::createJobBP"); // Create single job for BP @@ -1172,25 +1174,25 @@ CCompositeGeometryManager::SJob CCompositeGeometryManager::createJobBP(CProjecto BP.pOutput = boost::shared_ptr(output); BP.pProjector = pProjector; BP.eType = SJob::JOB_BP; - BP.eMode = SJob::MODE_SET; + BP.eMode = eMode; return BP; } bool CCompositeGeometryManager::doFP(CProjector3D *pProjector, CFloat32VolumeData3D *pVolData, - CFloat32ProjectionData3D *pProjData) + CFloat32ProjectionData3D *pProjData, SJob::EMode eMode) { TJobList L; - L.push_back(createJobFP(pProjector, pVolData, pProjData)); + L.push_back(createJobFP(pProjector, pVolData, pProjData, eMode)); return doJobs(L); } -bool CCompositeGeometryManager::doBP(CProjector3D *pProjector, CFloat32VolumeData3D *pVolData, - CFloat32ProjectionData3D *pProjData) + bool CCompositeGeometryManager::doBP(CProjector3D *pProjector, CFloat32VolumeData3D *pVolData, + CFloat32ProjectionData3D *pProjData, SJob::EMode eMode) { TJobList L; - L.push_back(createJobBP(pProjector, pVolData, pProjData)); + L.push_back(createJobBP(pProjector, pVolData, pProjData, eMode)); return doJobs(L); } @@ -1198,14 +1200,14 @@ bool CCompositeGeometryManager::doBP(CProjector3D *pProjector, CFloat32VolumeDat bool CCompositeGeometryManager::doFDK(CProjector3D *pProjector, CFloat32VolumeData3D *pVolData, CFloat32ProjectionData3D *pProjData, bool bShortScan, - const float *pfFilter) + const float *pfFilter, SJob::EMode eMode) { if (!dynamic_cast(pProjData->getGeometry())) { ASTRA_ERROR("CCompositeGeometryManager::doFDK: cone geometry required"); return false; } - SJob job = createJobBP(pProjector, pVolData, pProjData); + SJob job = createJobBP(pProjector, pVolData, pProjData, eMode); job.eType = SJob::JOB_FDK; job.FDKSettings.bShortScan = bShortScan; job.FDKSettings.pfFilter = pfFilter; @@ -1216,7 +1218,7 @@ bool CCompositeGeometryManager::doFDK(CProjector3D *pProjector, CFloat32VolumeDa return doJobs(L); } -bool CCompositeGeometryManager::doFP(CProjector3D *pProjector, const std::vector& volData, const std::vector& projData) +bool CCompositeGeometryManager::doFP(CProjector3D *pProjector, const std::vector& volData, const std::vector& projData, SJob::EMode eMode) { ASTRA_DEBUG("CCompositeGeometryManager::doFP, multi-volume"); @@ -1254,7 +1256,7 @@ bool CCompositeGeometryManager::doFP(CProjector3D *pProjector, const std::vector for (i2 = outputs.begin(); i2 != outputs.end(); ++i2) { SJob FP; - FP.eMode = SJob::MODE_SET; + FP.eMode = eMode; for (j2 = inputs.begin(); j2 != inputs.end(); ++j2) { FP.pInput = *j2; FP.pOutput = *i2; @@ -1262,7 +1264,7 @@ bool CCompositeGeometryManager::doFP(CProjector3D *pProjector, const std::vector FP.eType = SJob::JOB_FP; L.push_back(FP); - // Set first, add rest + // Always ADD rest FP.eMode = SJob::MODE_ADD; } } @@ -1270,7 +1272,7 @@ bool CCompositeGeometryManager::doFP(CProjector3D *pProjector, const std::vector return doJobs(L); } -bool CCompositeGeometryManager::doBP(CProjector3D *pProjector, const std::vector& volData, const std::vector& projData) +bool CCompositeGeometryManager::doBP(CProjector3D *pProjector, const std::vector& volData, const std::vector& projData, SJob::EMode eMode) { ASTRA_DEBUG("CCompositeGeometryManager::doBP, multi-volume"); @@ -1309,7 +1311,7 @@ bool CCompositeGeometryManager::doBP(CProjector3D *pProjector, const std::vector for (i2 = outputs.begin(); i2 != outputs.end(); ++i2) { SJob BP; - BP.eMode = SJob::MODE_SET; + BP.eMode = eMode; for (j2 = inputs.begin(); j2 != inputs.end(); ++j2) { BP.pInput = *j2; BP.pOutput = *i2; @@ -1317,7 +1319,7 @@ bool CCompositeGeometryManager::doBP(CProjector3D *pProjector, const std::vector BP.eType = SJob::JOB_BP; L.push_back(BP); - // Set first, add rest + // Always ADD rest BP.eMode = SJob::MODE_ADD; } } -- cgit v1.2.3 From 85b619e6c5c04faa6a365c5be4b9bc8c7db445fa Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 22 Nov 2017 17:02:25 +0100 Subject: Allow cone_vec for FDK NB: This will let you do mathematically nonsensical things, since FDK does not support non-circular cone geometries. However, this does let you use translated detectors, for example. --- src/CompositeGeometryManager.cpp | 5 +++-- src/CudaFDKAlgorithm3D.cpp | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/CompositeGeometryManager.cpp b/src/CompositeGeometryManager.cpp index 470476e..8af430c 100644 --- a/src/CompositeGeometryManager.cpp +++ b/src/CompositeGeometryManager.cpp @@ -1202,8 +1202,9 @@ bool CCompositeGeometryManager::doFDK(CProjector3D *pProjector, CFloat32VolumeDa CFloat32ProjectionData3D *pProjData, bool bShortScan, const float *pfFilter, SJob::EMode eMode) { - if (!dynamic_cast(pProjData->getGeometry())) { - ASTRA_ERROR("CCompositeGeometryManager::doFDK: cone geometry required"); + if (!dynamic_cast(pProjData->getGeometry()) && + !dynamic_cast(pProjData->getGeometry())) { + ASTRA_ERROR("CCompositeGeometryManager::doFDK: cone/cone_vec geometry required"); return false; } diff --git a/src/CudaFDKAlgorithm3D.cpp b/src/CudaFDKAlgorithm3D.cpp index d503351..b2b9c06 100644 --- a/src/CudaFDKAlgorithm3D.cpp +++ b/src/CudaFDKAlgorithm3D.cpp @@ -31,6 +31,7 @@ along with the ASTRA Toolbox. If not, see . #include "astra/CudaProjector3D.h" #include "astra/ConeProjectionGeometry3D.h" +#include "astra/ConeVecProjectionGeometry3D.h" #include "astra/CompositeGeometryManager.h" #include "astra/Logging.h" @@ -82,7 +83,7 @@ bool CCudaFDKAlgorithm3D::_check() ASTRA_CONFIG_CHECK(CReconstructionAlgorithm3D::_check(), "CUDA_FDK", "Error in ReconstructionAlgorithm3D initialization"); const CProjectionGeometry3D* projgeom = m_pSinogram->getGeometry(); - ASTRA_CONFIG_CHECK(dynamic_cast(projgeom), "CUDA_FDK", "Error setting FDK geometry"); + ASTRA_CONFIG_CHECK(dynamic_cast(projgeom) || dynamic_cast(projgeom), "CUDA_FDK", "Error setting FDK geometry"); const CVolumeGeometry3D* volgeom = m_pReconstruction->getGeometry(); -- cgit v1.2.3 From 231a6de483e94507de34bd2f79317d875bbb354b Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 22 Nov 2017 17:30:05 +0100 Subject: Fix missing version update in conda meta.yaml --- python/conda/astra-toolbox/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/conda/astra-toolbox/meta.yaml b/python/conda/astra-toolbox/meta.yaml index 7331e0f..b68a093 100644 --- a/python/conda/astra-toolbox/meta.yaml +++ b/python/conda/astra-toolbox/meta.yaml @@ -28,14 +28,14 @@ requirements: - numpy {{ numpy }} - scipy - six - - libastra ==1.8.3 + - libastra ==1.9.0dev run: - python - {{ pin_compatible('numpy', max_pin='x.x') }} - scipy - six - - libastra ==1.8.3 + - libastra ==1.9.0dev about: -- cgit v1.2.3