DREAMS / global_assessmentMethod.m
lemonLHC
Initial upload: DREAMS raw archives + docs + training plan
b131c6d
Raw
History Blame Contribute Delete
6.9 kB
function global_assessmentMethod (filepath,indice_excerpts,duration_event)
%function global_assessmentMethod compute the global results of the assessmentMethod applied to a set of excerpts
%filepath= pathway of the files of the database
%indice_excerpts= vector with the index of the considered excerpts
%duration_event= the average duration (in second) of the microevent detected (for the approximation of the True Negative number #TN)
%
%examples:
%
% filepath='C:\DEVUYST\DataBaseSpindles\';
% indice_excerpts=[1:6];%excerpts for the test
% duration_event=1;
% global_assessmentMethod (filepath,indice_excerpts,duration_event)
%
% or
%
% filepath='C:\DEVUYST\DataBaseKcomplexes\';
% indice_excerpts=[1:5];%excerpts for the test
% duration_event=1;
% global_assessmentMethod (filepath,indice_excerpts,duration_event)
%
% or
%
% filepath='C:\DEVUYST\DataBaseREMs\';
% indice_excerpts=[1:9];
% duration_event=1;
% global_assessmentMethod (filepath,indice_excerpts,duration_event)
%
% or
%
% filepath='C:\DEVUYST\DataBasePLMs\';
% indice_excerpts=[6:10];
% duration_event=3;
% global_assessmentMethod (filepath,indice_excerpts,duration_event)
%
nbr_types=struct('nbrtot_scored_by_system',zeros(1,7),'nbrtot_scored_by_visual1',zeros(1,7),'nbrtot_scored_by_visual2',zeros(1,7),'nbr_scored_only_by_sys__type2',zeros(1,7),'nbr_scored_only_by_vis1__type3A',zeros(1,7),'nbr_scored_only_by_vis2__type3B',zeros(1,7),'nbr_scored_only_by_systEvis1__type1A',zeros(1,7),'nbr_scored_only_by_systEvis2__type1B',zeros(1,7),'nbr_scored_only_by_vis1Evis2__type3C',zeros(1,7),'nbr_scored_by_vis1Evis2Esyst__type1C',zeros(1,7),'type3D',zeros(1,7),'type5A',zeros(1,7),'type5B',zeros(1,7),'type5C',zeros(1,7),'nbr_aut_multiple',zeros(1,7),'nbr_vis1_multiple',zeros(1,7),'nbr_vis2_multiple',zeros(1,7));
confusion_matrix_aut_Vis1=zeros(2,2);
confusion_matrix_aut_Vis2=zeros(2,2);
confusion_matrix_Vis1_Vis2=zeros(2,2);
confusion_matrix_Vis2_Vis1=zeros(2,2);
confusion_matrix_aut_Vis1uVis2=zeros(2,2);
confusion_matrix_aut_Vis1nVis2=zeros(2,2);
for num_excerpt=indice_excerpts
nbr_types_temp=[];
confusion_matrix_aut_Vis1_temp=[];
confusion_matrix_aut_Vis2_temp=[];
confusion_matrix_Vis1_Vis2_temp=[];
confusion_matrix_Vis2_Vis1_temp=[];
confusion_matrix_aut_Vis1uVis2_temp=[];
confusion_matrix_aut_Vis1nVis2_temp=[];
filename_edf=[filepath,'excerpt',num2str(num_excerpt),'.edf'];
filename_Automatic_detection=[filepath,'Automatic_detection_excerpt',num2str(num_excerpt),'.txt'];
filename_Visual_scoring1=[filepath,'Visual_scoring1_excerpt',num2str(num_excerpt),'.txt'];
filename_Visual_scoring2=[filepath,'Visual_scoring2_excerpt',num2str(num_excerpt),'.txt'];
if exist(filename_Visual_scoring2,'file')==0
filename_Visual_scoring2='';
end
filename_Hypnogram=[filepath,'Hypnogram_excerpt',num2str(num_excerpt),'.txt'];
if exist(filename_Hypnogram,'file')==0
filename_Hypnogram='';
end
[nbr_types_temp,confusion_matrix_aut_Vis1_temp,confusion_matrix_aut_Vis2_temp,confusion_matrix_Vis1_Vis2_temp,confusion_matrix_Vis2_Vis1_temp,confusion_matrix_aut_Vis1uVis2_temp,confusion_matrix_aut_Vis1nVis2_temp]=assessmentMethod(filename_edf,filename_Automatic_detection,filename_Visual_scoring1,filename_Visual_scoring2,filename_Hypnogram,duration_event);
nbr_types=setfield(nbr_types, 'nbrtot_scored_by_system',getfield(nbr_types, 'nbrtot_scored_by_system')+getfield(nbr_types_temp, 'nbrtot_scored_by_system'));
nbr_types=setfield(nbr_types, 'nbrtot_scored_by_visual1',getfield(nbr_types, 'nbrtot_scored_by_visual1')+getfield(nbr_types_temp, 'nbrtot_scored_by_visual1'));
nbr_types=setfield(nbr_types, 'nbrtot_scored_by_visual2',getfield(nbr_types, 'nbrtot_scored_by_visual2')+getfield(nbr_types_temp, 'nbrtot_scored_by_visual2'));
nbr_types=setfield(nbr_types, 'nbr_scored_only_by_sys__type2',getfield(nbr_types, 'nbr_scored_only_by_sys__type2')+getfield(nbr_types_temp, 'nbr_scored_only_by_sys__type2'));
nbr_types=setfield(nbr_types, 'nbr_scored_only_by_vis1__type3A',getfield(nbr_types, 'nbr_scored_only_by_vis1__type3A')+getfield(nbr_types_temp, 'nbr_scored_only_by_vis1__type3A'));
nbr_types=setfield(nbr_types, 'nbr_scored_only_by_vis2__type3B',getfield(nbr_types, 'nbr_scored_only_by_vis2__type3B')+getfield(nbr_types_temp, 'nbr_scored_only_by_vis2__type3B'));
nbr_types=setfield(nbr_types, 'nbr_scored_only_by_systEvis1__type1A',getfield(nbr_types, 'nbr_scored_only_by_systEvis1__type1A')+getfield(nbr_types_temp, 'nbr_scored_only_by_systEvis1__type1A'));
nbr_types=setfield(nbr_types, 'nbr_scored_only_by_systEvis2__type1B',getfield(nbr_types, 'nbr_scored_only_by_systEvis2__type1B')+getfield(nbr_types_temp, 'nbr_scored_only_by_systEvis2__type1B'));
nbr_types=setfield(nbr_types, 'nbr_scored_only_by_vis1Evis2__type3C',getfield(nbr_types, 'nbr_scored_only_by_vis1Evis2__type3C')+getfield(nbr_types_temp, 'nbr_scored_only_by_vis1Evis2__type3C'));
nbr_types=setfield(nbr_types, 'nbr_scored_by_vis1Evis2Esyst__type1C',getfield(nbr_types, 'nbr_scored_by_vis1Evis2Esyst__type1C')+getfield(nbr_types_temp, 'nbr_scored_by_vis1Evis2Esyst__type1C'));
nbr_types=setfield(nbr_types, 'type3D',getfield(nbr_types, 'type3D')+getfield(nbr_types_temp, 'type3D'));
nbr_types=setfield(nbr_types, 'type5A',getfield(nbr_types, 'type5A')+getfield(nbr_types_temp, 'type5A'));
nbr_types=setfield(nbr_types, 'type5B',getfield(nbr_types, 'type5B')+getfield(nbr_types_temp, 'type5B'));
nbr_types=setfield(nbr_types, 'type5C',getfield(nbr_types, 'type5C')+getfield(nbr_types_temp, 'type5C'));
nbr_types=setfield(nbr_types, 'nbr_aut_multiple',getfield(nbr_types, 'nbr_aut_multiple')+getfield(nbr_types_temp, 'nbr_aut_multiple'));
nbr_types=setfield(nbr_types, 'nbr_vis1_multiple',getfield(nbr_types, 'nbr_vis1_multiple')+getfield(nbr_types_temp, 'nbr_vis1_multiple'));
nbr_types=setfield(nbr_types, 'nbr_vis2_multiple',getfield(nbr_types, 'nbr_vis2_multiple')+getfield(nbr_types_temp, 'nbr_vis2_multiple'));
confusion_matrix_aut_Vis1=confusion_matrix_aut_Vis1+confusion_matrix_aut_Vis1_temp;
confusion_matrix_aut_Vis2=confusion_matrix_aut_Vis2+confusion_matrix_aut_Vis2_temp;
confusion_matrix_Vis1_Vis2=confusion_matrix_Vis1_Vis2+confusion_matrix_Vis1_Vis2_temp;
confusion_matrix_Vis2_Vis1=confusion_matrix_Vis2_Vis1+confusion_matrix_Vis2_Vis1_temp;
confusion_matrix_aut_Vis1uVis2=confusion_matrix_aut_Vis1uVis2+confusion_matrix_aut_Vis1uVis2_temp;
confusion_matrix_aut_Vis1nVis2=confusion_matrix_aut_Vis1nVis2+confusion_matrix_aut_Vis1nVis2_temp;
end
nbr_types
confusion_matrix_aut_Vis1
confusion_matrix_aut_Vis2
confusion_matrix_Vis1_Vis2
confusion_matrix_Vis2_Vis1
confusion_matrix_aut_Vis1uVis2
confusion_matrix_aut_Vis1nVis2