diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-10-17 10:41:55 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-10-17 10:45:29 +0200 |
commit | b3a80d71aa9a80223729b8cb47a55297f985faaf (patch) | |
tree | fa1ff681469835c0a9ffa2f659b08d31d9e97357 | |
parent | a02ee2a02aead0c69acfd15693fd12d0d5efd52f (diff) | |
download | astra-b3a80d71aa9a80223729b8cb47a55297f985faaf.tar.gz astra-b3a80d71aa9a80223729b8cb47a55297f985faaf.tar.bz2 astra-b3a80d71aa9a80223729b8cb47a55297f985faaf.tar.xz astra-b3a80d71aa9a80223729b8cb47a55297f985faaf.zip |
Improve matlab create_vol_geom
-rw-r--r-- | matlab/tools/astra_create_vol_geom.m | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/matlab/tools/astra_create_vol_geom.m b/matlab/tools/astra_create_vol_geom.m index bf24609..24fa957 100644 --- a/matlab/tools/astra_create_vol_geom.m +++ b/matlab/tools/astra_create_vol_geom.m @@ -38,21 +38,12 @@ if numel(varargin) == 1 && numel(varargin{1}) == 1 vol_geom = struct(); vol_geom.GridRowCount = varargin{1}(1); vol_geom.GridColCount = varargin{1}(1); - vol_geom.option.WindowMinX = -varargin{1}(1) / 2; - vol_geom.option.WindowMaxX = varargin{1}(1) / 2; - vol_geom.option.WindowMinY = -varargin{1}(1) / 2; - vol_geom.option.WindowMaxY = varargin{1}(1) / 2; - % astra_create_vol_geom([row_count col_count]) elseif numel(varargin) == 1 && numel(varargin{1}) == 2 vol_geom = struct(); vol_geom.GridRowCount = varargin{1}(1); vol_geom.GridColCount = varargin{1}(2); - vol_geom.option.WindowMinX = -varargin{1}(2) / 2; - vol_geom.option.WindowMaxX = varargin{1}(2) / 2; - vol_geom.option.WindowMinY = -varargin{1}(1) / 2; - vol_geom.option.WindowMaxY = varargin{1}(1) / 2; % astra_create_vol_geom([row_count col_count slice_count]) elseif numel(varargin) == 1 && numel(varargin{1}) == 3 @@ -60,22 +51,12 @@ elseif numel(varargin) == 1 && numel(varargin{1}) == 3 vol_geom.GridRowCount = varargin{1}(1); vol_geom.GridColCount = varargin{1}(2); vol_geom.GridSliceCount = varargin{1}(3); - vol_geom.option.WindowMinX = -varargin{1}(2) / 2; - vol_geom.option.WindowMaxX = varargin{1}(2) / 2; - vol_geom.option.WindowMinY = -varargin{1}(1) / 2; - vol_geom.option.WindowMaxY = varargin{1}(1) / 2; - vol_geom.option.WindowMinZ = -varargin{1}(3) / 2; - vol_geom.option.WindowMaxZ = varargin{1}(3) / 2; % astra_create_vol_geom(row_count, col_count) elseif numel(varargin) == 2 vol_geom = struct(); vol_geom.GridRowCount = varargin{1}; vol_geom.GridColCount = varargin{2}; - vol_geom.option.WindowMinX = -varargin{2} / 2; - vol_geom.option.WindowMaxX = varargin{2} / 2; - vol_geom.option.WindowMinY = -varargin{1} / 2; - vol_geom.option.WindowMaxY = varargin{1} / 2; % astra_create_vol_geom(row_count, col_count, min_x, max_x, min_y, max_y) elseif numel(varargin) == 6 @@ -108,3 +89,15 @@ elseif numel(varargin) == 9 vol_geom.option.WindowMaxZ = varargin{9}; end + +% set the window options, if not set already. +if ~isfield(vol_geom, 'option') || ~isfield(vol_geom.option, 'WindowMinX') + vol_geom.option.WindowMinX = -vol_geom.GridColCount / 2; + vol_geom.option.WindowMaxX = vol_geom.GridColCount / 2; + vol_geom.option.WindowMinY = -vol_geom.GridRowCount / 2; + vol_geom.option.WindowMaxY = vol_geom.GridRowCount / 2; + if isfield(vol_geom, 'GridSliceCount') + vol_geom.option.WindowMinZ = -vol_geom.GridSliceCount / 2; + vol_geom.option.WindowMaxZ = vol_geom.GridSliceCount / 2; + end +end |