summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-06-26 12:20:44 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-06-26 12:20:44 +0200
commit47b520d51fc4fc49db992b9117f6c0abfa8152b5 (patch)
tree8f494a765a3607afd1c9bac9c592f30536b950a1 /python
parent9f86a4c3f20ac8785f80288ec4cdefe79ed67e68 (diff)
parent62f3aa5792011792db866ce0841c8d164aa9a34d (diff)
downloadastra-47b520d51fc4fc49db992b9117f6c0abfa8152b5.tar.gz
astra-47b520d51fc4fc49db992b9117f6c0abfa8152b5.tar.bz2
astra-47b520d51fc4fc49db992b9117f6c0abfa8152b5.tar.xz
astra-47b520d51fc4fc49db992b9117f6c0abfa8152b5.zip
Merge branch 'master'
Diffstat (limited to 'python')
-rw-r--r--python/astra/projector3d_c.pyx10
-rw-r--r--python/astra/projector_c.pyx10
-rw-r--r--python/astra/utils.pyx11
-rw-r--r--python/docSRC/operator.rst4
4 files changed, 26 insertions, 9 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 ddb37aa..260c308 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 = <double*>np.PyArray_DATA(np.ascontiguousarray(val,dtype=np.float64))
+ contig_data = np.ascontiguousarray(val,dtype=np.float64)
+ data = <double*>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 = <double*>np.PyArray_DATA(np.ascontiguousarray(val,dtype=np.float64))
+ contig_data = np.ascontiguousarray(val,dtype=np.float64)
+ data = <double*>np.PyArray_DATA(contig_data)
if val.ndim == 2:
listbase.setContent(data, val.shape[1], val.shape[0], False)
elif val.ndim == 1:
@@ -202,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)
diff --git a/python/docSRC/operator.rst b/python/docSRC/operator.rst
index f5369fa..fe500ba 100644
--- a/python/docSRC/operator.rst
+++ b/python/docSRC/operator.rst
@@ -1,7 +1,7 @@
-OpTomo class: the :mod:`operator` module
+OpTomo class: the :mod:`optomo` module
==============================================
-.. automodule:: astra.operator
+.. automodule:: astra.optomo
:members:
:undoc-members:
:show-inheritance: