Skip to content

Commit aa1c621

Browse files
committed
waitbars
1 parent c5cf158 commit aa1c621

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

features/compute_features.m

+9-2
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@
1010
else
1111
div = 1000;
1212
end
13-
13+
14+
h = waitbar(0,'Computing features...','Name','Computing Features');
15+
1416
featval_all = zeros(length(obj), length(features));
1517
for idx = 1:length(features)
1618
featval = zeros(length(obj),1);
1719
fprintf('\nComputing ''%s'' feature values for %d trajectories/segments...', features{idx}{1,2}, length(obj));
1820
q = floor(length(obj) / div);
1921
fprintf('0.0% ');
20-
22+
23+
str = ['Feature ',num2str(idx),'/',num2str(length(features)),': ',sprintf('%s',features{idx}{1,2})];
24+
waitbar(0,h,str);
25+
2126
for i = 1:length(obj)
2227
switch length(features{idx})
2328
case 3 % no COMMON_PROPERTIES and Extra Values
@@ -68,6 +73,7 @@
6873
end
6974

7075
% show the progress
76+
waitbar(i/length(obj));
7177
if mod(i, q) == 0
7278
val = 100.*i/length(obj);
7379
if val < 10.
@@ -80,5 +86,6 @@
8086
fprintf('\b\b\b\b\bDone.\n');
8187
featval_all(:, idx) = featval(:, idx);
8288
end
89+
delete(h);
8390
end
8491

gui.m

+7-7
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ function load_traj_buttom_Callback(hObject, eventdata, handles)
273273
switch choice
274274
case 'Yes'
275275
[groups_path] = animal_groups(paths, get(handles.field_id,'String'), str2num(get(handles.text_sessions,'String')));
276+
if isempty(groups_path)
277+
return;
278+
end
276279
case 'No'
277280
groups_path = {};
278281
disp('No animal groups specified. All animals will belong to group 1');
@@ -314,17 +317,11 @@ function load_traj_buttom_Callback(hObject, eventdata, handles)
314317
segmentation_configs = config_segments(user_input);
315318
if isempty(segmentation_configs.TRAJECTORIES)
316319
% resume main GUI visibility
317-
set(temp,'Visible','on');
318-
if isempty(groups_path)
319-
return;
320-
end
320+
set(temp,'Visible','on');
321321
return;
322322
end
323323
% resume main GUI visibility
324324
set(temp,'Visible','on');
325-
if isempty(groups_path)
326-
return;
327-
end
328325
% check if object is already cached and if not save it
329326
rpath = check_cached_objects(segmentation_configs,1);
330327
set(handles.seg_path,'String',rpath);
@@ -457,7 +454,10 @@ function browse_trajectories_Callback(hObject, eventdata, handles)
457454
%% CODE FOR RESULTS BUTTONS %%
458455

459456
function res_test_Callback(hObject, eventdata, handles)
457+
temp = findall(gcf);
458+
set(temp,'Visible','off');
460459
published_results('execute');
460+
set(temp,'Visible','on');
461461

462462
function lat_sp_len_Callback(hObject, eventdata, handles)
463463
% see if we have the path for the segmentation_config file

0 commit comments

Comments
 (0)