summaryrefslogtreecommitdiffstats
path: root/samples/matlab
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-12-12 16:14:00 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-12-12 16:14:00 +0100
commitc549714416a8b8500820d0ceb2cb1ebc6ff38e55 (patch)
tree739273353f33f31fb4210937174218dc36987136 /samples/matlab
parentc712d102e7a5a67468bc46db14f0510b8f6f4381 (diff)
parent3276485c96636cd38248908ff3575282654ff335 (diff)
downloadastra-c549714416a8b8500820d0ceb2cb1ebc6ff38e55.tar.gz
astra-c549714416a8b8500820d0ceb2cb1ebc6ff38e55.tar.bz2
astra-c549714416a8b8500820d0ceb2cb1ebc6ff38e55.tar.xz
astra-c549714416a8b8500820d0ceb2cb1ebc6ff38e55.zip
Merge branch 'geom_visualizer'
This adds a matlab geometry visualizer, and a sample showing how to use it.
Diffstat (limited to 'samples/matlab')
-rw-r--r--samples/matlab/bunny.stlbin0 -> 47484 bytes
-rw-r--r--samples/matlab/s024_plot_geometry.m47
2 files changed, 47 insertions, 0 deletions
diff --git a/samples/matlab/bunny.stl b/samples/matlab/bunny.stl
new file mode 100644
index 0000000..0b7fcaa
--- /dev/null
+++ b/samples/matlab/bunny.stl
Binary files differ
diff --git a/samples/matlab/s024_plot_geometry.m b/samples/matlab/s024_plot_geometry.m
new file mode 100644
index 0000000..6c4c3f0
--- /dev/null
+++ b/samples/matlab/s024_plot_geometry.m
@@ -0,0 +1,47 @@
+%% s024_plot_geometry.m
+% brief example of usage for astra_plot_geom command
+% - last update 16.11.2018
+% -----------------------------------------------------------------------
+% This file is part of the ASTRA Toolbox
+%
+% Copyright: 2010-2018, imec Vision Lab, University of Antwerp
+% 2014-2018, CWI, Amsterdam
+% License: Open Source under GPLv3
+% Contact: astra@astra-toolbox.com
+% Website: http://www.astra-toolbox.com/
+% -----------------------------------------------------------------------
+%%
+close all;
+
+if exist('astra_create_example_cone') ~= 2
+ error('Please add astra/algorithms/plot_geom to your path to use this function')
+end
+
+
+% proj_geom = astra_create_example_cone('vec');
+% proj_geom = astra_create_example_cone('normal');
+proj_geom = astra_create_example_cone('helix');
+% proj_geom = astra_create_example_parallel3d('vec');
+% proj_geom = astra_create_example_fanflat('vec');
+% proj_geom = astra_create_example_fanflat();
+% proj_geom = astra_create_example_parallel3d();
+% proj_geom = astra_create_example_cone('deform_vec');
+
+astra_plot_geom(proj_geom);
+hold on;
+
+vol_magn = 20;
+phantom_size = 5;
+phantom_px = 1500;
+vx_size = phantom_size / phantom_px; % voxel size
+vol_geom = astra_create_vol_geom(phantom_px, phantom_px, phantom_px);
+line_width = 1; % line width for phantom
+astra_plot_geom(vol_geom, vx_size, 'Magnification', vol_magn,...
+ 'LineWidth', line_width, 'Color', 'r');
+
+% this magnification is empirically chosen to fit the stl file
+cad_magn = 900;
+astra_plot_geom('bunny.stl', cad_magn);
+
+hold off;
+axis equal;