Authored by Anthony Boyer

Fix for the parsing of notes for REN patients. Fix stimulation detection issue f…

…or stimulation frequency <1Hz (FRE)
@@ -369,8 +369,16 @@ for c = 1:length(KeepEvent) % Navigate all stim events @@ -369,8 +369,16 @@ for c = 1:length(KeepEvent) % Navigate all stim events
369 xsub2 = cellstr(xsub2); 369 xsub2 = cellstr(xsub2);
370 S.StimFreq = 1; 370 S.StimFreq = 1;
371 StimFreq = 1; 371 StimFreq = 1;
372 - else  
373 - StimFreq=str2double(xsub2{1}(1:end-2)); 372 + else
  373 + % We assume a leading 0 implies a stimulation frequency <1 (e.g. 026 -> 0.26).
  374 + % Only used for the detection of stimulations (ImaGIN_StimDetect.m) Boyer.A 25/08/2020
  375 + freq_string = xsub2{1}(1:end-2);
  376 + match_freq = regexp(freq_string,'^0+(?<value>[0-9]+)$','once','names');
  377 + if ~isempty(match_freq)
  378 + StimFreq=str2double(['0.' match_freq.value]);
  379 + else
  380 + StimFreq=str2double(freq_string);
  381 + end
374 S.StimFreq = StimFreq; 382 S.StimFreq = StimFreq;
375 end 383 end
376 xsub3 = regexp(noteName,rxp3,'match'); 384 xsub3 = regexp(noteName,rxp3,'match');
@@ -108,7 +108,8 @@ for j=1:length(KeepEvent) % Navigate all stim events @@ -108,7 +108,8 @@ for j=1:length(KeepEvent) % Navigate all stim events
108 noteName(~ismember(double(noteName),['A':'Z' 'a':'z' '_' '.' '''' 'µ' '-' '0':'9'])) =''; 108 noteName(~ismember(double(noteName),['A':'Z' 'a':'z' '_' '.' '''' 'µ' '-' '0':'9'])) ='';
109 noteName = regexprep(noteName,'_+','_'); noteName = regexprep(noteName,'µ','u'); 109 noteName = regexprep(noteName,'_+','_'); noteName = regexprep(noteName,'µ','u');
110 if strcmpi(patientCode(5:end),'MIL');noteName = strrep(noteName,'.0',''); noteName = strrep(noteName,'_MA_','_');end%some MIL notes 110 if strcmpi(patientCode(5:end),'MIL');noteName = strrep(noteName,'.0',''); noteName = strrep(noteName,'_MA_','_');end%some MIL notes
111 - noteName = strrep(noteName,'.',''); noteName = strrep(noteName,',',''); 111 + if strcmpi(patientCode(5:end),'REN');noteName = strrep(noteName,'.0','');end%some REN notes
  112 + noteName = strrep(noteName,'.',''); noteName = strrep(noteName,',',''); % /!\ float value becomes integer /!\
112 noteName = strrep(noteName,'sec','s'); noteName = strrep(noteName,'AA','A'); 113 noteName = strrep(noteName,'sec','s'); noteName = strrep(noteName,'AA','A');
113 noteName = strrep(noteName,'Stim_Start_',''); noteName = strrep(noteName,'Stim_Stop_',''); 114 noteName = strrep(noteName,'Stim_Start_',''); noteName = strrep(noteName,'Stim_Stop_','');
114 noteName = strrep(noteName,'stim',''); noteName = strrep(noteName,'Stim',''); 115 noteName = strrep(noteName,'stim',''); noteName = strrep(noteName,'Stim','');