-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakeMovie.m
34 lines (33 loc) · 895 Bytes
/
makeMovie.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
function res = makeMovie(SEG, timeDimension, colorMap);
% makeMovie
% Make a movie out of XxYxZ 'matrix' SEG.
% The 'Z' coordinate will be used as the
% time dimension in the movie.
%
% Example:
% movie(makeMovie(A));
% The following will make and play the movie for A using the y-dimension
% as time, and a copper-tone color map:
% movie(makeMovie(A, 2, copper));
% The following will instead make the movie and save it externally
% as an AVI file:
% movie2avi(makeMovie(A), 'a_movie.avi');
% G.Sfikas 24 Mar 2007
%
if nargin < 3
colorMap = YR_colors;
if nargin < 2
timeDimension = 3;
end
end
if isempty(timeDimension)
timeDimension = 3;
end
SEG = shiftdim(SEG, 3-timeDimension);
colormap(colorMap);
for slice = 1:size(SEG, 3)
imagesc(SEG(:,:,slice));
movieSEG(slice) = getframe();
end
res = movieSEG;
return;