-
Notifications
You must be signed in to change notification settings - Fork 42
/
runAlignment.m
70 lines (48 loc) · 1.8 KB
/
runAlignment.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function outputStruct = runAlignment(fileName,outputPath,startImage,finalImage,parameters)
%runAlignment runs the alignment and segmentation routines on a .avi file
% and saves the output files to a directorty
%
% Input variables:
%
% fileName -> avi file to be analyzed
% outputPath -> path to which files are saved
% startImage -> first image in path to be analyzed
% finalImage -> last image in path to be analyzed
% parameters -> struct containing non-default choices for parameters
%
%
% Output variable:
%
% outputStruct -> struct containing found alignment variables
%
% (C) Gordon J. Berman, 2014
% Princeton University
if ~exist(outputPath,'dir')
mkdir(outputPath);
end
if nargin < 3 || isempty(startImage)
startImage = 1;
end
if nargin < 4 || isempty(finalImage)
finalImage = [];
end
if nargin < 5 || isempty(parameters)
parameters = [];
end
parameters = setRunParameters(parameters);
setup_parpool(parameters.numProcessors)
[Xs,Ys,angles,areas,~,framesToCheck,svdskipped,areanorm] = ...
alignImages_Radon_parallel_avi(fileName,startImage,finalImage,...
outputPath,parameters);
%See alignImages_Radon_parallel_avi for definitions of these variables
outputStruct.Xs = Xs;
outputStruct.Ys = Ys;
outputStruct.angles = angles;
outputStruct.areas = areas;
outputStruct.parameters = parameters;
outputStruct.framesToCheck = framesToCheck;
outputStruct.svdskipped = svdskipped;
outputStruct.areanorm = areanorm;
if parameters.numProcessors > 1 && parameters.closeMatPool
close_parpool
end