summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-12-12 14:45:38 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-12-12 16:10:47 +0100
commit3276485c96636cd38248908ff3575282654ff335 (patch)
tree426f5a84fc3d11a8c2436deff5933dd707c8793a
parent40979a6f4ab678a2f57ccaf8aede1156713e3bf8 (diff)
downloadastra-3276485c96636cd38248908ff3575282654ff335.tar.gz
astra-3276485c96636cd38248908ff3575282654ff335.tar.bz2
astra-3276485c96636cd38248908ff3575282654ff335.tar.xz
astra-3276485c96636cd38248908ff3575282654ff335.zip
Reorganize functions into packages/private functions
This also replaces modifying the path with a request to the user to modify the path.
-rw-r--r--build/linux/Makefile.in20
-rw-r--r--matlab/algorithms/plot_geom/+draw/draw_cad_phantom.m (renamed from matlab/algorithms/plot_geom/draw/draw_cad_phantom.m)2
-rw-r--r--matlab/algorithms/plot_geom/+draw/draw_cone_geom.m (renamed from matlab/algorithms/plot_geom/draw/draw_cone_geom.m)0
-rw-r--r--matlab/algorithms/plot_geom/+draw/draw_cone_vec_geom.m (renamed from matlab/algorithms/plot_geom/draw/draw_cone_vec_geom.m)2
-rw-r--r--matlab/algorithms/plot_geom/+draw/draw_detector_vec.m (renamed from matlab/algorithms/plot_geom/draw/draw_detector_vec.m)0
-rw-r--r--matlab/algorithms/plot_geom/+draw/draw_fanflat_geom.m (renamed from matlab/algorithms/plot_geom/draw/draw_fanflat_geom.m)2
-rw-r--r--matlab/algorithms/plot_geom/+draw/draw_fanflat_vec_geom.m (renamed from matlab/algorithms/plot_geom/draw/draw_fanflat_vec_geom.m)2
-rw-r--r--matlab/algorithms/plot_geom/+draw/draw_parallel3d_geom.m (renamed from matlab/algorithms/plot_geom/draw/draw_parallel3d_geom.m)0
-rw-r--r--matlab/algorithms/plot_geom/+draw/draw_parallel3d_vec_geom.m (renamed from matlab/algorithms/plot_geom/draw/draw_parallel3d_vec_geom.m)2
-rw-r--r--matlab/algorithms/plot_geom/+draw/draw_proj_geom.m (renamed from matlab/algorithms/plot_geom/draw/draw_proj_geom.m)14
-rw-r--r--matlab/algorithms/plot_geom/+draw/draw_vol_geom.m (renamed from matlab/algorithms/plot_geom/draw/draw_vol_geom.m)2
-rw-r--r--matlab/algorithms/plot_geom/+draw/private/eucl_dist3d.m (renamed from matlab/algorithms/plot_geom/util/eucl_dist3d.m)0
-rw-r--r--matlab/algorithms/plot_geom/+parseargs/license.txt (renamed from matlab/algorithms/plot_geom/util/parseargs/license.txt)0
-rw-r--r--matlab/algorithms/plot_geom/+parseargs/parseargs.m (renamed from matlab/algorithms/plot_geom/util/parseargs/parseargs.m)0
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/license.txt (renamed from matlab/algorithms/plot_geom/util/stlTools/license.txt)0
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/readme.txt (renamed from matlab/algorithms/plot_geom/util/stlTools/readme.txt)0
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/stlAddVerts.m (renamed from matlab/algorithms/plot_geom/util/stlTools/stlAddVerts.m)2
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/stlDelVerts.m (renamed from matlab/algorithms/plot_geom/util/stlTools/stlDelVerts.m)0
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/stlDemo.m (renamed from matlab/algorithms/plot_geom/util/stlTools/stlDemo.m)2
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/stlGetFormat.m (renamed from matlab/algorithms/plot_geom/util/stlTools/stlGetFormat.m)0
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/stlGetVerts.m (renamed from matlab/algorithms/plot_geom/util/stlTools/stlGetVerts.m)0
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/stlPlot.m (renamed from matlab/algorithms/plot_geom/util/stlTools/stlPlot.m)0
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/stlRead.m (renamed from matlab/algorithms/plot_geom/util/stlTools/stlRead.m)2
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/stlReadAscii.m (renamed from matlab/algorithms/plot_geom/util/stlTools/stlReadAscii.m)2
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/stlReadBinary.m (renamed from matlab/algorithms/plot_geom/util/stlTools/stlReadBinary.m)2
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/stlSlimVerts.m (renamed from matlab/algorithms/plot_geom/util/stlTools/stlSlimVerts.m)0
-rw-r--r--matlab/algorithms/plot_geom/+stlTools/stlWrite.m (renamed from matlab/algorithms/plot_geom/util/stlTools/stlWrite.m)0
-rw-r--r--matlab/algorithms/plot_geom/astra_create_example_fanflat.m4
-rw-r--r--matlab/algorithms/plot_geom/private/magnify_proj.m (renamed from matlab/algorithms/plot_geom/util/magnify_proj.m)0
-rw-r--r--matlab/algorithms/plot_geom/private/rotate_around3d.m (renamed from matlab/algorithms/plot_geom/util/rotate_around3d.m)0
-rw-r--r--matlab/algorithms/plot_geom/private/rotate_detector.m (renamed from matlab/algorithms/plot_geom/util/rotate_detector.m)0
-rw-r--r--matlab/algorithms/plot_geom/private/rotate_euler3d.m (renamed from matlab/algorithms/plot_geom/util/rotate_euler3d.m)0
-rw-r--r--matlab/algorithms/plot_geom/private/translate_3d.m (renamed from matlab/algorithms/plot_geom/util/translate_3d.m)0
-rw-r--r--matlab/algorithms/plot_geom/util/cone_to_cone_vec.m41
-rw-r--r--matlab/algorithms/plot_geom/util/fanflat_to_fanflat_vec.m4
-rw-r--r--matlab/tools/astra_plot_geom.m10
-rw-r--r--samples/matlab/s024_plot_geometry.m7
37 files changed, 41 insertions, 81 deletions
diff --git a/build/linux/Makefile.in b/build/linux/Makefile.in
index 73d8279..a294578 100644
--- a/build/linux/Makefile.in
+++ b/build/linux/Makefile.in
@@ -521,22 +521,10 @@ install-matlab: $(MATLAB_MEX) install-matlab-so
$(INSTALL_SH) -m 755 $(MATLAB_MEX) $(MATLABBASE)/mex
$(INSTALL_SH) -m 644 $(srcdir)/../../matlab/tools/*.m $(MATLABBASE)/tools
- # TODO: there must be a more efficient way to do this than to create and fill every single folder
- # install plot_geom
- $(INSTALL_SH) -m 755 -d $(MATLABBASE)/algorithms/plot_geom
- $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/algorithms/plot_geom/*.m $(MATLABBASE)/algorithms/plot_geom
-
- $(INSTALL_SH) -m 755 -d $(MATLABBASE)/algorithms/plot_geom/draw
- $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/algorithms/plot_geom/draw/*.m $(MATLABBASE)/algorithms/plot_geom/draw
-
- $(INSTALL_SH) -m 755 -d $(MATLABBASE)/algorithms/plot_geom/util
- $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/algorithms/plot_geom/util/*.m $(MATLABBASE)/algorithms/plot_geom/util
-
- $(INSTALL_SH) -m 755 -d $(MATLABBASE)/algorithms/plot_geom/util/parseargs
- $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/algorithms/plot_geom/util/parseargs/* $(MATLABBASE)/algorithms/plot_geom/util/parseargs
-
- $(INSTALL_SH) -m 755 -d $(MATLABBASE)/algorithms/plot_geom/util/stlTools
- $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/algorithms/plot_geom/util/stlTools/* $(MATLABBASE)/algorithms/plot_geom/util/stlTools
+ for D in plot_geom plot_geom/private plot_geom/+draw plot_geom/+draw/private plot_geom/+parseargs plot_geom/+stlTools; do \
+ $(INSTALL_SH) -m 755 -d $(MATLABBASE)/algorithms/$$D; \
+ $(INSTALL_SH) -m 644 $(srcdir)/../../matlab/algorithms/$$D/*.m $(MATLABBASE)/algorithms/$$D; \
+ done
# TODO: docs
else
diff --git a/matlab/algorithms/plot_geom/draw/draw_cad_phantom.m b/matlab/algorithms/plot_geom/+draw/draw_cad_phantom.m
index 92af844..55dedc4 100644
--- a/matlab/algorithms/plot_geom/draw/draw_cad_phantom.m
+++ b/matlab/algorithms/plot_geom/+draw/draw_cad_phantom.m
@@ -16,7 +16,7 @@ function [] = draw_cad_phantom(filename, magn)
magn = 1;
end
- [v,f,~,~] = stlRead(filename);
+ [v,f,~,~] = stlTools.stlRead(filename);
m = mean(v); % to center the CAD model!
for i=1:3
v(:,i) = (v(:,i)- m(i)) .* magn;
diff --git a/matlab/algorithms/plot_geom/draw/draw_cone_geom.m b/matlab/algorithms/plot_geom/+draw/draw_cone_geom.m
index ae98294..ae98294 100644
--- a/matlab/algorithms/plot_geom/draw/draw_cone_geom.m
+++ b/matlab/algorithms/plot_geom/+draw/draw_cone_geom.m
diff --git a/matlab/algorithms/plot_geom/draw/draw_cone_vec_geom.m b/matlab/algorithms/plot_geom/+draw/draw_cone_vec_geom.m
index bee83b7..dac7410 100644
--- a/matlab/algorithms/plot_geom/draw/draw_cone_vec_geom.m
+++ b/matlab/algorithms/plot_geom/+draw/draw_cone_vec_geom.m
@@ -51,7 +51,7 @@ function [] = draw_cone_vec_geom(h_ax, geom, options)
detector.width = geom.DetectorRowCount;
detector.origin = detector_center(options.VectorIdx, :);
- vertices = draw_detector_vec(h_ax, detector, options);
+ vertices = draw.draw_detector_vec(h_ax, detector, options);
connect_source_detector(h_ax, vertices, detector_center, ...
xray_source, options);
diff --git a/matlab/algorithms/plot_geom/draw/draw_detector_vec.m b/matlab/algorithms/plot_geom/+draw/draw_detector_vec.m
index 5c293d4..5c293d4 100644
--- a/matlab/algorithms/plot_geom/draw/draw_detector_vec.m
+++ b/matlab/algorithms/plot_geom/+draw/draw_detector_vec.m
diff --git a/matlab/algorithms/plot_geom/draw/draw_fanflat_geom.m b/matlab/algorithms/plot_geom/+draw/draw_fanflat_geom.m
index 5c97d80..a5f28ea 100644
--- a/matlab/algorithms/plot_geom/draw/draw_fanflat_geom.m
+++ b/matlab/algorithms/plot_geom/+draw/draw_fanflat_geom.m
@@ -20,6 +20,6 @@ function [] = draw_fanflat_geom( h_ax, geom, options)
geom.DetectorWidth, 1, geom.DetectorCount, geom.ProjectionAngles,...
geom.DistanceOriginSource, geom.DistanceOriginDetector);
- draw_cone_geom(h_ax, cone_geom, options);
+ draw.draw_cone_geom(h_ax, cone_geom, options);
end
diff --git a/matlab/algorithms/plot_geom/draw/draw_fanflat_vec_geom.m b/matlab/algorithms/plot_geom/+draw/draw_fanflat_vec_geom.m
index b8261cf..761d96a 100644
--- a/matlab/algorithms/plot_geom/draw/draw_fanflat_vec_geom.m
+++ b/matlab/algorithms/plot_geom/+draw/draw_fanflat_vec_geom.m
@@ -43,7 +43,7 @@ function [ output_args ] = draw_fanflat_vec_geom( h_ax, geom, options)
detector.width = geom.DetectorCount;
detector.origin = detector_center(options.VectorIdx, :);
- vertices = draw_detector_vec(h_ax, detector, options);
+ vertices = draw.draw_detector_vec(h_ax, detector, options);
connect_source_detector(h_ax, vertices, detector_center,...
xray_source, options);
diff --git a/matlab/algorithms/plot_geom/draw/draw_parallel3d_geom.m b/matlab/algorithms/plot_geom/+draw/draw_parallel3d_geom.m
index 45a8d60..45a8d60 100644
--- a/matlab/algorithms/plot_geom/draw/draw_parallel3d_geom.m
+++ b/matlab/algorithms/plot_geom/+draw/draw_parallel3d_geom.m
diff --git a/matlab/algorithms/plot_geom/draw/draw_parallel3d_vec_geom.m b/matlab/algorithms/plot_geom/+draw/draw_parallel3d_vec_geom.m
index ab63e43..e59fa91 100644
--- a/matlab/algorithms/plot_geom/draw/draw_parallel3d_vec_geom.m
+++ b/matlab/algorithms/plot_geom/+draw/draw_parallel3d_vec_geom.m
@@ -35,7 +35,7 @@ function [ ] = draw_parallel3d_vec_geom( h_ax, geom, options)
detector.height = geom.DetectorColCount;
detector.width = geom.DetectorRowCount;
detector.origin = detector_center(options.VectorIdx, :);
- detector.vertices = draw_detector_vec(h_ax, detector, options);
+ detector.vertices = draw.draw_detector_vec(h_ax, detector, options);
connect_source_detector(h_ax, detector, detector_center, xray_source,...
options);
diff --git a/matlab/algorithms/plot_geom/draw/draw_proj_geom.m b/matlab/algorithms/plot_geom/+draw/draw_proj_geom.m
index c20ddc8..9691448 100644
--- a/matlab/algorithms/plot_geom/draw/draw_proj_geom.m
+++ b/matlab/algorithms/plot_geom/+draw/draw_proj_geom.m
@@ -53,14 +53,14 @@ function [] = draw_proj_geom(geom, varargin)
disp('DistanceOriginDetector inf');
disp('DistanceOriginSource inf');
- draw_parallel3d_geom(h_ax, geom, options);
+ draw.draw_parallel3d_geom(h_ax, geom, options);
case 'parallel3d_vec'
disp('type: parallel3d_vec')
disp(['detector px: [' num2str(geom.DetectorRowCount), ', '...
num2str(geom.DetectorColCount) ']']);
disp(['# angles: ' num2str(size(geom.Vectors, 1))]);
- draw_parallel3d_vec_geom(h_ax, geom, options);
+ draw.draw_parallel3d_vec_geom(h_ax, geom, options);
case 'cone'
disp('type: cone');
disp(['detector spacing: [' num2str(geom.DetectorSpacingX), ', '...
@@ -73,14 +73,14 @@ function [] = draw_proj_geom(geom, varargin)
disp(['DistanceOriginDetector ' num2str(geom.DistanceOriginDetector)]);
disp(['DistanceOriginSource ' num2str(geom.DistanceOriginSource)]);
- draw_cone_geom(h_ax, geom, options);
+ draw.draw_cone_geom(h_ax, geom, options);
case 'cone_vec'
disp('type: cone_vec');
disp(['detector px: [' num2str(geom.DetectorRowCount), ', ' ...
num2str(geom.DetectorColCount) ']']);
disp(['# angles: ' num2str(size(geom.Vectors, 1))]);
- draw_cone_vec_geom(h_ax, geom, options);
+ draw.draw_cone_vec_geom(h_ax, geom, options);
case 'fanflat'
disp('type: fanflat');
disp(['detector px: ' num2str(geom.DetectorCount)]);
@@ -92,13 +92,13 @@ function [] = draw_proj_geom(geom, varargin)
disp(['DistanceOriginSource '...
num2str(geom.DistanceOriginSource)]);
- draw_fanflat_geom(h_ax, geom, options);
+ draw.draw_fanflat_geom(h_ax, geom, options);
case 'fanflat_vec'
disp('type: fanflat_vec');
disp(['detector px: ' num2str(geom.DetectorCount)]);
disp(['# angles: ' num2str(size(geom.Vectors, 1))]);
- draw_fanflat_vec_geom(h_ax, geom, options);
+ draw.draw_fanflat_vec_geom(h_ax, geom, options);
otherwise
error(['Unknown geometry type ' geom.type])
end
@@ -119,7 +119,7 @@ function [] = draw_proj_geom(geom, varargin)
options.SourceMarkerColor = '';
options.SourceDistance = 100;
options.OpticalAxisColor = '';
- options = parseargs(options, input_args{:});
+ options = parseargs.parseargs(options, input_args{:});
% if the color is still empty, replace by global color
if strcmpi(options.DetectorMarkerColor , '')
diff --git a/matlab/algorithms/plot_geom/draw/draw_vol_geom.m b/matlab/algorithms/plot_geom/+draw/draw_vol_geom.m
index 0b4fe2f..65126c2 100644
--- a/matlab/algorithms/plot_geom/draw/draw_vol_geom.m
+++ b/matlab/algorithms/plot_geom/+draw/draw_vol_geom.m
@@ -36,7 +36,7 @@ function [] = draw_vol_geom( vol_geom, varargin)
options.Color = 'r';
options.LineWidth = 2;
options.Magnification = 1;
- options = parseargs(options, varargin{:});
+ options = parseargs.parseargs(options, varargin{:});
hold on;
phantom_height = vol_geom.GridRowCount * vx_size;
diff --git a/matlab/algorithms/plot_geom/util/eucl_dist3d.m b/matlab/algorithms/plot_geom/+draw/private/eucl_dist3d.m
index 57d6cb4..57d6cb4 100644
--- a/matlab/algorithms/plot_geom/util/eucl_dist3d.m
+++ b/matlab/algorithms/plot_geom/+draw/private/eucl_dist3d.m
diff --git a/matlab/algorithms/plot_geom/util/parseargs/license.txt b/matlab/algorithms/plot_geom/+parseargs/license.txt
index cae4cd5..cae4cd5 100644
--- a/matlab/algorithms/plot_geom/util/parseargs/license.txt
+++ b/matlab/algorithms/plot_geom/+parseargs/license.txt
diff --git a/matlab/algorithms/plot_geom/util/parseargs/parseargs.m b/matlab/algorithms/plot_geom/+parseargs/parseargs.m
index 05ad613..05ad613 100644
--- a/matlab/algorithms/plot_geom/util/parseargs/parseargs.m
+++ b/matlab/algorithms/plot_geom/+parseargs/parseargs.m
diff --git a/matlab/algorithms/plot_geom/util/stlTools/license.txt b/matlab/algorithms/plot_geom/+stlTools/license.txt
index b2d00b0..b2d00b0 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/license.txt
+++ b/matlab/algorithms/plot_geom/+stlTools/license.txt
diff --git a/matlab/algorithms/plot_geom/util/stlTools/readme.txt b/matlab/algorithms/plot_geom/+stlTools/readme.txt
index b8037d6..b8037d6 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/readme.txt
+++ b/matlab/algorithms/plot_geom/+stlTools/readme.txt
diff --git a/matlab/algorithms/plot_geom/util/stlTools/stlAddVerts.m b/matlab/algorithms/plot_geom/+stlTools/stlAddVerts.m
index bc4ecbc..1894cd7 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/stlAddVerts.m
+++ b/matlab/algorithms/plot_geom/+stlTools/stlAddVerts.m
@@ -6,6 +6,8 @@ function [vnew, fnew] = stlAddVerts(v, f, list)
%VNEW is the new array of vertices
%FNEW is the new array of faces
+import stlTools.*
+
% triangulation just with the slice
faces = delaunay(list(:,1),list(:,2)); % calculate new faces
% update object
diff --git a/matlab/algorithms/plot_geom/util/stlTools/stlDelVerts.m b/matlab/algorithms/plot_geom/+stlTools/stlDelVerts.m
index 718ac53..718ac53 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/stlDelVerts.m
+++ b/matlab/algorithms/plot_geom/+stlTools/stlDelVerts.m
diff --git a/matlab/algorithms/plot_geom/util/stlTools/stlDemo.m b/matlab/algorithms/plot_geom/+stlTools/stlDemo.m
index e82d8db..af46315 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/stlDemo.m
+++ b/matlab/algorithms/plot_geom/+stlTools/stlDemo.m
@@ -1,5 +1,7 @@
%% STLDEMO shows how to use the functions included in the toolbox STLTOOLS
+import stlTools.*
+
%% EXAMPLE 1.- How to cut a sphere and close the base to get a semisphere
% load an ascii STL sample file (STLGETFORMAT and STLREADASCII)
diff --git a/matlab/algorithms/plot_geom/util/stlTools/stlGetFormat.m b/matlab/algorithms/plot_geom/+stlTools/stlGetFormat.m
index 6901b26..6901b26 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/stlGetFormat.m
+++ b/matlab/algorithms/plot_geom/+stlTools/stlGetFormat.m
diff --git a/matlab/algorithms/plot_geom/util/stlTools/stlGetVerts.m b/matlab/algorithms/plot_geom/+stlTools/stlGetVerts.m
index 179eff3..179eff3 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/stlGetVerts.m
+++ b/matlab/algorithms/plot_geom/+stlTools/stlGetVerts.m
diff --git a/matlab/algorithms/plot_geom/util/stlTools/stlPlot.m b/matlab/algorithms/plot_geom/+stlTools/stlPlot.m
index e9f17c5..e9f17c5 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/stlPlot.m
+++ b/matlab/algorithms/plot_geom/+stlTools/stlPlot.m
diff --git a/matlab/algorithms/plot_geom/util/stlTools/stlRead.m b/matlab/algorithms/plot_geom/+stlTools/stlRead.m
index 8803516..5775e50 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/stlRead.m
+++ b/matlab/algorithms/plot_geom/+stlTools/stlRead.m
@@ -5,6 +5,8 @@ function [v, f, n, name] = stlRead(fileName)
%N are the normals
%NAME is the name of the STL object (NOT the name of the STL file)
+import stlTools.*
+
format = stlGetFormat(fileName);
if strcmp(format,'ascii')
[v,f,n,name] = stlReadAscii(fileName);
diff --git a/matlab/algorithms/plot_geom/util/stlTools/stlReadAscii.m b/matlab/algorithms/plot_geom/+stlTools/stlReadAscii.m
index 4490662..b035aa8 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/stlReadAscii.m
+++ b/matlab/algorithms/plot_geom/+stlTools/stlReadAscii.m
@@ -5,6 +5,8 @@ function [v, f, n, name] = stlReadAscii(fileName)
%N are the normals
%NAME is the name of the STL object (NOT the name of the STL file)
+import stlTools.*
+
%======================
% STL ascii file format
%======================
diff --git a/matlab/algorithms/plot_geom/util/stlTools/stlReadBinary.m b/matlab/algorithms/plot_geom/+stlTools/stlReadBinary.m
index 314455d..3e04f7a 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/stlReadBinary.m
+++ b/matlab/algorithms/plot_geom/+stlTools/stlReadBinary.m
@@ -5,6 +5,8 @@ function [v, f, n, name] = stlReadBinary(fileName)
%N are the normals
%NAME is the name of the STL object (NOT the name of the STL file)
+import stlTools.*
+
%=======================
% STL binary file format
%=======================
diff --git a/matlab/algorithms/plot_geom/util/stlTools/stlSlimVerts.m b/matlab/algorithms/plot_geom/+stlTools/stlSlimVerts.m
index 2781067..2781067 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/stlSlimVerts.m
+++ b/matlab/algorithms/plot_geom/+stlTools/stlSlimVerts.m
diff --git a/matlab/algorithms/plot_geom/util/stlTools/stlWrite.m b/matlab/algorithms/plot_geom/+stlTools/stlWrite.m
index 0ce5d46..0ce5d46 100644
--- a/matlab/algorithms/plot_geom/util/stlTools/stlWrite.m
+++ b/matlab/algorithms/plot_geom/+stlTools/stlWrite.m
diff --git a/matlab/algorithms/plot_geom/astra_create_example_fanflat.m b/matlab/algorithms/plot_geom/astra_create_example_fanflat.m
index 703a618..251cb47 100644
--- a/matlab/algorithms/plot_geom/astra_create_example_fanflat.m
+++ b/matlab/algorithms/plot_geom/astra_create_example_fanflat.m
@@ -19,8 +19,8 @@ function [ geom ] = create_example_fanflat( type )
if strcmpi(type, 'normal')
geom = make_normal_geometry();
elseif strcmpi(type, 'vec')
- geom = create_example_fanflat('normal');
- geom = fanflat_to_fanflat_vec(geom);
+ geom = astra_create_example_fanflat('normal');
+ geom = astra_geom_2vec(geom);
else
geom = make_normal_geometry();
diff --git a/matlab/algorithms/plot_geom/util/magnify_proj.m b/matlab/algorithms/plot_geom/private/magnify_proj.m
index 73e892a..73e892a 100644
--- a/matlab/algorithms/plot_geom/util/magnify_proj.m
+++ b/matlab/algorithms/plot_geom/private/magnify_proj.m
diff --git a/matlab/algorithms/plot_geom/util/rotate_around3d.m b/matlab/algorithms/plot_geom/private/rotate_around3d.m
index e9f152b..e9f152b 100644
--- a/matlab/algorithms/plot_geom/util/rotate_around3d.m
+++ b/matlab/algorithms/plot_geom/private/rotate_around3d.m
diff --git a/matlab/algorithms/plot_geom/util/rotate_detector.m b/matlab/algorithms/plot_geom/private/rotate_detector.m
index 019f92a..019f92a 100644
--- a/matlab/algorithms/plot_geom/util/rotate_detector.m
+++ b/matlab/algorithms/plot_geom/private/rotate_detector.m
diff --git a/matlab/algorithms/plot_geom/util/rotate_euler3d.m b/matlab/algorithms/plot_geom/private/rotate_euler3d.m
index 6fddb57..6fddb57 100644
--- a/matlab/algorithms/plot_geom/util/rotate_euler3d.m
+++ b/matlab/algorithms/plot_geom/private/rotate_euler3d.m
diff --git a/matlab/algorithms/plot_geom/util/translate_3d.m b/matlab/algorithms/plot_geom/private/translate_3d.m
index bd51485..bd51485 100644
--- a/matlab/algorithms/plot_geom/util/translate_3d.m
+++ b/matlab/algorithms/plot_geom/private/translate_3d.m
diff --git a/matlab/algorithms/plot_geom/util/cone_to_cone_vec.m b/matlab/algorithms/plot_geom/util/cone_to_cone_vec.m
deleted file mode 100644
index 0075db9..0000000
--- a/matlab/algorithms/plot_geom/util/cone_to_cone_vec.m
+++ /dev/null
@@ -1,41 +0,0 @@
-function [ cone_vec_geom] = cone_to_cone_vec( cone_geom )
-%% cone_to_cone_vec.m
-% brief convert a cone beam projection geometry into a
-% cone_vec geometry according to:
-% http://www.astra-toolbox.com/docs/geom3d.html#projection-geometries
-%
-% param cone_geom the cone beam geometry to convert
-% return cone_vec_geom the converted geometry
-%
-% date 21.06.2018
-% author Tim Elberfeld
-% imec VisionLab
-% University of Antwerp
-%%
- num_angles = numel(cone_geom.ProjectionAngles);
- vectors = zeros(num_angles, 12);
-
- for idx = 1:num_angles
- % source
- vectors(idx, 1) = sin(cone_geom.ProjectionAngles(idx)) * cone_geom.DistanceOriginSource;
- vectors(idx, 2) = -cos(cone_geom.ProjectionAngles(idx)) * cone_geom.DistanceOriginSource;
- vectors(idx, 3) = 0;
-
- % center of detector
- vectors(idx, 4) = -sin(cone_geom.ProjectionAngles(idx)) * cone_geom.DistanceOriginDetector;
- vectors(idx, 5) = cos(cone_geom.ProjectionAngles(idx)) * cone_geom.DistanceOriginDetector;
- vectors(idx, 6) = 0;
-
- % vector from detector pixel (0,0) to (0,1)
- vectors(idx, 7) = cos(cone_geom.ProjectionAngles(idx)) * cone_geom.DetectorSpacingX;
- vectors(idx, 8) = sin(cone_geom.ProjectionAngles(idx)) * cone_geom.DetectorSpacingX;
- vectors(idx, 9) = 0;
-
- % vector from detector pixel (0,0) to (1,0)
- vectors(idx, 10) = 0;
- vectors(idx, 11) = 0;
- vectors(idx, 12) = cone_geom.DetectorSpacingY;
- end
-
- cone_vec_geom = astra_create_proj_geom('cone_vec', cone_geom.DetectorRowCount, cone_geom.DetectorColCount, vectors);
-end
diff --git a/matlab/algorithms/plot_geom/util/fanflat_to_fanflat_vec.m b/matlab/algorithms/plot_geom/util/fanflat_to_fanflat_vec.m
deleted file mode 100644
index 9707592..0000000
--- a/matlab/algorithms/plot_geom/util/fanflat_to_fanflat_vec.m
+++ /dev/null
@@ -1,4 +0,0 @@
-function [ vec_geom] = fanflat_to_fanflat_vec( geom )
- vec_geom = astra_geom_2vec(geom);
-end
-
diff --git a/matlab/tools/astra_plot_geom.m b/matlab/tools/astra_plot_geom.m
index 3a654fd..62eed79 100644
--- a/matlab/tools/astra_plot_geom.m
+++ b/matlab/tools/astra_plot_geom.m
@@ -64,14 +64,16 @@ function [] = astra_plot_geom(geometry, varargin)
% Contact: astra@astra-toolbox.com
% Website: http://www.astra-toolbox.com/
%--------------------------------------------------------------------------
- addpath(genpath('../algorithms/plot_geom')); % add plot_geom tools to matlab path
+ if exist('astra_create_example_cone') ~= 2
+ error('Please add astra/algorithms/plot_geom to your path to use this function')
+ end
if is_vol_geom(geometry)
- draw_vol_geom(geometry, varargin{:});
+ draw.draw_vol_geom(geometry, varargin{:});
elseif is_proj_geom(geometry)
- draw_proj_geom(geometry, varargin{:});
+ draw.draw_proj_geom(geometry, varargin{:});
elseif ischar(geometry) % assume 'geometry' is a path to a CAD file
- draw_cad_phantom(geometry, varargin{:});
+ draw.draw_cad_phantom(geometry, varargin{:});
end
% ---- helper functions ----
diff --git a/samples/matlab/s024_plot_geometry.m b/samples/matlab/s024_plot_geometry.m
index dd57997..6c4c3f0 100644
--- a/samples/matlab/s024_plot_geometry.m
+++ b/samples/matlab/s024_plot_geometry.m
@@ -13,6 +13,11 @@
%%
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');
@@ -20,7 +25,7 @@ proj_geom = astra_create_example_cone('helix');
% proj_geom = astra_create_example_fanflat('vec');
% proj_geom = astra_create_example_fanflat();
% proj_geom = astra_create_example_parallel3d();
-% proj_geom = create_example_cone('deform_vec');
+% proj_geom = astra_create_example_cone('deform_vec');
astra_plot_geom(proj_geom);
hold on;