@@ -3,6 +3,7 @@ function demo_gui(set,user_path)
33% and produces the results
44
55 user_path = char_project_path(user_path );
6+ h = waitbar(0 ,' Initializing...' );
67
78 %% Create project folder tree (set_folder.m)
89 if set == 1
@@ -14,6 +15,7 @@ function demo_gui(set,user_path)
1415 return
1516 end
1617 project_path = fullfile(user_path ,' demo_original_set_1' );
18+ waitbar(1 / 2 );
1719
1820 %% Copy the settings mat files (skip gui_project.m)
1921 if isdeployed
@@ -35,6 +37,8 @@ function demo_gui(set,user_path)
3537 end
3638 ptags = fullfile(datapath ,' tags.txt' );
3739 copyfile(ptags ,fullfile(project_path ,' settings' ));
40+ waitbar(2 / 2 );
41+ delete(h );
3842
3943 %% Segmentation
4044 try
@@ -85,20 +89,44 @@ function demo_gui(set,user_path)
8589 end
8690
8791 %% Results
92+ groups = [1 ,2 ];
93+ [exit , animals_trajectories_map ] = trajectories_map(segmentation_configs ,groups ,' Friedman' ,set );
94+
95+ % METRICS
96+ groups = [1 ,2 ];
97+ str = num2str(groups );
98+ str = regexprep(str ,' [^\w'' ]' ,' ' ); % remove gaps
99+ str = strcat(' group' ,str );
100+ output_dir = fullfile(project_path ,' results' ,' metrics' ,str );
101+ if ~exist(output_dir ,' dir' )
102+ mkdir(output_dir );
103+ end
104+ try
105+ results_latency_speed_length(segmentation_configs ,animals_trajectories_map ,1 ,output_dir );
106+ catch
107+ errordlg(' Error: metrics generation' ,' Error' );
108+ end
109+
110+ % STATISTICS
111+ [error ,~ ,~ ] = class_statistics(project_path , class_name );
112+ if error
113+ errordlg(' Error: statistics generation' ,' Error' );
114+ end
115+
116+ % STRATEGIES - TRANSITIONS - PROBABILITIES
88117 b_pressed = {' Strategies' ,' Transitions' ,' Probabilities' };
89118 class = {' class_1301_10388_250_07_10_10_mr0-tiago' ,' class_1657_29476_250_09_10_10_mr0-tiago' };
90119 for j = 1 : length(seg_name )
91120 % check if everything is ok
92- if ~exist(fullfile(project_path ,' Mclassification' ,class{j }),' file' )
93- errordlg(' Cannot create results' ,' Error' );
121+ if ~exist(fullfile(project_path ,' Mclassification' ,class{j }),' file' )
122+ errordlg(' Check fail for results: strategies, transitions and probabilities ' ,' Error' );
94123 return
95124 end
96125 % Generate the animals_trajectories_map
97126 load(fullfile(project_path ,' segmentation' ,seg_name{j }));
98- groups = [1 ,2 ];
99- [exit , animals_trajectories_map ] = trajectories_map(segmentation_configs ,groups ,' Friedman' ,set );
100127 if exit
101128 errordlg(' Cannot create the animals_trajectories_map' ,' Error' );
129+ return
102130 end
103131 % Check the classification
104132 [error ,name ,classifications ] = check_classification(project_path ,segmentation_configs ,class{j });
@@ -110,10 +138,25 @@ function demo_gui(set,user_path)
110138 for i = 1 : length(b_pressed )
111139 error = generate_results(project_path , name , segmentation_configs , classifications , animals_trajectories_map , b_pressed{i }, groups );
112140 if error
113- errordlg(' Cannot generate results' ,' Error' );
141+ errordlg(' Cannot create results for strategies, transitions and probabilities ' ,' Error' );
114142 return
115143 end
116144 end
117145 end
146+
147+ %% Labelling Quality
148+ % [nc,res1bare,res2bare,res1,res2,res3,covering] = results_clustering_parameters(segmentation_configs,labels,0,output_path,10,100,1);
149+ % output_path = char(fullfile(project_path,'results',strcat(p,'_cross_validation')));
150+ % if exist(output_path,'dir');
151+ % rmdir(output_path,'s');
152+ % end
153+ % mkdir(output_path);
154+ % [nc,per_errors1,per_undefined1,coverage] = algorithm_statistics(1,1,nc,res1bare,res2bare,res1,res2,res3,covering);
155+ % data = [nc', per_errors1', per_undefined1', coverage'];
156+ % % export results to CSV file
157+ % export_num_of_clusters(output_path,data);
158+ % % generate graphs
159+ % results_clustering_parameters_graphs(output_path,nc,res1bare,res2bare,res1,res2,res3,covering);
160+ % set(temp(idx),'Visible','on');
118161end
119162
0 commit comments