From 7bfc5b3713f750efe21992fcd8d02e840d5d4867 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 5 Dec 2018 12:03:14 +0100 Subject: Read filter config for FBP from cfg.options Since these settings are optional, they should have been in cfg.options instead of directly in cfg. The old syntax remains a fallback. This has the side-effect that the tomopy/astra interface can also supply them. --- samples/matlab/s014_FBP.m | 2 +- samples/matlab/s023_FBP_filters.m | 10 +++++----- samples/python/s014_FBP.py | 2 +- samples/python/s023_FBP_filters.py | 11 ++++++----- 4 files changed, 13 insertions(+), 12 deletions(-) (limited to 'samples') diff --git a/samples/matlab/s014_FBP.m b/samples/matlab/s014_FBP.m index 1fc6f90..038aa90 100644 --- a/samples/matlab/s014_FBP.m +++ b/samples/matlab/s014_FBP.m @@ -24,7 +24,7 @@ rec_id = astra_mex_data2d('create', '-vol', vol_geom); cfg = astra_struct('FBP_CUDA'); cfg.ReconstructionDataId = rec_id; cfg.ProjectionDataId = sinogram_id; -cfg.FilterType = 'Ram-Lak'; +cfg.option.FilterType = 'Ram-Lak'; % possible values for FilterType: % none, ram-lak, shepp-logan, cosine, hamming, hann, tukey, lanczos, diff --git a/samples/matlab/s023_FBP_filters.m b/samples/matlab/s023_FBP_filters.m index 4abec7e..d01b0d0 100644 --- a/samples/matlab/s023_FBP_filters.m +++ b/samples/matlab/s023_FBP_filters.m @@ -32,7 +32,7 @@ cfg.ProjectorId = proj_id; % 1. Use a standard Ram-Lak filter -cfg.FilterType = 'ram-lak'; +cfg.option.FilterType = 'ram-lak'; alg_id = astra_mex_algorithm('create', cfg); astra_mex_algorithm('run', alg_id); @@ -53,8 +53,8 @@ filter = kernel(1:halfFilterSize); filter_geom = astra_create_proj_geom('parallel', 1.0, halfFilterSize, [0]); filter_id = astra_mex_data2d('create', '-sino', filter_geom, filter); -cfg.FilterType = 'projection'; -cfg.FilterSinogramId = filter_id; +cfg.option.FilterType = 'projection'; +cfg.option.FilterSinogramId = filter_id; alg_id = astra_mex_algorithm('create', cfg); astra_mex_algorithm('run', alg_id); @@ -77,8 +77,8 @@ kernel(floor(N/2)+1) = 0.5; kernel_geom = astra_create_proj_geom('parallel', 1.0, N, [0]); kernel_id = astra_mex_data2d('create', '-sino', kernel_geom, kernel); -cfg.FilterType = 'rprojection'; -cfg.FilterSinogramId = kernel_id; +cfg.option.FilterType = 'rprojection'; +cfg.option.FilterSinogramId = kernel_id; alg_id = astra_mex_algorithm('create', cfg); astra_mex_algorithm('run', alg_id); diff --git a/samples/python/s014_FBP.py b/samples/python/s014_FBP.py index f7cefd4..1c3a341 100644 --- a/samples/python/s014_FBP.py +++ b/samples/python/s014_FBP.py @@ -49,7 +49,7 @@ rec_id = astra.data2d.create('-vol', vol_geom) cfg = astra.astra_dict('FBP_CUDA') cfg['ReconstructionDataId'] = rec_id cfg['ProjectionDataId'] = sinogram_id -cfg['FilterType'] = 'Ram-Lak' +cfg['option'] = { 'FilterType': 'Ram-Lak' } # possible values for FilterType: # none, ram-lak, shepp-logan, cosine, hamming, hann, tukey, lanczos, diff --git a/samples/python/s023_FBP_filters.py b/samples/python/s023_FBP_filters.py index 11518ac..a67c338 100644 --- a/samples/python/s023_FBP_filters.py +++ b/samples/python/s023_FBP_filters.py @@ -47,11 +47,12 @@ cfg = astra.astra_dict('FBP') cfg['ReconstructionDataId'] = rec_id cfg['ProjectionDataId'] = sinogram_id cfg['ProjectorId'] = proj_id +cfg['option'] = {} # 1. Use a standard Ram-Lak filter -cfg['FilterType'] = 'ram-lak' +cfg['option']['FilterType'] = 'ram-lak' alg_id = astra.algorithm.create(cfg) astra.algorithm.run(alg_id) @@ -71,8 +72,8 @@ filter = np.reshape(kernel[0:halfFilterSize], (1, halfFilterSize)) filter_geom = astra.create_proj_geom('parallel', 1.0, halfFilterSize, [0]); filter_id = astra.data2d.create('-sino', filter_geom, filter); -cfg['FilterType'] = 'projection' -cfg['FilterSinogramId'] = filter_id +cfg['option']['FilterType'] = 'projection' +cfg['option']['FilterSinogramId'] = filter_id alg_id = astra.algorithm.create(cfg) astra.algorithm.run(alg_id) rec_filter = astra.data2d.get(rec_id) @@ -92,8 +93,8 @@ kernel[0, N//2] = 0.5 kernel_geom = astra.create_proj_geom('parallel', 1.0, N, [0]); kernel_id = astra.data2d.create('-sino', kernel_geom, kernel); -cfg['FilterType'] = 'rprojection' -cfg['FilterSinogramId'] = kernel_id +cfg['option']['FilterType'] = 'rprojection' +cfg['option']['FilterSinogramId'] = kernel_id alg_id = astra.algorithm.create(cfg) astra.algorithm.run(alg_id) rec_kernel = astra.data2d.get(rec_id) -- cgit v1.2.3