diff --git a/scripts/matlab/AutoscoperConnection.m b/scripts/matlab/AutoscoperConnection.m index 5428599e..8040519e 100644 --- a/scripts/matlab/AutoscoperConnection.m +++ b/scripts/matlab/AutoscoperConnection.m @@ -343,14 +343,25 @@ function optimizeFrame(obj, volNum, frameNum, repeats, max_itr, min_lim, max_lim dframe = 1; end if nargin < 10 - opt_method = 0; + opt_method = OptimizationMethod.PARTICLE_SWARM_OPTIMIZATION; end if nargin < 11 - cf_model = 0; + cf_model = CostFunction.NORMALIZED_CROSS_CORRELATION; end if nargin < 12 - opt_init_heuristic = 0; + opt_init_heuristic = OptimizationInitializationHeuristic.PREVIOUS_FRAME; end + + if ~isenum(opt_method) + opt_method = OptimizationMethod(opt_method); + end + if ~isenum(cf_model) + cf_model = CostFunction(cf_model); + end + if ~isenum(opt_init_heuristic) + opt_init_heuristic = OptimizationInitializationHeuristic(opt_init_heuristic); + end + fwrite(obj.socket_descriptor, [ ... 11 ... typecast(int32(volNum), 'uint8') ... @@ -421,13 +432,23 @@ function trackingDialog(obj, volNum, startframe, endframe, repeats, max_itr, min dframe = 1; end if nargin < 11 - opt_method = 0; + opt_method = OptimizationMethod.PARTICLE_SWARM_OPTIMIZATION; end if nargin < 12 - cf_model = 0; + cf_model = CostFunction.NORMALIZED_CROSS_CORRELATION; end if nargin < 13 - opt_init_heuristic = 0; + opt_init_heuristic = OptimizationInitializationHeuristic.PREVIOUS_FRAME; + end + + if ~isenum(opt_method) + opt_method = OptimizationMethod(opt_method); + end + if ~isenum(cf_model) + cf_model = CostFunction(cf_model); + end + if ~isenum(opt_init_heuristic) + opt_init_heuristic = OptimizationInitializationHeuristic(opt_init_heuristic); end for i = startframe:endframe diff --git a/scripts/matlab/CostFunction.m b/scripts/matlab/CostFunction.m new file mode 100644 index 00000000..efbd553c --- /dev/null +++ b/scripts/matlab/CostFunction.m @@ -0,0 +1,6 @@ +classdef CostFunction < int32 + enumeration + NORMALIZED_CROSS_CORRELATION (0) + SUM_OF_ABSOLUTE_DIFFERENCES (1) + end +end diff --git a/scripts/matlab/OptimizationInitializationHeuristic.m b/scripts/matlab/OptimizationInitializationHeuristic.m new file mode 100644 index 00000000..a741e9f6 --- /dev/null +++ b/scripts/matlab/OptimizationInitializationHeuristic.m @@ -0,0 +1,8 @@ +classdef OptimizationInitializationHeuristic < int32 + enumeration + CURRENT_FRAME (0) + PREVIOUS_FRAME (1) + LINEAR_EXTRAPOLATION (2) + SPLINE_INTERPOLATION (3) + end +end diff --git a/scripts/matlab/OptimizationMethod.m b/scripts/matlab/OptimizationMethod.m new file mode 100644 index 00000000..9a751db8 --- /dev/null +++ b/scripts/matlab/OptimizationMethod.m @@ -0,0 +1,6 @@ +classdef OptimizationMethod < int32 + enumeration + PARTICLE_SWARM_OPTIMIZATION (0) + DOWNHILL_SIMPLEX (1) + end +end