ECG example

206 views
Skip to first unread message

edg...@comcast.net

unread,
Aug 2, 2015, 4:05:41 PM8/2/15
to ecg-kit users
Hello,

I am excited to try your software, as I am have not found good public domain software for PVC detection and annotation. I am a physician and not an engineer (with some physionet prior use and programming experience), so your software does seem a bit complex.

First: I am using Matlab R2011b - should I upgrade to 2013x or will it work in this version? I am also using a Mac running OS X 10.9.5. Has the software worked for others on a MAC?

I installed the software after commenting out the .mex line as recommended by others.

Now I can't run the example programs because I get the error:

Undefined function 'readannot' for input arguments of type 'char'.

Error in ECGwrapper/CheckECGrecording (line 1631)
                            ann_aux = readannot(aux_str{1});   

Error in ECGwrapper/CheckArguments (line 1527)
            obj = CheckECGrecording(obj);

Error in ECGwrapper/Run (line 284)
                obj = obj.CheckArguments();

Error in examples (line 144)
            ECG_w.Run;

When I look at the .m files in the common directory, there is radannot.c and .mex, etc but no readannot.m

I am using the software version: marianuc-ecg-kit-d460295

Thoughts?

tx  Ed

Mariano Llamedo Soria

unread,
Aug 2, 2015, 4:25:58 PM8/2/15
to edg...@comcast.net, ecg-kit users
Hi Ed, thanks for trying the kit in first place. As you already noticed, it is oriented to biengineering, computer science and more technical people than physicians. It may be easy to use for these kind of people, but certainly not to physicians. As I also noticed, you are not a typical physician (does physician also code in Matlab ?? :) ), and I will be happy to try to help you in detecting/classifying ventricular heartbeats. I will comment your email


On Sun, Aug 2, 2015 at 5:05 PM, <edg...@comcast.net> wrote:
Hello,

I am excited to try your software, as I am have not found good public domain software for PVC detection and annotation. I am a physician and not an engineer (with some physionet prior use and programming experience), so your software does seem a bit complex.

First: I am using Matlab R2011b - should I upgrade to 2013x or will it work in this version? I am also using a Mac running OS X 10.9.5. Has the software worked for others on a MAC?


I thinks that R2011b is ok. I did not tested there, but should work, I dont remember major changes since that version. MAC also should work, but we did not tested yet, since we are not MAC users. There has been one guy who did some progress in MAC, maybe he could help if he is reading.

 
I installed the software after commenting out the .mex line as recommended by others.


Well I think that here is the problem, as we did not compiled the .c files for MAC, and we did not include the binaries (the product of compiling .c files), the commenting .mex trick will not work for MAC. You have to uncomment and compile the .c files. I think that this could be out of your skill, but you may search in this forum some MAC user and ask him for help. 

Now I can't run the example programs because I get the error:

Undefined function 'readannot' for input arguments of type 'char'.

Error in ECGwrapper/CheckECGrecording (line 1631)
                            ann_aux = readannot(aux_str{1});   

Error in ECGwrapper/CheckArguments (line 1527)
            obj = CheckECGrecording(obj);

Error in ECGwrapper/Run (line 284)
                obj = obj.CheckArguments();

Error in examples (line 144)
            ECG_w.Run;

When I look at the .m files in the common directory, there is radannot.c and .mex, etc but no readannot.m


Yes, all this error is because you haven't compiled the readannot during installation. Try to uninstall and install again after uncommenting the .mex compiling lines. We can start trying to compile .c files in MAC, and finish installation without errors.
 
I am using the software version: marianuc-ecg-kit-d460295


If you can, pull the last version from the github repository, for that you must install git in your computer.
 
Thoughts?

tx  Ed

Good luck !
Mariano.
 

--
You received this message because you are subscribed to the Google Groups "ecg-kit users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ecg-kit-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ecg-kit-users/18692e40-5193-48c9-a113-4d75c1c6d60c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

edg...@comcast.net

unread,
Aug 2, 2015, 8:51:00 PM8/2/15
to ecg-kit users, edg...@comcast.net
Hmm. Many problems.

I am still using Matlab r2011b. The compatible C compiler is Xcode 4.1. But I can not install because I am using Os 10.9 (Mavericks) and the installer will not work.

So I tried installing Xcode 5.2 - which was the lowest version working with mavericks.

I used the mex -setup option. 

But I still get the gcc-4.2: "command not found" error.

So my current plan is to upgrade to Matlab 2013b which should work with X code 5.2 and your software.

But it would be helpful to know if anyone has gotten this software to run on a MAC running OS 10.9.

Another option would be to install parallels (or similar) running windows on the MAC - and then install a PC version of Matlab R2013b and your software.

Thoughts?

Tx

Ed

Mariano Llamedo Soria

unread,
Aug 2, 2015, 8:57:15 PM8/2/15
to edg...@comcast.net, ecg-kit users
Ed, your plan seems reasonable for me. Let me know what happen when you install all the compatible software.

Regards,
M.

--
You received this message because you are subscribed to the Google Groups "ecg-kit users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ecg-kit-user...@googlegroups.com.

edg...@comcast.net

unread,
Aug 2, 2015, 9:52:26 PM8/2/15
to ecg-kit users, edg...@comcast.net
One more question:

I also would like to use the WFDB toolkit for Matlab for visualizing and analyzing signals. For this I need R2014a or later. I notice you ask to use 2013b and not 2014. Any info on whether your software will work with R2014a on a MAC?

Ed

Mariano Llamedo Soria

unread,
Aug 2, 2015, 10:01:12 PM8/2/15
to Edward Gerstenfeld, ecg-kit users

Ecg-kit works on 2014x, the problems appear when trying to print reports and using graphical tools. There has been a major change regarding graphics handling un this versión that has been corrected in 2015a.

M

edg...@comcast.net

unread,
Aug 2, 2015, 10:33:35 PM8/2/15
to ecg-kit users, edg...@comcast.net
Using the graphic tools to view and correct annotations is important to me (but not printing). Can these tools be used? Is it better to use 2015a than 2014x?

Mariano Llamedo Soria

unread,
Aug 2, 2015, 10:35:27 PM8/2/15
to Edward Gerstenfeld, ecg-kit users

Yes, use 2015a if you can.

M

El 02/08/2015 23:33, <edg...@comcast.net> escribió:
Using the graphic tools to view and correct annotations is important to me (but not printing). Can these tools be used? Is it better to use 2015a than 2014x?

--
You received this message because you are subscribed to the Google Groups "ecg-kit users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ecg-kit-user...@googlegroups.com.

edg...@comcast.net

unread,
Aug 4, 2015, 2:10:00 AM8/4/15
to ecg-kit users, edg...@comcast.net
Hi. I have updated Matlab to R2015a. This includes Xcode C compiler.

Now when I run ECGkitinstall I get this error:

checking for updates
Compiling sources
Building with 'Xcode with Clang'.
Error using mex
/Users/edwardgerstenfeld/Documents/MATLAB/marianux-ecg-kit-d460295/common/rdsign212.c:5:10:
fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^
1 error generated.


Error in InstallECGkit (line 165)
              eval(['mex -outdir ''' common_path ''' ''' [common_path
              source_files(ii).name] '''']);

Do I need malloc.cor can I remove this #include statement??

Tx

Ed

Mariano Llamedo Soria

unread,
Aug 4, 2015, 7:54:04 AM8/4/15
to Edward Gerstenfeld, ecg-kit users
Great Ed ! it seems that we are compiling now :)

I think that malloc header is not necessary there, I commented out and still compiling in Win architecture, please check there and tell us back.


Thanks and good luck !
M.



--
You received this message because you are subscribed to the Google Groups "ecg-kit users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ecg-kit-user...@googlegroups.com.

Mariano Llamedo Soria

unread,
Aug 4, 2015, 6:11:25 PM8/4/15
to Edward Gerstenfeld, ecg-kit users
Hi Ed, nice to see progress from your side. Well it seems that started to compile and the installation was successful, however these warnings should be corrected, maybe when some problem appear from other MAC user.

With respect to the examples, two things that you will have to debug, or try to fix. The part of the kit that is having problems is the one related to the WFDB toolbox for matlab. See the folder common/wfdb there are several precompiled binaries from the wfdb-toolbox for matlab, that you are already using, since I saw you in that list ;) Try first to make those binaries work, and then they will work in the kit. For example execute gqrs or wqrs and should through the help to the console. The other errors are related to failures of these commands.

Let start with this, good luck ! 
M.



On Tue, Aug 4, 2015 at 5:39 PM, <edgerst@comcast.net> wrote:
see prior email. When I run the "examples" example I get the following error. Seems to be a problem with the "fieldnames" statement.

examples

Description of the process:
+ Recording: /Users/edwardgerstenfeld/Documents/MATLAB/marianux-ecg-kit-d460295/recordings/208.dat
+ Task name: QRS_detection

Processing QRS detector gqrs

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


Undefined function 'fieldnames' for input arguments of type 'double'.

Error in getAnnNames (line 32)
for fname = rowvec(fieldnames(aux_struct))


Error in calculateSeriesQuality (line 40)
[AnnNames, all_annotations] = getAnnNames(payload_out);


Error in ECGtask_QRS_detection/Process (line 476)
payload_out = calculateSeriesQuality(payload_out, ECG_header, [1 ECG_header.nsamp] + ECG_start_offset - 1 );


Error in ECGwrapper/Run (line 672)
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 examples (line 144)
ECG_w.Run;


##########################################################################################################################################
# Could not guess the format of /Users/edwardgerstenfeld/Documents/MATLAB/marianux-ecg-kit-d460295/recordings/208_arbitrary_function.mat #
##########################################################################################################################################


##########################################################################################################################################################
# Could not guess the format of /Users/edwardgerstenfeld/Documents/MATLAB/marianux-ecg-kit-d460295/recordings/208_my_experiment_name_ECG_delineation.mat #
##########################################################################################################################################################


########################################################################################################################################################
# Could not guess the format of /Users/edwardgerstenfeld/Documents/MATLAB/marianux-ecg-kit-d460295/recordings/208_my_experiment_name_QRS_detection.mat #
########################################################################################################################################################




*** When I ask for help on the field names command I get the following. It seems to be expecting a string and not double. What do u think?


help fieldnames
fieldnames Get structure field names or object properties.
NAMES = fieldnames(S) returns a cell array of strings containing
the names of the fields in structure S.

NAMES = fieldnames(Obj) returns a cell array of strings containing
the names of the public properties of Obj. MATLAB objects can overload
fieldnames and define their own behavior.

NAMES = fieldnames(Obj,'-full') returns a cell array of strings
containing the name, type, attributes, and inheritance of the
properties of Obj. Only supported for COM or Java objects.

See also isfield, getfield, setfield, orderfields, rmfield.

Other functions named fieldnames



From: "Mariano Llamedo Soria" <llam...@gmail.com>
To: "Edward Gerstenfeld" <edg...@comcast.net>
Cc: "ecg-kit users" <ecg-ki...@googlegroups.com>
Sent: Tuesday, August 4, 2015 4:53:45 AM
Subject: Re: ECG example

Ricardo Salinas

unread,
Nov 23, 2024, 6:50:59 AM11/23/24
to ecg-kit users
Hi Mariano!

Thanks for the creating ecg-kit and for keep it updated on GitHub. 
I forked and cloned your latest version to install it on Monterrey 12.7.5 wit MATLAB R2024a. 
I had similar problems with the InstallECGkit() as those mentioned by Edward. After "successfully" compiling the mex files I also had troubles with the gqrs detector from WFDB (# Could not execute "gqrs" QRS detector. #). I am aware of the READ ME FIRST!  and that's why I used "successfully". Just as Edward did, I compiled using Xcode with Clang. Given that on this conversation (apparently) it was not a problem, I did not compile with gcc-4.9. 

QUESTION: Do I needed to compile on MAC with gcc-4.9 or Xcode with Clang is ok?
Before trying gcc-4.9 I want to see if there is something else that could have gone wrong. 

Testing the gqrs in common/wfdb/macosx-x86_64/bin
I have tried in MATLAB command window 
cd cg-kit/common/wfdb/macosx-x86_64/bin
[status, ~] = system("gqrs -r 100 -f 0:0 -t 3:0") %(without the files 100.dat and .hea in bin)
[status, ~] = system("gqrs -r 100 -f 0:0 -t 3:0") %(with the files 100.dat and .hea in bin)
in both cases status ~= 0
I tried in terminal with the files 100.dat and .hea in bin
gqrs -r 100
gqrs: command not found 

QUESTION: How should I test bin/gqrs?

Thanks in advance!
Best, 
Ricardo

marianux

unread,
Nov 25, 2024, 7:02:33 AM11/25/24
to ecg-kit users
Hi Ricardo, when I added Physionet's WFDB detectors to the ECG-kit it was patched "just as it worked by that time". Probably software versions and time made things stop working in twelve years. If you need this to work assap, my first suggestion is go back to versions older than 2015. If you can't, or you dont want to do that, then you have to dive into the code. I am not using Matlab since version 2016, so I can not help you much at this time, other than explaining and guiding through the code.

I remember that WFDB handles a lot of environment variables that I had to recreate from Matlab before invoking gqrs from a syscall. I mean you first have to declare where WFDB libs are installed, and then invoke gqrs, wqrs and so on. Look for this kind of env declarations, look inside the task that performs ECG detection. 

Good luck and regards,
M.
Reply all
Reply to author
Forward
0 new messages