summaryrefslogtreecommitdiffstats
path: root/python/astra/functions.py
diff options
context:
space:
mode:
authorWim van Aarle <wimvanaarle@gmail.com>2015-03-12 17:32:28 +0100
committerWim van Aarle <wimvanaarle@gmail.com>2015-03-12 17:32:28 +0100
commite8765bcdab3be977cd5536531cacb24bf3378a59 (patch)
tree36347f2d42deb241d431f584da0db3f7791fe76e /python/astra/functions.py
parentc0b6862d75edcde6beacf811ce97200776d13b62 (diff)
downloadastra-e8765bcdab3be977cd5536531cacb24bf3378a59.tar.gz
astra-e8765bcdab3be977cd5536531cacb24bf3378a59.tar.bz2
astra-e8765bcdab3be977cd5536531cacb24bf3378a59.tar.xz
astra-e8765bcdab3be977cd5536531cacb24bf3378a59.zip
added parallel_vec to the python bindings
Diffstat (limited to 'python/astra/functions.py')
-rw-r--r--python/astra/functions.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/python/astra/functions.py b/python/astra/functions.py
index 4025468..b9deb66 100644
--- a/python/astra/functions.py
+++ b/python/astra/functions.py
@@ -189,7 +189,27 @@ def geom_2vec(proj_geom):
:param proj_geom: Projection geometry to convert
:type proj_geom: :class:`dict`
"""
- if proj_geom['type'] == 'fanflat':
+
+ if proj_geom['type'] == 'parallel':
+ angles = proj_geom['ProjectionAngles']
+ vectors = np.zeros((len(angles), 6))
+ for i in range(len(angles)):
+
+ # source
+ vectors[i, 0] = np.sin(angles[i])
+ vectors[i, 1] = -np.cos(angles[i])
+
+ # center of detector
+ vectors[i, 2] = 0
+ vectors[i, 3] = 0
+
+ # vector from detector pixel 0 to 1
+ vectors[i, 4] = np.cos(angles[i]) * proj_geom['DetectorWidth']
+ vectors[i, 5] = np.sin(angles[i]) * proj_geom['DetectorWidth']
+ proj_geom_out = ac.create_proj_geom(
+ 'parallel_vec', proj_geom['DetectorCount'], vectors)
+
+ elif proj_geom['type'] == 'fanflat':
angles = proj_geom['ProjectionAngles']
vectors = np.zeros((len(angles), 6))
for i in range(len(angles)):