Skip to content

Commit 5bb34aa

Browse files
committed
added option for duration of pause
1 parent d843d73 commit 5bb34aa

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

CNMFSetParms.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@
7676
% PLOT COMPONENTS (view_patches.m)
7777
'plot_df ' % flag for displaying DF/F estimates (default: 1)
7878
'make_gif ' % save animation (default: 0)
79-
'make_anim ' % view animation (default: 1)
8079
'save_avi ' % save video (default: 0)
80+
'pause_time ' % time to pause between each component (default: Inf, user has to click)
8181
];
8282

8383
[m,n] = size(Names);
@@ -227,8 +227,8 @@
227227
% PLOT COMPONENTS (plot_patches.m)
228228
{1}
229229
{0}
230-
{1}
231230
{0}
231+
{Inf}
232232
];
233233

234234
for j = 1:m

utilities/view_components.m

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ function view_components(Y,A,C,b,f,Cn,options)
2121
if ~isfield(options,'plot_df') || isempty(options.plot_df); options.df = defoptions.plot_df; end
2222
plot_df = options.plot_df;
2323
if ~isfield(options,'make_gif') || isempty(options.make_gif); options.make_gif = defoptions.make_gif; end
24-
make_gif = options.make_gif;
25-
if ~isfield(options,'make_anim') || isempty(options.make_anim); options.make_anim = defoptions.make_anim; end
26-
make_anim = options.make_anim;
24+
make_gif = options.make_gif;
2725
if ~isfield(options,'save_avi') || isempty(options.save_avi); options.save_avi = defoptions.save_avi; end
2826
save_avi = options.save_avi;
2927
if ~isfield(options,'sx') || isempty(options.sx); options.sx = defoptions.sx; end
3028
sx = min([options.sx,floor(d1/2),floor(d2/2)]);
29+
if ~isfield(options,'pause_time') || isempty(options.pause_time); options.pause_time = defoptions.pause_time; end
30+
pause_time = options.pause_time;
3131
if isfield(options,'name') && ~isempty(options.name);
3232
name = [options.name,'_components'];
3333
else
@@ -117,7 +117,7 @@ function view_components(Y,A,C,b,f,Cn,options)
117117
drawnow;
118118
hold off;
119119
if make_gif
120-
frame = getframe(1);
120+
frame = getframe(fig); %getframe(1);
121121
im = frame2im(frame);
122122
[imind,clm] = rgb2ind(im,256);
123123
if i == 1;
@@ -128,14 +128,18 @@ function view_components(Y,A,C,b,f,Cn,options)
128128
else
129129
if i < nr+nb && ~save_avi
130130
fprintf('component %i. Press any key to continue.. \n', i);
131-
pause;
131+
if pause_time == Inf;
132+
pause;
133+
else
134+
pause(pause_time);
135+
end
132136
end
133137
end
134138
else
135139
plot(1:T,f(i-nr,:)); title('Background activity','fontsize',16,'fontweight','bold');
136140
drawnow;
137141
if make_gif
138-
frame = getframe(1);
142+
frame = getframe(fig); %getframe(1);
139143
im = frame2im(frame);
140144
[imind,clm] = rgb2ind(im,256);
141145
if i == 1;
@@ -146,7 +150,11 @@ function view_components(Y,A,C,b,f,Cn,options)
146150
else
147151
if i < nr+nb && ~save_avi
148152
fprintf('background component %i. Press any key to continue.. \n', i-nr);
149-
pause;
153+
if pause_time == Inf;
154+
pause;
155+
else
156+
pause(pause_time);
157+
end
150158
end
151159
end
152160
end

0 commit comments

Comments
 (0)