From e509cd013f691acded3dc0d87732ba5257cb0ae4 Mon Sep 17 00:00:00 2001 From: "Daniel M. Pelt" Date: Mon, 20 Jul 2015 15:14:50 +0200 Subject: Add ReconstructionAlgorithm2D/3D classes for plugins (matching C++ classes) --- python/astra/data2d_c.pyx | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'python/astra/data2d_c.pyx') diff --git a/python/astra/data2d_c.pyx b/python/astra/data2d_c.pyx index 4919bf2..801fd8e 100644 --- a/python/astra/data2d_c.pyx +++ b/python/astra/data2d_c.pyx @@ -34,6 +34,9 @@ from cython cimport view cimport PyData2DManager from .PyData2DManager cimport CData2DManager +cimport PyProjector2DManager +from .PyProjector2DManager cimport CProjector2DManager + cimport PyXMLDocument from .PyXMLDocument cimport XMLDocument @@ -54,6 +57,8 @@ import operator from six.moves import reduce cdef CData2DManager * man2d = PyData2DManager.getSingletonPtr() +cdef CProjector2DManager * manProj = PyProjector2DManager.getSingletonPtr() + cdef extern from "CFloat32CustomPython.h": cdef cppclass CFloat32CustomPython: @@ -164,7 +169,6 @@ def store(i, data): cdef CFloat32Data2D * pDataObject = getObject(i) fillDataObject(pDataObject, data) - def get_geometry(i): cdef CFloat32Data2D * pDataObject = getObject(i) cdef CFloat32ProjectionData2D * pDataObject2 @@ -179,6 +183,27 @@ def get_geometry(i): raise Exception("Not a known data object") return geom +cdef CProjector2D * getProjector(i) except NULL: + cdef CProjector2D * proj = manProj.get(i) + if proj == NULL: + raise Exception("Projector not initialized.") + if not proj.isInitialized(): + raise Exception("Projector not initialized.") + return proj + +def check_compatible(i, proj_id): + cdef CProjector2D * proj = getProjector(proj_id) + cdef CFloat32Data2D * pDataObject = getObject(i) + cdef CFloat32ProjectionData2D * pDataObject2 + cdef CFloat32VolumeData2D * pDataObject3 + if pDataObject.getType() == TWOPROJECTION: + pDataObject2 = pDataObject + return pDataObject2.getGeometry().isEqual(proj.getProjectionGeometry()) + elif pDataObject.getType() == TWOVOLUME: + pDataObject3 = pDataObject + return pDataObject3.getGeometry().isEqual(proj.getVolumeGeometry()) + else: + raise Exception("Not a known data object") def change_geometry(i, geom): cdef Config *cfg -- cgit v1.2.3 From d2705f52766716b4d4627a62de92e7a2480b6b86 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 2 Feb 2016 14:12:41 +0100 Subject: Make copyright/license headers consistent with rest of astra --- python/astra/data2d_c.pyx | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'python/astra/data2d_c.pyx') diff --git a/python/astra/data2d_c.pyx b/python/astra/data2d_c.pyx index 801fd8e..65e80ce 100644 --- a/python/astra/data2d_c.pyx +++ b/python/astra/data2d_c.pyx @@ -1,28 +1,28 @@ -#----------------------------------------------------------------------- -#Copyright 2013 Centrum Wiskunde & Informatica, Amsterdam +# ----------------------------------------------------------------------- +# Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp +# 2013-2016, CWI, Amsterdam # -#Author: Daniel M. Pelt -#Contact: D.M.Pelt@cwi.nl -#Website: http://dmpelt.github.io/pyastratoolbox/ +# Contact: astra@uantwerpen.be +# Website: http://sf.net/projects/astra-toolbox # +# This file is part of the ASTRA Toolbox. # -#This file is part of the Python interface to the -#All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). # -#The Python interface to 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 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 Python interface to 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. +# 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 Python interface to the ASTRA Toolbox. If not, see . +# You should have received a copy of the GNU General Public License +# along with the ASTRA Toolbox. If not, see . +# +# ----------------------------------------------------------------------- # -#----------------------------------------------------------------------- # distutils: language = c++ # distutils: libraries = astra -- cgit v1.2.3