1- function generate_results(project_path , name , segmentation_configs , classifications , animals_trajectories_map , b_pressed , groups )
1+ function error = generate_results(project_path , name , segmentation_configs , classifications , animals_trajectories_map , b_pressed , groups )
22% GENERATE_RESULTS creates results folder tree, forms the final results and
33% saves them inside the specific folders
4-
4+
5+ error = 1 ;
56 dir_list = build_results_tree(project_path , b_pressed , name , length(classifications ), groups );
7+
8+ % Check if segmentation and classification have the same segments
9+ segs = size(segmentation_configs .FEATURES_VALUES_SEGMENTS ,1 );
10+ try
11+ segs_ = size(classifications{1 }.FEATURES,1 );
12+ catch
13+ segs_ = size(classifications .FEATURES ,1 );
14+ end
15+ if segs ~= segs_
16+ errordlg(' Selected classification and segmentation do not match' ,' Error' );
17+ return
18+ end
619
720 h = waitbar(0 ,' Generating results...' ,' Name' ,' Results' );
821 % Variables of interest:
@@ -89,11 +102,12 @@ function generate_results(project_path, name, segmentation_configs, classificati
89102 create_average_figure(vals_ ,vals_grps_ ,pos_ ,dir_list{end },total_trials ,class_tags );
90103 case ' Probabilities'
91104 fpath = fullfile(dir_list{end },' pvalues_summary.csv' );
92- error = create_average_probs(vals_ ,class_tags ,fpath );
105+ error = create_average_probs(vals_ ,class_tags ,fpath , groups );
93106 if error
94107 errordlg(' Could not create summary file' );
95108 end
96109 delete(h );
110+ error = 0 ;
97111 return ;
98112 end
99113 if length(groups ) > 1 ;
@@ -104,5 +118,6 @@ function generate_results(project_path, name, segmentation_configs, classificati
104118 end
105119 end
106120 delete(h );
121+ error = 0 ;
107122end
108123
0 commit comments