diff --git a/common/ECGtask_ECG_delineation.m b/common/ECGtask_ECG_delineation.m index b5adce8..c782ccc 100644 --- a/common/ECGtask_ECG_delineation.m +++ b/common/ECGtask_ECG_delineation.m @@ -180,20 +180,23 @@ function Start(obj, ECG_header, ECG_annotations) fnames = fieldnames(obj.payload); aux_idx = find(cell2mat( cellfun(@(a)(~isempty(strfind(a, 'corrected_'))), fnames, 'UniformOutput', false))); + + aux_struct = obj.payload; + if( isempty(aux_idx) ) - if( isfield(obj.payload, 'series_quality') ) - [~, aux_idx] = sort(obj.payload.series_quality.ratios, 'descend'); - aux_val = obj.payload.(obj.payload.series_quality.AnnNames{aux_idx(1),1}).(obj.payload.series_quality.AnnNames{aux_idx(1),2}) - ECG_start_offset + 1; + if( isfield(aux_struct, 'series_quality') ) + [~, aux_idx] = sort(aux_struct.series_quality.ratios, 'descend'); + aux_val = aux_struct.(aux_struct.series_quality.AnnNames{aux_idx(1),1}).(aux_struct.series_quality.AnnNames{aux_idx(1),2}) - ECG_start_offset + 1; aux_val = aux_val( aux_val >= ECG_sample_start_end_idx(1) & aux_val < ECG_sample_start_end_idx(2) ); - obj.payload = aux_val; + aux_struct = aux_val; else for fname = rowvec(fnames) - if( isfield(obj.payload.(fname{1}), 'time') ) - aux_val = obj.payload.(fname{1}).time - ECG_start_offset + 1; + if( isfield(aux_struct.(fname{1}), 'time') ) + aux_val = aux_struct.(fname{1}).time - ECG_start_offset + 1; aux_val = aux_val( aux_val >= ECG_sample_start_end_idx(1) & aux_val < ECG_sample_start_end_idx(2) ); - obj.payload = aux_val; + aux_struct = aux_val; break end end @@ -201,9 +204,9 @@ function Start(obj, ECG_header, ECG_annotations) else for ii = rowvec(aux_idx) - aux_val = obj.payload.(fnames{ii}).time - ECG_start_offset + 1; + aux_val = aux_struct.(fnames{ii}).time - ECG_start_offset + 1; aux_val = aux_val( aux_val >= ECG_sample_start_end_idx(1) & aux_val < ECG_sample_start_end_idx(2) ); - obj.payload = aux_val; + aux_struct = aux_val; end end @@ -235,7 +238,7 @@ function Start(obj, ECG_header, ECG_annotations) try - [position_multilead, positions_single_lead] = wavedet_interface(ECG, ECG_header, obj.payload, obj.lead_idx, obj.wavedet_config, ECG_sample_start_end_idx, ECG_start_offset, obj.progress_handle); + [position_multilead, positions_single_lead] = wavedet_interface(ECG, ECG_header, aux_struct, obj.lead_idx, obj.wavedet_config, ECG_sample_start_end_idx, ECG_start_offset, obj.progress_handle); for jj = 1:length(obj.lead_idx) payload_out.wavedet.(obj.lead_names{obj.lead_idx(jj)}) = positions_single_lead(jj); @@ -269,7 +272,7 @@ function Start(obj, ECG_header, ECG_annotations) ECG_header_aux = trim_ECG_header(ECG_header, obj.lead_idx); - [positions_single_lead, position_multilead] = ud_func_pointer( double(ECG(:,obj.lead_idx)), ECG_header_aux, obj.progress_handle, obj.payload); + [positions_single_lead, position_multilead] = ud_func_pointer( double(ECG(:,obj.lead_idx)), ECG_header_aux, obj.progress_handle, aux_struct); % filter and offset delineation for jj = 1:length(obj.lead_idx) diff --git a/common/ECGtask_QRS_detections_post_process.m b/common/ECGtask_QRS_detections_post_process.m index c3e9c8e..a88898b 100644 --- a/common/ECGtask_QRS_detections_post_process.m +++ b/common/ECGtask_QRS_detections_post_process.m @@ -112,13 +112,16 @@ function Start(obj, ECG_header, ECG_annotations) if( isstruct(obj.payload) ) AnnNames = obj.payload.series_quality.AnnNames(:,1); + aux_struct = obj.payload; for fn = rowvec(AnnNames) aux_val = obj.payload.(fn{1}).time - ECG_start_offset + 1; aux_val = aux_val( aux_val >= ECG_sample_start_end_idx(1) & aux_val < ECG_sample_start_end_idx(2) ); - obj.payload.(fn{1}).time = aux_val; + aux_struct.(fn{1}).time = aux_val; end + else + return end for this_func = rowvec(obj.post_proc_func) @@ -130,7 +133,7 @@ function Start(obj, ECG_header, ECG_annotations) % this_func_ptr = eval(['@' this_func]); this_func_ptr = str2func(this_func{1}); - this_payload = this_func_ptr( obj.payload, ECG_header, ECG_sample_start_end_idx ); + this_payload = this_func_ptr( aux_struct, ECG_header, ECG_sample_start_end_idx ); for fn = rowvec(fieldnames(this_payload)) payload_out.(fn{1}) = this_payload.(fn{1}); diff --git a/common/ECGwrapper.m b/common/ECGwrapper.m index dacfc87..55e67dc 100644 --- a/common/ECGwrapper.m +++ b/common/ECGwrapper.m @@ -104,7 +104,7 @@ % maximum debugging email report file size max_report_filesize = 4 * 1024^2; % bytes % Maximum time to wait for other PIDs finishing their work. - Time2WaitPIDs = 2 * 60; % seconds. + Time2WaitPIDs = 0 * 60; % seconds. end