summaryrefslogtreecommitdiffstats
path: root/tests/python/test_line2d.py
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2019-03-29 15:03:57 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2019-09-25 14:10:08 +0200
commit35957b6ef72749cdc520ded67a0eb8cdfd7ea655 (patch)
tree8f9f35c04c2731fe4e20139171ede3dac9d4d894 /tests/python/test_line2d.py
parent0f4ceb4c7f3f63fddf8fbf44c59fcd8f415e3847 (diff)
downloadastra-35957b6ef72749cdc520ded67a0eb8cdfd7ea655.tar.gz
astra-35957b6ef72749cdc520ded67a0eb8cdfd7ea655.tar.bz2
astra-35957b6ef72749cdc520ded67a0eb8cdfd7ea655.tar.xz
astra-35957b6ef72749cdc520ded67a0eb8cdfd7ea655.zip
Adjust linear/cuda kernels to line integral scaling
Diffstat (limited to 'tests/python/test_line2d.py')
-rw-r--r--tests/python/test_line2d.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/tests/python/test_line2d.py b/tests/python/test_line2d.py
index 755bd27..5647053 100644
--- a/tests/python/test_line2d.py
+++ b/tests/python/test_line2d.py
@@ -486,17 +486,9 @@ class Test2DKernel(unittest.TestCase):
for i, (center, edge1, edge2) in enumerate(gen_lines(pg)):
(src, det) = center
(xd, yd) = det - src
- try:
- detweight = pg['DetectorWidth']
- except KeyError:
- if 'fan' not in type:
- detweight = effective_detweight(src, det, pg['Vectors'][i//pg['DetectorCount'],4:6])
- else:
- detweight = np.linalg.norm(pg['Vectors'][i//pg['DetectorCount'],4:6], ord=2)
-
l = 0.0
if np.abs(xd) > np.abs(yd): # horizontal ray
- length = math.sqrt(1.0 + abs(yd/xd)**2)
+ length = math.sqrt(1.0 + abs(yd/xd)**2) * pixsize[0]
y_seg = (ymin, ymax)
for j in range(rect_min[0], rect_max[0]):
x = origin[0] + (-0.5 * shape[0] + j + 0.5) * pixsize[0]
@@ -504,9 +496,9 @@ class Test2DKernel(unittest.TestCase):
# limited interpolation precision with cuda
if CUDA_8BIT_LINEAR and proj_type == 'cuda':
w = np.round(w * 256.0) / 256.0
- l += w * length * pixsize[0] * detweight
+ l += w * length
else:
- length = math.sqrt(1.0 + abs(xd/yd)**2)
+ length = math.sqrt(1.0 + abs(xd/yd)**2) * pixsize[1]
x_seg = (xmin, xmax)
for j in range(rect_min[1], rect_max[1]):
y = origin[1] + (+0.5 * shape[1] - j - 0.5) * pixsize[1]
@@ -514,7 +506,7 @@ class Test2DKernel(unittest.TestCase):
# limited interpolation precision with cuda
if CUDA_8BIT_LINEAR and proj_type == 'cuda':
w = np.round(w * 256.0) / 256.0
- l += w * length * pixsize[1] * detweight
+ l += w * length
a[i] = l
a = a.reshape(astra.functions.geom_size(pg))
if not np.all(np.isfinite(a)):