-
Notifications
You must be signed in to change notification settings - Fork 41
/
runAnimation.m
57 lines (53 loc) · 1.35 KB
/
runAnimation.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
% Generates an animation
%
% Author: Jonathan Karr, [email protected]
% Affilitation: Covert Lab, Department of Bioengineering, Stanford University
% Last updated: 10/6/2011
function runAnimation(varargin)
setWarnings();
setPath();
setPreferences();
%import classes
import edu.stanford.covert.cell.sim.analysis.OverviewAnimation;
%options
if nargin >= 1
simBatchId = varargin{1};
end
if nargin >= 2
movieSubFolder = varargin{2}
else
movieSubFolder = 'movie';
end
if nargin >= 3
renderFrames = varargin{3};
if ischar(renderFrames)
renderFrames = str2double(renderFrames);
end
end
if nargin >= 4
jobIdx = varargin{4};
if ischar(jobIdx)
jobIdx = str2double(jobIdx);
end
end
if nargin >= 5
nJobs = varargin{5};
if ischar(nJobs)
nJobs = str2double(nJobs);
end
end
%make animation
outDir = [edu.stanford.covert.cell.sim.util.SimulationDiskUtil.getBaseDir() filesep simBatchId filesep movieSubFolder];
if ~exist(outDir, 'dir')
mkdir(outDir);
end
animator = OverviewAnimation(simBatchId, 1:10, [outDir filesep 'movie.avi'], 50);
animator.tmpDirectory = outDir;
if renderFrames
animator.run([jobIdx nJobs], true, true, false, false);
else
animator.run([], false, false, true, false);
animator.codec.ffmpeg = 'wmv2';
animator.movieFileName = [outDir filesep 'movie.wmv'];
animator.renderMovie();
end