marianux / ecg-kit

A Matlab toolbox for cardiovascular signal processing
GNU General Public License v2.0
257 stars 85 forks source link

Error using readannot Requested array exceeds the maximum possible variable size when perform QRS detection #19

Open Qudor-Engineer opened 2 years ago

Qudor-Engineer commented 2 years ago

Hi @marianux thank you very much for the great ECG kit, it helped me a lot during my PhD.

I tried to run QRS detection using ECGkit (latest version) in MATLAB R2021b on Ubuntu 20.04 but I got an error that says "Error using readannot Requested array exceeds the maximum possible variable size when perform QRS detection". actually, my ECG array size is 15000 samples and the file size on the disk is around 115 kB. Also, I changed the maximum array size in the MATLAB workspace preferences to the maximum (10000) and stopped the option of "Limit array size to percentage of RAM" but still the same. I wish you could help me to solve this problem. Thank you in advance

my code:

% Load the ECG signals and QRS detection files
for i = 1:112
    if i < 19

       % Load normal ECG signals
       dname='/home/qudor/Documents/PhD/PhD/Data4/Normal/Preprocessed/';

       % Load SCD 1 min ECG signals
    elseif i > 18 && i < 38
        dname='/home/qudor/Documents/PhD/PhD/Data4/SCD1/Preprocessed/';

        % Load SCD 30 min ECG signals
    elseif i > 37 && i < 57
        dname='/home/qudor/Documents/PhD/PhD/Data4/SCD30/Preprocessed/';

        % Load SCD 60 min ECG signals
    elseif i > 56 && i < 76
        dname='/home/qudor/Documents/PhD/PhD/Data4/SCD60/Preprocessed/';

        % Load SCD 90 min ECG signals
    elseif i > 75 && i < 95
        dname='/home/qudor/Documents/PhD/PhD/Data4/SCD90/Preprocessed/';

    else
       % Load SCD 120 min ECG signals
       dname='/home/qudor/Documents/PhD/PhD/Data4/SCD120/Preprocessed/';

    end
       file=[num2str(i) '.mat'];
       fname=fullfile(dname,file);

       fileQRS=[num2str(i) '_QRS_detection.mat'];
       fnameQRS=fullfile(dname,fileQRS);

       tmp_path = '/home/qudor/Documents/PhD/PhD/Data4/delineation/';

 %% QRS Detection

       ECGw = ECGwrapper('recording_name',fname, 'ECGtaskHandle', 'QRS_detection');

       ECGw.Run

 %% ECG Delineation

  ECGw.ECGtaskHandle = 'ECG_delineation';

  ECGw.ECGtaskHandle.payload = load(fnameQRS);

  ECGw.Run

 clear ECGw file fileQRS fnameQRS fname dname
end

fprintf('QRS detection and ECG delineation Completed! \n')

=================== and this is the output with the error:

Description of the process:
 + Recording: /home/qudor/Documents/PhD/PhD/Data4/Normal/Preprocessed/1.mat
 + Task name: QRS_detection                                                

Processing QRS detector aristotle

###############################################
# Could not execute "aristotle" QRS detector. #
###############################################

Processing QRS detector ecgpuwave

###############################################
# Could not execute "ecgpuwave" QRS detector. #
###############################################

Processing QRS detector epltdqrs1

####################################################
# epltdqrs1 failed in recording 1_1_15000 lead ecg #
####################################################

Processing QRS detector epltdqrs2
cd /tmp/;epltdqrs1 -r 1_1_15000 -s 0 -m 1: Signal 127

####################################################
# epltdqrs2 failed in recording 1_1_15000 lead ecg #
####################################################

Processing QRS detector gqrs
cd /tmp/;epltdqrs2 -r 1_1_15000 -s 0 -m 1: Signal 127
Error using ECGtask_QRS_detection/Process (line 480)
gqrs failed in recording 1_1_15000 lead ecg

Error report:
Error using readannot
Requested array exceeds the maximum possible variable size.

Error in ECGtask_QRS_detection/Process (line 448)
                                            anns_test = readannot(file_name_orig);

Error in ECGwrapper/Run (line 682)
                            payload = obj.ECGtaskHandle.Process(ECG, this_iter_ECG_start_idx, this_iter_ECG_relative_start_end_idx,
                            this_header, this_ann, [this_iter_QRS_start_idx this_iter_QRS_end_idx] );

Error in Automated_ECGkit (line 52)
       ECGw.Run

Related documentation

Error in ECGwrapper/Run (line 682)
                            payload = obj.ECGtaskHandle.Process(ECG, this_iter_ECG_start_idx, this_iter_ECG_relative_start_end_idx, this_header, this_ann, [this_iter_QRS_start_idx this_iter_QRS_end_idx] );

Error in Automated_ECGkit (line 52)
       ECGw.Run
marianux commented 2 years ago

Hi Khudur! and thanks for reporting and found the kit useful.

El vie, 14 ene 2022 a la(s) 05:18, KHUDHUR ALFARHAN ( @.***) escribió:

Hi @marianux https://github.com/marianux thank you very much for the great ECG kit, it helped me a lot during my PhD.

great!

I tried to run QRS detection using ECGkit (latest version) in MATLAB R2021b on Ubuntu 20.04 but I got an error that says "Error using readannot Requested array exceeds the maximum possible variable size when perform QRS detection". actually, my ECG array size is 15000 samples and the file size on the disk is around 115 kB.

this overflow does not make any sense, should be a bug, lets see

Also, I changed the maximum array size in the MATLAB workspace preferences to the maximum (10000) and stopped the option of "Limit array size to percentage of RAM" but still the same. I wish you could help me to solve this problem. Thank you in advance

ok lets see, I remember many bugs regarding overflows in the C routines such as readannot.c, which in this case seems to be the responsible of the bug. Some things you can try:

I have no time to mantain the kit anymore, but I can give you this little help if you found it useful.

Best luck and regards, M.

my code:

% Load the ECG signals and QRS detection files for i = 1:112 if i < 19

   % Load normal ECG signals
   dname='/home/qudor/Documents/PhD/PhD/Data4/Normal/Preprocessed/';

   % Load SCD 1 min ECG signals
elseif i > 18 && i < 38
    dname='/home/qudor/Documents/PhD/PhD/Data4/SCD1/Preprocessed/';

    % Load SCD 30 min ECG signals
elseif i > 37 && i < 57
    dname='/home/qudor/Documents/PhD/PhD/Data4/SCD30/Preprocessed/';

    % Load SCD 60 min ECG signals
elseif i > 56 && i < 76
    dname='/home/qudor/Documents/PhD/PhD/Data4/SCD60/Preprocessed/';

    % Load SCD 90 min ECG signals
elseif i > 75 && i < 95
    dname='/home/qudor/Documents/PhD/PhD/Data4/SCD90/Preprocessed/';

else
   % Load SCD 120 min ECG signals
   dname='/home/qudor/Documents/PhD/PhD/Data4/SCD120/Preprocessed/';

end
   file=[num2str(i) '.mat'];
   fname=fullfile(dname,file);

   fileQRS=[num2str(i) '_QRS_detection.mat'];
   fnameQRS=fullfile(dname,fileQRS);

   tmp_path = '/home/qudor/Documents/PhD/PhD/Data4/delineation/';

%% QRS Detection

   ECGw = ECGwrapper('recording_name',fname, 'ECGtaskHandle', 'QRS_detection');

   ECGw.Run

%% ECG Delineation

ECGw.ECGtaskHandle = 'ECG_delineation';

ECGw.ECGtaskHandle.payload = load(fnameQRS);

ECGw.Run

clear ECGw file fileQRS fnameQRS fname dname end

fprintf('QRS detection and ECG delineation Completed! \n')

=================== and this is the output with the error:

Description of the process:

  • Recording: /home/qudor/Documents/PhD/PhD/Data4/Normal/Preprocessed/1.mat
  • Task name: QRS_detection

Processing QRS detector aristotle

###############################################

Could not execute "aristotle" QRS detector.

###############################################

Processing QRS detector ecgpuwave

###############################################

Could not execute "ecgpuwave" QRS detector.

###############################################

Processing QRS detector epltdqrs1

####################################################

epltdqrs1 failed in recording 1_1_15000 lead ecg

####################################################

Processing QRS detector epltdqrs2

####################################################

epltdqrs2 failed in recording 1_1_15000 lead ecg

####################################################

Processing QRS detector gqrs cd /home/qudor/Documents/PhD/PhD/Data4/delineation/;epltdqrs1 -r 1_1_15000 -s 0 -m 1: Signal 127 cd /home/qudor/Documents/PhD/PhD/Data4/delineation/;epltdqrs2 -r 1_1_15000 -s 0 -m 1: Signal 127 Error using ECGtask_QRS_detection/Process (line 480) gqrs failed in recording 1_1_15000 lead ecg

Error report: Error using readannot Requested array exceeds the maximum possible variable size.

Error in ECGtask_QRS_detection/Process (line 448) anns_test = readannot(file_name_orig);

Error in ECGwrapper/Run (line 682) payload = obj.ECGtaskHandle.Process(ECG, this_iter_ECG_start_idx, this_iter_ECG_relative_start_end_idx, this_header, this_ann, [this_iter_QRS_start_idx this_iter_QRS_end_idx] );

Error in Automated_ECGkit (line 55) ECGw.Run

Related documentation

Error in ECGwrapper/Run (line 682) payload = obj.ECGtaskHandle.Process(ECG, this_iter_ECG_start_idx, this_iter_ECG_relative_start_end_idx, this_header, this_ann, [this_iter_QRS_start_idx this_iter_QRS_end_idx] );

Error in Automated_ECGkit (line 55) ECGw.Run

Automated_ECGkit

Description of the process:

  • Recording: /home/qudor/Documents/PhD/PhD/Data4/Normal/Preprocessed/1.mat
  • Task name: QRS_detection

Processing QRS detector aristotle

###############################################

Could not execute "aristotle" QRS detector.

###############################################

Processing QRS detector ecgpuwave

###############################################

Could not execute "ecgpuwave" QRS detector.

###############################################

Processing QRS detector epltdqrs1

####################################################

epltdqrs1 failed in recording 1_1_15000 lead ecg

####################################################

Processing QRS detector epltdqrs2

####################################################

epltdqrs2 failed in recording 1_1_15000 lead ecg

####################################################

Processing QRS detector gqrs cd /tmp/;epltdqrs1 -r 1_1_15000 -s 0 -m 1: Signal 127 cd /tmp/;epltdqrs2 -r 1_1_15000 -s 0 -m 1: Signal 127 Error using ECGtask_QRS_detection/Process (line 480) gqrs failed in recording 1_1_15000 lead ecg

Error report: Error using readannot Requested array exceeds the maximum possible variable size.

Error in ECGtask_QRS_detection/Process (line 448) anns_test = readannot(file_name_orig);

Error in ECGwrapper/Run (line 682) payload = obj.ECGtaskHandle.Process(ECG, this_iter_ECG_start_idx, this_iter_ECG_relative_start_end_idx, this_header, this_ann, [this_iter_QRS_start_idx this_iter_QRS_end_idx] );

Error in Automated_ECGkit (line 52) ECGw.Run

Related documentation

Error in ECGwrapper/Run (line 682) payload = obj.ECGtaskHandle.Process(ECG, this_iter_ECG_start_idx, this_iter_ECG_relative_start_end_idx, this_header, this_ann, [this_iter_QRS_start_idx this_iter_QRS_end_idx] );

Error in Automated_ECGkit (line 52) ECGw.Run

— Reply to this email directly, view it on GitHub https://github.com/marianux/ecg-kit/issues/19, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBRMNDTVVWLMELWOMIXUALUV7L5RANCNFSM5L6D77RA . You are receiving this because you were mentioned.Message ID: @.***>

Qudor-Engineer commented 2 years ago

Thanks for the fast replay. I tried my code and data with MATLAB 2017b and I changed the maximum array size in the MATLAB workspace preferences to the maximum (10000) and stopped the option of "Limit array size to percentage of RAM" and it is working without any issues. Hopefully, this information gives you a hint to help update the ECG kit in the future or at least be helpful for someone else using ECGkit and facing the same problem.