From c39b12fc42a7254bad1e68cbdb948eee0421ad81 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 16 Sep 2015 16:44:10 +0200 Subject: Let astra_create_vol_geom also generate flexible volume geometries --- matlab/tools/astra_create_vol_geom.m | 15 +++++++++++++++ python/astra/creators.py | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/matlab/tools/astra_create_vol_geom.m b/matlab/tools/astra_create_vol_geom.m index ea975e6..a3ba7de 100644 --- a/matlab/tools/astra_create_vol_geom.m +++ b/matlab/tools/astra_create_vol_geom.m @@ -15,6 +15,7 @@ function vol_geom = astra_create_vol_geom(varargin) % vol_geom: MATLAB struct containing all information of the geometry. %-------------------------------------------------------------------------- % vol_geom = astra_create_vol_geom(row_count, col_count, slice_count); +% vol_geom = astra_create_vol_geom(row_count, col_count, slice_count, min_x, max_x, min_y, max_y, min_z, max_z); % % Create a 3D volume geometry. See the API for more information. % row_count: number of rows. @@ -93,4 +94,18 @@ elseif numel(varargin) == 3 vol_geom.GridRowCount = varargin{1}; vol_geom.GridColCount = varargin{2}; vol_geom.GridSliceCount = varargin{3}; + +% astra_create_vol_geom(row_count, col_count, slice_count, min_x, max_x, min_y, max_y, min_z, max_z) +elseif numel(varargin) == 9 + vol_geom = struct(); + vol_geom.GridRowCount = varargin{1}; + vol_geom.GridColCount = varargin{2}; + vol_geom.GridSliceCount = varargin{3}; + vol_geom.option.WindowMinX = varargin{4}; + vol_geom.option.WindowMaxX = varargin{5}; + vol_geom.option.WindowMinY = varargin{6}; + vol_geom.option.WindowMaxY = varargin{7}; + vol_geom.option.WindowMinZ = varargin{8}; + vol_geom.option.WindowMaxZ = varargin{9}; + end diff --git a/python/astra/creators.py b/python/astra/creators.py index 68bc8a2..f3474d8 100644 --- a/python/astra/creators.py +++ b/python/astra/creators.py @@ -72,6 +72,10 @@ This method can be called in a number of ways: ``create_vol_geom(M, N, Z)``: :returns: A 3D volume geometry of size :math:`M \\times N \\times Z`. +``create_vol_geom(M, N, Z, minx, maxx, miny, maxy, minz, maxz)``: + :returns: A 3D volume geometry of size :math:`M \\times N \\times Z`, windowed as :math:`minx \\leq x \\leq maxx` and :math:`miny \\leq y \\leq maxy` and :math:`minz \\leq z \\leq maxz` . + + """ vol_geom = {'option': {}} # astra_create_vol_geom(row_count) @@ -122,6 +126,17 @@ This method can be called in a number of ways: vol_geom['GridRowCount'] = varargin[0] vol_geom['GridColCount'] = varargin[1] vol_geom['GridSliceCount'] = varargin[2] + # astra_create_vol_geom(row_count, col_count, slice_count, min_x, max_x, min_y, max_y, min_z, max_z) + elif len(varargin) == 9: + vol_geom['GridRowCount'] = varargin[0] + vol_geom['GridColCount'] = varargin[1] + vol_geom['GridSliceCount'] = varargin[2] + vol_geom['option']['WindowMinX'] = varargin[3] + vol_geom['option']['WindowMaxX'] = varargin[4] + vol_geom['option']['WindowMinY'] = varargin[5] + vol_geom['option']['WindowMaxY'] = varargin[6] + vol_geom['option']['WindowMinZ'] = varargin[7] + vol_geom['option']['WindowMaxZ'] = varargin[8] return vol_geom -- cgit v1.2.3