summaryrefslogtreecommitdiffstats
path: root/python/astra
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2015-06-26 12:00:20 +0200
committerWillem Jan Palenstijn <wjp@usecode.org>2015-06-26 12:00:20 +0200
commit62f3aa5792011792db866ce0841c8d164aa9a34d (patch)
tree8f494a765a3607afd1c9bac9c592f30536b950a1 /python/astra
parent8ad46dc9cb28067047838e06770707cf86ef6e56 (diff)
parent9e3472ea9041b8755050427d8bdb8a4701019c55 (diff)
downloadastra-62f3aa5792011792db866ce0841c8d164aa9a34d.tar.gz
astra-62f3aa5792011792db866ce0841c8d164aa9a34d.tar.bz2
astra-62f3aa5792011792db866ce0841c8d164aa9a34d.tar.xz
astra-62f3aa5792011792db866ce0841c8d164aa9a34d.zip
Merge pull request #76 from dmpelt/projector-configuration-fix
Configuration fixes
Diffstat (limited to 'python/astra')
-rw-r--r--python/astra/projector3d_c.pyx10
-rw-r--r--python/astra/projector_c.pyx10
-rw-r--r--python/astra/utils.pyx5
3 files changed, 20 insertions, 5 deletions
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):
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)