diff -Naur wfdb-10.3.0/MANIFEST wfdb-10.3.1/MANIFEST --- wfdb-10.3.0/MANIFEST Mon Nov 25 23:59:30 2002 +++ wfdb-10.3.1/MANIFEST Thu Dec 5 03:27:29 2002 @@ -45,6 +45,7 @@ app/tach.c app/view.c app/vsetup.c +app/wabp.c app/wfdbcat.c app/wfdbcollate.c app/wfdb-config.c @@ -63,6 +64,7 @@ checkpkg/expected/100s.a2r checkpkg/expected/100s.mix checkpkg/expected/100s.qrs +checkpkg/expected/100s.sigavg checkpkg/expected/100s.wqrs checkpkg/expected/100s.wra checkpkg/expected/100w.dat @@ -309,6 +311,7 @@ doc/wag-src/tach.1 doc/wag-src/tmac.dif doc/wag-src/view.1 +doc/wag-src/wabp.1 doc/wag-src/wag.cover doc/wag-src/wag.ht0 doc/wag-src/wag.ht1 diff -Naur wfdb-10.3.0/Makefile wfdb-10.3.1/Makefile --- wfdb-10.3.0/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/Makefile Thu Dec 5 02:57:46 2002 @@ -39,12 +39,12 @@ # create source archives, type `make tarballs'; or to make a binary archive, # type `make bin-tarball'. Making archives requires PGP, gzip, and GNU tar). # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -61,9 +61,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000 diff -Naur wfdb-10.3.0/NEWS wfdb-10.3.1/NEWS --- wfdb-10.3.0/NEWS Sun Nov 24 14:51:04 2002 +++ wfdb-10.3.1/NEWS Thu Dec 5 03:13:06 2002 @@ -1,3 +1,22 @@ +10.3.1: + Added a -W option to ann2rr to create 2-column output containing + intervals in seconds and annotation mnemonics, and modified the + interval calculations to avoid accumulated roundoff error. + + Fixed a bug that caused WAVE to crash when the main window was + resized if the open record had 3 or more signals, and added two + high-resolution time scales in modepan.c. + + Fixed a bug in edf2mit that caused crashes when using the -s option, + and another bug in mit2edf that caused crashes when converting a + record with a frame rate of less than 1 Hz. Thanks to Jesus Olivan + for reporting these problems and for providing test cases that were + helpful in developing and testing the fixes. + + Wei Zong has contributed an arterial blood pressure pulse detector + for continuous ABP signals, which has been added to the package + (see wabp). + 10.3.0: The WFDB Software Package has been ported to MacOS/X (Darwin), version 10.2 (the port should also work under 10.1 but this diff -Naur wfdb-10.3.0/app/Makefile wfdb-10.3.1/app/Makefile --- wfdb-10.3.0/app/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/app/Makefile Thu Dec 5 02:57:46 2002 @@ -33,12 +33,12 @@ # type `make listing'. # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -55,9 +55,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000 @@ -216,19 +216,19 @@ echo "Nothing to be done for lib-post-uninstall" # _____________________________________________________________________________ # file: Makefile.tpl G. Moody 23 May 2000 -# Last revised: 26 November 2002 +# Last revised: 5 December 2002 # This section of the Makefile should not need to be changed. CFILES = ann2rr.c bxb.c calsig.c ecgeval.c epicmp.c fir.c ihr.c mfilt.c \ mrgann.c mxm.c nst.c plotstm.c pscgen.c pschart.c psfd.c rdann.c rdsamp.c \ rr2ann.c rxr.c sampfreq.c sample.c sigamp.c sigavg.c skewedit.c snip.c \ - sortann.c sqrs.c sqrs125.c sumann.c sumstats.c tach.c view.c vsetup.c \ + sortann.c sqrs.c sqrs125.c sumann.c sumstats.c tach.c view.c vsetup.c wabp.c \ wfdbcat.c wfdbcollate.c wfdb-config.c wfdbdesc.c wfdbwhich.c wqrs.c wrann.c \ wrsamp.c wvscript.c xform.c XFILES = ann2rr bxb calsig ecgeval epicmp fir ihr mfilt \ mrgann mxm nst plotstm pscgen pschart psfd rdann rdsamp \ rr2ann rxr sampfreq sigamp sigavg skewedit snip \ - sortann sqrs sqrs125 sumann sumstats tach \ + sortann sqrs sqrs125 sumann sumstats tach wabp \ wfdbcat wfdbcollate wfdb-config wfdbdesc wfdbwhich wqrs wrann \ wrsamp xform SCRIPTS = cshsetwfdb setwfdb diff -Naur wfdb-10.3.0/app/Makefile.tpl wfdb-10.3.1/app/Makefile.tpl --- wfdb-10.3.0/app/Makefile.tpl Tue Nov 26 13:40:10 2002 +++ wfdb-10.3.1/app/Makefile.tpl Thu Dec 5 02:50:05 2002 @@ -1,17 +1,17 @@ # file: Makefile.tpl G. Moody 23 May 2000 -# Last revised: 26 November 2002 +# Last revised: 5 December 2002 # This section of the Makefile should not need to be changed. CFILES = ann2rr.c bxb.c calsig.c ecgeval.c epicmp.c fir.c ihr.c mfilt.c \ mrgann.c mxm.c nst.c plotstm.c pscgen.c pschart.c psfd.c rdann.c rdsamp.c \ rr2ann.c rxr.c sampfreq.c sample.c sigamp.c sigavg.c skewedit.c snip.c \ - sortann.c sqrs.c sqrs125.c sumann.c sumstats.c tach.c view.c vsetup.c \ + sortann.c sqrs.c sqrs125.c sumann.c sumstats.c tach.c view.c vsetup.c wabp.c \ wfdbcat.c wfdbcollate.c wfdb-config.c wfdbdesc.c wfdbwhich.c wqrs.c wrann.c \ wrsamp.c wvscript.c xform.c XFILES = ann2rr bxb calsig ecgeval epicmp fir ihr mfilt \ mrgann mxm nst plotstm pscgen pschart psfd rdann rdsamp \ rr2ann rxr sampfreq sigamp sigavg skewedit snip \ - sortann sqrs sqrs125 sumann sumstats tach \ + sortann sqrs sqrs125 sumann sumstats tach wabp \ wfdbcat wfdbcollate wfdb-config wfdbdesc wfdbwhich wqrs wrann \ wrsamp xform SCRIPTS = cshsetwfdb setwfdb diff -Naur wfdb-10.3.0/app/ann2rr.c wfdb-10.3.1/app/ann2rr.c --- wfdb-10.3.0/app/ann2rr.c Fri Nov 1 07:07:58 2002 +++ wfdb-10.3.1/app/ann2rr.c Thu Dec 5 01:05:31 2002 @@ -1,5 +1,5 @@ /* file: ann2rr.c G. Moody 16 May 1995 - Last revised: 1 November 2002 + Last revised: 5 December 2002 ------------------------------------------------------------------------------- ann2rr: Calculate RR intervals from an annotation file Copyright (C) 2002 George B. Moody @@ -128,6 +128,11 @@ case 'w': /* output annotation types following intervals */ wflag = 1; break; + case 'W': /* output annotation types following intervals in sec */ + wflag = 1; + if (vflag == 0) vflag = 1; + if (tformat == 0) tformat = -1; + break; default: (void)fprintf(stderr, "%s: unrecognized option %s\n", pname, argv[i]); @@ -179,25 +184,39 @@ if (!isann(annot.anntyp)) continue; if ((flag[0] && isqrs(annot.anntyp)) || flag[annot.anntyp]) { if (cflag == 0 || previous_annot_valid == 1) { - rr = annot.time - tp; - if (vflag) { /* print elapsed time */ + if (vflag) { /* print elapsed time if requested */ long tt = (vflag > 0) ? tp : annot.time; - switch (tformat) { - default: - case 0: (void)printf("%ld\t", tt); break; - case 1: (void)printf("%.3lf\t", tt/sps); break; - case 2: (void)printf("%.5lf\t", tt/spm); break; - case 3: (void)printf("%.7lf\t", tt/sph); break; - } + switch (tformat) { + default: + case 0: (void)printf("%ld\t", tt); break; + case 1: (void)printf("%.3lf\t", tt/sps); break; + case 2: (void)printf("%.5lf\t", tt/spm); break; + case 3: (void)printf("%.7lf\t", tt/sph); break; + case -1: break; + } } /* print RR interval */ - if (tformat) (void)printf("%.3lf", rr/sps); - else (void)printf("%ld", rr); + rr = annot.time - tp; + if (tformat) { + char rrstr[10]; + static double frr, t = 0.0; + + (void)sprintf(rrstr, "%.3lf", rr/sps); + (void)printf("%s", rrstr); + sscanf(rrstr, "%lf", &frr); + t += frr * sps; + tp = (long)(t + 0.5); + } + else { + (void)printf("%ld", rr); + tp = annot.time; + } /* print annotation type if requested */ if (wflag) (void)printf("\t%s", annstr(annot.anntyp)); printf("\n"); } - tp = annot.time; + else + tp = annot.time; previous_annot_valid = 1; } else if (cflag) @@ -247,7 +266,8 @@ " -Vh same as -V, but print times in hours and RR intervals in seconds", " -Vm same as -V, but print times in minutes and RR intervals in seconds", " -Vs same as -V, but print times and RR intervals in seconds", - " -w print annotation types following intervals", + " -w print annotation types following intervals (in sample intervals)", + " -W print annotation types following intervals (in seconds)", NULL }; diff -Naur wfdb-10.3.0/app/sample.c wfdb-10.3.1/app/sample.c --- wfdb-10.3.0/app/sample.c Thu Nov 14 19:22:41 2002 +++ wfdb-10.3.1/app/sample.c Sat Nov 30 12:59:56 2002 @@ -1,5 +1,5 @@ /* file: sample.c G. Moody 10 January 1991 - Last revised: 14 November 2002 + Last revised: 30 November 2002 ------------------------------------------------------------------------------- sample: digitize or play back signals on a PC using a Microstar DAP board @@ -64,7 +64,7 @@ containing aliases for functions such as open(), which have been renamed in the standard MSC 7.0 library to conform with ANSI namespace rules. -Refer to `../doc/sample.1' for further information. */ +Refer to `../doc/wag-src/sample.1' for further information. */ #include #include diff -Naur wfdb-10.3.0/app/wabp.c wfdb-10.3.1/app/wabp.c --- wfdb-10.3.0/app/wabp.c Wed Dec 31 19:00:00 1969 +++ wfdb-10.3.1/app/wabp.c Thu Dec 5 02:51:45 2002 @@ -0,0 +1,413 @@ +/* file wabp.c Wei Zong 23 October 1998 + Last revised: 5 December 2002 (by W. Zong and G. Moody) +----------------------------------------------------------------------------- +wabp: beat detector for arterial blood presure (ABP) signal +Copyright (C) 2002 Wei Zong + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place - Suite 330, Boston, MA 02111-1307, USA. + +You may contact the author by e-mail (wzong@mit.edu) or postal mail +(MIT Room E25-505, Cambridge, MA 02139, USA). For updates to this software, +please visit PhysioNet (http://www.physionet.org/). +------------------------------------------------------------------------------ + +This program detects heart beats (pulse waveforms) in a continuous arterial +blood pressure (ABP) signal. This version of wabp works best with ABP signals +sampled at 125 Hz, but it can analyze ABPs sampled at any frequency +using on-the-fly resampling provided by the WFDB library. 'wabp' has been +optimized for adult human ABPs. For other ABPs, it may be necessary to +experiment with the input sampling frequency and the time constants indicated +below. + +`wabp' can process records containing any number of signals, but it uses only +one signal for ABP pulse detection (by default, the lowest-numbered signal +labelled `ABP', `ART', or `BP'; this can be changed using the `-s' option, see +below). + +To compile this program under GNU/Linux, MacOS/X, MS-Windows, or Unix, use gcc: + gcc -o wabp wabp.c -lwfdb +You must have installed the WFDB library, available at + http://www.physionet.org/physiotools/wfdb.shtml +gcc is standard with GNU/Linux and is available for other platforms from: + http://www.gnu.org/ (sources and Unix binaries) + http://fink.sourceforge.net (Mac OS/X only) + http://www.cygwin.com/ (MS-Windows only) + +For a usage summary, see the help text at the end of this file. The input +record may be in any of the formats readable by the WFDB library, and it may +be anywhere in the WFDB path (in a local directory or on a remote web or ftp +server). The output of 'wabp' is an annotation file named RECORD.wabp (where +RECORD is replaced by the name of the input record). Within the output +annotation file, the time of each NORMAL annotation marks an ABP pulse wave +onset. +*/ + +#include +#include +#include + +#define BUFLN 4096 /* must be a power of 2, see slpsamp() */ +#define EYE_CLS 0.25 /* eye-closing period is set to 0.25 sec (250 ms) */ +#define LPERIOD 1000 /* learning period is the first LPERIOD samples */ +#define SLPW 0.13 /* Slope width (130ms) */ +#define NDP 2.5 /* adjust threshold if no pulse found in NDP seconds */ +#define TmDEF 5 /* minimum threshold value (default) */ + +char *pname; /* the name by which this program was invoked */ +int *ebuf; +int nsig; /* number of input signals */ +int SLPwindow; /* Slope window size */ +int signal = -1; /* signal number of signal to be analyzed (initial + value forces search for ABP, ART, or BP signal) */ +int Tm = TmDEF; /* minimum threshold value */ +WFDB_Sample *lbuf = NULL; + + +WFDB_Sample slpsamp(WFDB_Time t) +{ + int dy; + static WFDB_Time tt = (WFDB_Time)-1L; + + if (lbuf == NULL) { + lbuf = (WFDB_Sample *)malloc((unsigned)BUFLN * sizeof(WFDB_Sample)); + ebuf = (int *)malloc((unsigned)BUFLN * sizeof(int)); + if (lbuf && ebuf) { + for (ebuf[0] = 0, tt = 1L; tt < BUFLN; tt++) + ebuf[tt] = ebuf[0]; + if (t > BUFLN) tt = (WFDB_Time)(t - BUFLN); + else tt = (WFDB_Time)-1L; + } + else { + (void)fprintf(stderr, "%s: insufficient memory\n", pname); + exit(2); + } + } + if (t < tt - BUFLN) { + fprintf(stderr, "%s: slpsamp buffer too short\n", pname); + exit(2); + } + while (t > tt) { + static int aet = 0, et; + dy = sample(signal, tt) - sample(signal, tt-1); + if (dy < 0) dy = 0; + et = ebuf[(++tt)&(BUFLN-1)] = dy; + lbuf[(tt)&(BUFLN-1)] = aet += et - ebuf[(tt-SLPwindow)&(BUFLN-1)]; + } + return (lbuf[t&(BUFLN-1)]); +} + +main(int argc, char **argv) +{ + char *record = NULL; /* input record name */ + float sps; /* sampling frequency, in Hz (SR) */ + float samplingInterval; /* sampling interval, in milliseconds */ + int i, max, min, minutes = 0, onset, timer, vflag = 0; + int dflag = 0; /* if non-zero, dump raw and filtered + samples only; do not run detector */ + int Rflag = 0; /* if non-zero, resample at 125 Hz */ + int EyeClosing; /* eye-closing period, related to SR */ + int ExpectPeriod; /* if no ABP pulse is detected over this period, + the threshold is automatically reduced + to a minimum value; the threshold is + restored upon a detection */ + int Ta, T0; /* high and low detection thresholds */ + WFDB_Anninfo a; + WFDB_Annotation annot; + WFDB_Sample *v; + WFDB_Siginfo *s; + WFDB_Time from = 0L, next_minute, now, spm, t, tj, tpq, to = 0L, tt, t1; + char *prog_name(); + void help(); + + pname = prog_name(argv[0]); + + for (i = 1; i < argc; i++) { + if (*argv[i] == '-') switch (*(argv[i]+1)) { + case 'd': /* dump filter data */ + dflag = 1; + break; + case 'f': /* starting time */ + if (++i >= argc) { + (void)fprintf(stderr, "%s: time must follow -f\n", pname); + exit(1); + } + from = i; + break; + case 'h': /* help requested */ + help(); + exit(0); + break; + case 'm': /* threshold */ + if (++i >= argc || (Tm = atoi(argv[i])) <= 0) { + (void)fprintf(stderr, "%s: threshold ( > 0) must follow -m\n", + pname); + exit(1); + } + break; + case 'r': /* record name */ + if (++i >= argc) { + (void)fprintf(stderr, "%s: input record name must follow -r\n", + pname); + exit(1); + } + record = argv[i]; + break; + case 'R': /* resample */ + Rflag = 1; + break; + case 's': /* signal */ + if (++i >= argc) { + (void)fprintf(stderr, "%s: signal number must follow -s\n", + pname); + exit(1); + } + signal = atoi(argv[i]); + break; + case 't': /* end time */ + if (++i >= argc) { + (void)fprintf(stderr, "%s: time must follow -t\n", pname); + exit(1); + } + to = i; + break; + case 'v': /* verbose mode */ + vflag = 1; + break; + default: + (void)fprintf(stderr, "%s: unrecognized option %s\n", pname, + argv[i]); + exit(1); + } + else { + (void)fprintf(stderr, "%s: unrecognized argument %s\n", pname, + argv[i]); + exit(1); + } + } + if (record == NULL) { + help(); + exit(1); + } + + if ((nsig = isigopen(record, NULL, 0)) < 1) exit(2); + if ((s = (WFDB_Siginfo *)malloc(nsig * sizeof(WFDB_Siginfo))) == NULL) { + (void)fprintf(stderr, "%s: insufficient memory\n", pname); + exit(2); + } + a.name = "wabp"; a.stat = WFDB_WRITE; + if ((nsig = wfdbinit(record, &a, 1, s, nsig)) < 1) exit(2); + if (signal < 0 || signal >= nsig) { + /* Identify the lowest-numbered ABP, ART, or BP signal */ + for (i = 0; i < nsig; i++) + if (strcmp(s[i].desc, "ABP") == 0 || + strcmp(s[i].desc, "ART") == 0 || + strcmp(s[i].desc, "BP") == 0) + break; + if (i == nsig) { + fprintf(stderr, "%s: no ABP signal specified; use -s option\n\n", + pname); + help(); + exit(3); + } + signal = i; + } + if (vflag) + fprintf(stderr, "%s: analyzing signal %d (%s)\n", + pname, signal, s[signal].desc); + sps = sampfreq((char *)NULL); + if (Rflag) + setifreq(sps = 125.); + if (from > 0L) { + if ((from = strtim(argv[from])) < 0L) + from = -from; + } + if (to > 0L) { + if ((to = strtim(argv[to])) < 0L) + to = -to; + } + + annot.subtyp = annot.num = 0; + annot.chan = signal; + annot.aux = NULL; + Tm = physadu((unsigned)signal, Tm); + samplingInterval = 1000.0/sps; + spm = 60 * sps; + next_minute = from + spm; + EyeClosing = sps * EYE_CLS; /* set eye-closing period */ + ExpectPeriod = sps * NDP; /* maximum expected RR interval */ + SLPwindow = sps * SLPW; /* slope window size */ + + if (vflag) + { + printf("\n------------------------------------------------------\n"); + printf("Record Name: %s\n", record); + printf("Total Signals: %d (", nsig); + for (i = 0; i < nsig - 1; i++) + printf("%d, ", i); + printf("%d)\n", nsig - 1); + printf("Sampling Frequency: %.1f Hz\n", sps); + printf("Sampling Interval: %.3f ms\n", samplingInterval); + printf("Signal channel used for detection: %d\n", signal); + printf("Eye-closing period: %d samples (%.0f ms)\n", + EyeClosing, EyeClosing*samplingInterval); + printf("Minimum threshold: %d\n", Tm); + printf("\n------------------------------------------------------\n\n"); + printf("Processing:\n"); + } + + (void)sample(signal, 0L); + if (dflag) { + for (t = from; (to == 0L || t < to) && sample_valid(); t++) + printf("%6d\t%6d\n", sample(signal, t), slpsamp(t)); + exit(0); + } + + /* Average the first 8 seconds of the slope samples + to determine the initial thresholds Ta and T0 */ + t1 = from + strtim("8"); + for (T0 = 0, t = from; t < t1 && sample_valid(); t++) + T0 += slpsamp(t); + T0 /= t1 - from; + Ta = 3 * T0; + + /* Main loop */ + for (t = from; (to == 0L || t < to) && sample_valid(); t++) { + static int learning = 1, T1; + + if (learning) { + if (t > from + LPERIOD) { + learning = 0; + T1 = T0; + t = from; /* start over */ + } + else T1 = 2*T0; + } + + if (slpsamp(t) > T1) { /* found a possible ABP pulse near t */ + timer = 0; + /* used for counting the time after previous ABP pulse */ + max = min = slpsamp(t); + for (tt = t+1; tt < t + EyeClosing/2; tt++) + if (slpsamp(tt) > max) max = slpsamp(tt); + for (tt = t-1; tt > t - EyeClosing/2; tt--) + if (slpsamp(tt) < min) min = slpsamp(tt); + if (max > min+10) { + onset = max/100 + 2; + tpq = t - 5; + for (tt = t; tt > t - EyeClosing/2; tt--) { + if (slpsamp(tt) - slpsamp(tt-1) < onset) { + tpq = tt; + break; + } + } + + if (!learning) { + /* Check that we haven't reached the end of the record. */ + (void)sample(signal, tpq); + if (sample_valid() == 0) break; + /* Record an annotation at the ABP pulse onset */ + annot.time = tpq; + annot.anntyp = NORMAL; + if (putann(0, &annot) < 0) { /* write the annotation */ + wfdbquit(); /* close files if an error occurred */ + exit(1); + } + } + + /* Adjust thresholds */ + Ta += (max - Ta)/10; + T1 = Ta / 3; + + /* Lock out further detections during the eye-closing period */ + t += EyeClosing; + } + } + else if (!learning) { + /* Once past the learning period, decrease threshold if no pulse + was detected recently. */ + if (++timer > ExpectPeriod && Ta > Tm) { + Ta--; + T1 = Ta / 3; + } + } + + /* Keep track of progress by printing a dot for each minute analyzed */ + if (t >= next_minute) { + next_minute += spm; + (void)fprintf(stderr, "."); + (void)fflush(stderr); + if (++minutes >= 60) { + (void)fprintf(stderr, "\n"); + minutes = 0; + } + } + } + + (void)free(lbuf); + (void)free(ebuf); + wfdbquit(); /* close WFDB files */ + fprintf(stderr, "\n"); + if (vflag) { + printf("\n\nDone! \n\nResulting annotation file: %s.wabp\n\n\n", + record); + } + exit(0); +} + +char *prog_name(s) +char *s; +{ + char *p = s + strlen(s); + +#ifdef MSDOS + while (p >= s && *p != '\\' && *p != ':') { + if (*p == '.') + *p = '\0'; /* strip off extension */ + if ('A' <= *p && *p <= 'Z') + *p += 'a' - 'A'; /* convert to lower case */ + p--; + } +#else + while (p >= s && *p != '/') + p--; +#endif + return (p+1); +} + + +static char *help_strings[] = { + "usage: %s -r RECORD [OPTIONS ...]\n", + "where RECORD is the name of the record to be analyzed, and OPTIONS may", + "include any of:", + " -d dump unfiltered and filtered samples on standard output;", + " do not annotate", + " -f TIME begin at specified time (default: beginning of the record)", + " -h print this usage summary", + " -R resample input at 125 Hz (default: do not resample)", + " -s SIGNAL analyze specified signal (default: 0)", + " -t TIME stop at specified time (default: end of the record)", + " -v verbose mode", + " ", +NULL +}; + +void help() +{ + int i; + + (void)fprintf(stderr, help_strings[0], pname); + for (i = 1; help_strings[i] != NULL; i++) + (void)fprintf(stderr, "%s\n", help_strings[i]); +} + diff -Naur wfdb-10.3.0/app/wqrs.c wfdb-10.3.1/app/wqrs.c --- wfdb-10.3.0/app/wqrs.c Tue Nov 26 13:45:25 2002 +++ wfdb-10.3.1/app/wqrs.c Thu Dec 5 02:22:19 2002 @@ -1,5 +1,5 @@ /* file: wqrs.c Wei Zong 23 October 1998 - Last revised: 22 November 2002 (by W.Zong and G. Moody) + Last revised: % December 2002 (by W.Zong and G. Moody) ----------------------------------------------------------------------------- wqrs: Single-lead QRS detector based on length transform Copyright (C) 2002 Wei Zong @@ -347,7 +347,7 @@ ltsamp(tt-1) - ltsamp(tt-2) < onset && ltsamp(tt-2) - ltsamp(tt-3) < onset && ltsamp(tt-3) - ltsamp(tt-4) < onset) { - tpq = tt - (LP2n+1); /* account for phase shift */ + tpq = tt - LP2n; /* account for phase shift */ break; } } @@ -367,7 +367,7 @@ /* Find the end of the QRS */ for (tt = t, tj = t + 5; tt < t + EyeClosing/2; tt++) { if (ltsamp(tt) > max - (max/10)) { - tj = tt - (LPn + 1) + LPn; + tj = tt; break; } } @@ -385,7 +385,7 @@ /* Adjust thresholds */ Ta += (max - Ta)/10; - T0 = Ta / 3; + T1 = Ta / 3; /* Lock out further detections during the eye-closing period */ diff -Naur wfdb-10.3.0/checkpkg/Makefile wfdb-10.3.1/checkpkg/Makefile --- wfdb-10.3.0/checkpkg/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/checkpkg/Makefile Thu Dec 5 02:57:46 2002 @@ -31,12 +31,12 @@ # directory). To print a set of source listings, type `make listing'. # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -53,9 +53,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000 diff -Naur wfdb-10.3.0/checkpkg/appcheck wfdb-10.3.1/checkpkg/appcheck --- wfdb-10.3.0/checkpkg/appcheck Tue Nov 26 10:12:43 2002 +++ wfdb-10.3.1/checkpkg/appcheck Thu Dec 5 02:57:00 2002 @@ -1,6 +1,6 @@ #!/bin/sh # file: appcheck G. Moody 7 September 2001 -# Last revised: 26 November 2002 +# Last revised: 5 December 2002 # # This script checks the functionality of the WFDB applications in the 'app' # directory. @@ -277,6 +277,18 @@ fi TESTS=`expr $TESTS + 1` +echo Testing sigavg ... +F=100s.sigavg +sigavg -r 100s -a atr -v>$F +if ( ./checkfile $F ) +then + PASS=`expr $PASS + 1` + rm -f $F +else + FAIL=`expr $FAIL + 1` +fi +TESTS=`expr $TESTS + 1` + echo Testing snip ... snip -i 100s -n snip -a atr -f 10 -t 15 for F in snip.atr snip.dat snip.hea @@ -427,6 +439,7 @@ pscgen skewedit sqrs125 +wabp EOF diff -Naur wfdb-10.3.0/checkpkg/expected/100s.sigavg wfdb-10.3.1/checkpkg/expected/100s.sigavg --- wfdb-10.3.0/checkpkg/expected/100s.sigavg Wed Dec 31 19:00:00 1969 +++ wfdb-10.3.1/checkpkg/expected/100s.sigavg Wed Nov 27 16:07:19 2002 @@ -0,0 +1,38 @@ +# Average of 74 beats: +# Time MLII V5 +# sec mV mV + -0.04722 -0.39135 -0.27541 + -0.04444 -0.40561 -0.29797 + -0.04167 -0.42743 -0.31953 + -0.03889 -0.45682 -0.34027 + -0.03611 -0.48514 -0.35845 + -0.03333 -0.50811 -0.35703 + -0.03056 -0.53257 -0.31885 + -0.02778 -0.55885 -0.23541 + -0.02500 -0.56142 -0.12595 + -0.02222 -0.51473 -0.01588 + -0.01944 -0.41784 0.07493 + -0.01667 -0.28845 0.16074 + -0.01389 -0.14169 0.26081 + -0.01111 0.04676 0.37635 + -0.00833 0.29277 0.49257 + -0.00556 0.55209 0.57345 + -0.00278 0.75858 0.54095 + 0.00000 0.86932 0.34365 + 0.00278 0.85486 0.03439 + 0.00556 0.66818 -0.22182 + 0.00833 0.33257 -0.32818 + 0.01111 -0.03980 -0.32358 + 0.01389 -0.31628 -0.29986 + 0.01667 -0.45534 -0.28784 + 0.01944 -0.48865 -0.27845 + 0.02222 -0.46811 -0.26993 + 0.02500 -0.43851 -0.26601 + 0.02778 -0.42223 -0.26622 + 0.03056 -0.41662 -0.26932 + 0.03333 -0.41419 -0.26885 + 0.03611 -0.40899 -0.26905 + 0.03889 -0.40520 -0.26912 + 0.04167 -0.40419 -0.26953 + 0.04444 -0.40561 -0.26919 + 0.04722 -0.40642 -0.26899 diff -Naur wfdb-10.3.0/conf/version.def wfdb-10.3.1/conf/version.def --- wfdb-10.3.0/conf/version.def Mon Nov 25 22:41:35 2002 +++ wfdb-10.3.1/conf/version.def Thu Dec 5 02:57:20 2002 @@ -1,10 +1,10 @@ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official diff -Naur wfdb-10.3.0/convert/Makefile wfdb-10.3.1/convert/Makefile --- wfdb-10.3.0/convert/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/convert/Makefile Thu Dec 5 02:57:46 2002 @@ -33,12 +33,12 @@ # type `make listing'. # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -55,9 +55,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000 diff -Naur wfdb-10.3.0/convert/edf2mit.c wfdb-10.3.1/convert/edf2mit.c --- wfdb-10.3.0/convert/edf2mit.c Thu Nov 14 19:20:21 2002 +++ wfdb-10.3.1/convert/edf2mit.c Wed Dec 4 12:21:12 2002 @@ -1,5 +1,5 @@ -/* file: edf2mit.c G. Moody 16 October 1996 - Last revised: 14 November 2002 +/* file: edf2mit.c G. Moody 16 October 1996 + Last revised: 4 December 2002 ------------------------------------------------------------------------------- Convert EDF (European Data Format) file to MIT format header and signal files @@ -37,8 +37,9 @@ char buf[81], record[WFDB_MAXRNL+1], **vi, **vin; double *sigpmax, *sigpmin, *sampfreq, spr, sps; FILE *ifile = NULL; - int big_endian = 0, fpb, h, i, j, k, l, nsig, nosig = 0, *siglist, *spb, - tspb = 0, tspf = 0, vflag = 0, day, month, year, hour, minute, second; + int big_endian = 0, fpb, h, i, j, k, l, nsig, nosig = 0, *siglist = NULL, + *spb, tspb = 0, tspf = 0, vflag = 0, + day, month, year, hour, minute, second; long adcrange, *sigdmax, *sigdmin; WFDB_Sample *vo, *vout; WFDB_Siginfo *si, *so; diff -Naur wfdb-10.3.0/convert/mit2edf.c wfdb-10.3.1/convert/mit2edf.c --- wfdb-10.3.0/convert/mit2edf.c Thu Nov 14 19:19:59 2002 +++ wfdb-10.3.1/convert/mit2edf.c Wed Dec 4 12:49:07 2002 @@ -1,5 +1,5 @@ /* file: mit2edf.c G. Moody 2 November 2002 - Last revised: 14 November 2002 + Last revised: 4 December 2002 ------------------------------------------------------------------------------- Convert MIT format header and signal files to EDF (European Data Format) file Copyright (C) 2002 George B. Moody @@ -142,7 +142,8 @@ "blocks". */ for (i = samples_per_frame = 0; i < nsig; i++) samples_per_frame += si[i].spf; - frames_per_second = strtim("1"); /* one second */ + frames_per_second = strtim("1:0")/60.0; /* i.e., the number of frames + per minute, divided by 60 */ frames_per_block = 10 * frames_per_second + 0.5; /* ten seconds */ bytes_per_block = 2 * samples_per_frame * frames_per_block; /* EDF specifies 2 bytes per sample */ @@ -151,6 +152,18 @@ frames_per_block /= 10; bytes_per_block = samples_per_frame * 2 * frames_per_block; } + + if (frames_per_block < 1) { + fprintf(stderr, "%s: can't convert record %s to EDF\n", pname, record); + fprintf(stderr, + " EDF blocks cannot be larger than %d bytes, but each input frame requires\n", + EDFMAXBLOCK); + fprintf(stderr, + " %d bytes. Use the -s option to select a subset of the input signals.\n", + samples_per_frame * 2); + exit(5); + } + seconds_per_block = frames_per_block / frames_per_second; /* Calculate the number of blocks to be written. strtim("e") is the frame diff -Naur wfdb-10.3.0/data/Makefile wfdb-10.3.1/data/Makefile --- wfdb-10.3.0/data/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/data/Makefile Thu Dec 5 02:57:46 2002 @@ -33,12 +33,12 @@ # listing'. # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -55,9 +55,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000 diff -Naur wfdb-10.3.0/doc/Makefile wfdb-10.3.1/doc/Makefile --- wfdb-10.3.0/doc/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/doc/Makefile Thu Dec 5 02:57:46 2002 @@ -134,12 +134,12 @@ # `make ug'. To print the WFDB Programmer's Guide, type `make pg'. # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -156,9 +156,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000 diff -Naur wfdb-10.3.0/doc/wag-src/Makefile wfdb-10.3.1/doc/wag-src/Makefile --- wfdb-10.3.0/doc/wag-src/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/doc/wag-src/Makefile Thu Dec 5 02:57:46 2002 @@ -59,12 +59,12 @@ # PostScript 'make wag.ps' (requires troff, tbl, latex, and dvips) # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -81,9 +81,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000 diff -Naur wfdb-10.3.0/doc/wag-src/edf2mit.1 wfdb-10.3.1/doc/wag-src/edf2mit.1 --- wfdb-10.3.0/doc/wag-src/edf2mit.1 Sat Nov 2 11:13:25 2002 +++ wfdb-10.3.1/doc/wag-src/edf2mit.1 Wed Dec 4 10:05:59 2002 @@ -1,4 +1,4 @@ -.TH EDF2MIT 1 "2 November 2002" "WFDB 10.3.0" "WFDB Applications Guide" +.TH EDF2MIT 1 "4 December 2002" "WFDB 10.3.1" "WFDB Applications Guide" .SH NAME edf2mit, mit2edf \- convert between EDF and MIT formats .SH SYNOPSIS @@ -49,12 +49,30 @@ Verbose mode (print debugging output). .PP -Note that EDF format does not include a way to specify the baseline value -of a signal, and that MIT format does not include a standard way to specify the +Note that MIT format does not include a standard way to specify the transducer type or the prefiltering specification; these parameters are not preserved by these conversion programs. Also note that use of the standard signal and unit names specified for EDF is permitted but not enforced by \fBmit2edf\fR. + +.PP +Many EDF files contain signals at widely varying sampling frequencies. +\fBedf2mit\fR handles these properly, but the default behavior of most +WFDB applications is to read such data in low-resolution mode (in which +all signals are resampled at the lowest sampling frequency used for any +signal in the record). This is almost certainly not what you want if, for +example, the record contains EEG signals sampled at 200 Hz and body temperature +sampled at 1 Hz; by default, applications such as \fBrdsamp\fR and \fBwave\fR +will resample the EEGs (and any other signals in the record) at 1 Hz. To +avoid this behavior, you can use the \fB-H\fR (high resolution) option provided +by \fBrdsamp\fR, \fBwave\fR, and a few other WFDB applications, or you can +set the environment variable \fBWFDBGVMODE\fR to 1 (or any non-zero value) to +specify that signals are to be read in high-resolution mode (in which all +signals are resampled at the highest frequency used for any signal in the +record). Setting \fBWFDBGVMODE\fR works with all WFDB applications, not only +those that support the \fB-H\fR option. For further information, see the +section titled "Multi-Frequency Records" in chapter 5 of +the \fIWFDB Programmer's Guide\fR. .SH ENVIRONMENT .PP diff -Naur wfdb-10.3.0/doc/wag-src/fixag.sed wfdb-10.3.1/doc/wag-src/fixag.sed --- wfdb-10.3.0/doc/wag-src/fixag.sed Sat Nov 2 01:05:03 2002 +++ wfdb-10.3.1/doc/wag-src/fixag.sed Mon Dec 2 21:33:53 2002 @@ -1,50 +1,51 @@ -s+sampfreq-1.htm+sampfr-1.htm+g -s+wfdbcal-5.htm+wfdbca-5.htm+g -s+wfdbwhich-1.htm+wfdbwh-1.htm+g -s+sumstats-1.htm+sumsta-1.htm+g +s+coherence-1.htm+cohere-1.htm+g s+ecgeval-1.htm+ecgeva-1.htm+g +s+ecgpuwave-1.htm+ecgpuw-1.htm+g s+edf2mit-1.htm+edf2mi-1.htm+g +s+gtkwave-1.htm+gtkwav-1.htm+g s+pschart-1.htm+pschar-1.htm+g -s+coherence-1.htm+cohere-1.htm+g -s+wfdbcollate-1.htm+wfdbco-1.htm+g s+plotstm-1.htm+plotst-1.htm+g +s+sampfreq-1.htm+sampfr-1.htm+g s+setwfdb-1.htm+setwfd-1.htm+g +s+sumstats-1.htm+sumsta-1.htm+g s+wfdb-config-1.htm+wfdb-c-1.htm+g -s+gtkwave-1.htm+gtkwav-1.htm+g +s+wfdbcal-5.htm+wfdbca-5.htm+g +s+wfdbcollate-1.htm+wfdbco-1.htm+g +s+wfdbwhich-1.htm+wfdbwh-1.htm+g s+cc(1)+cc(1)+g -s+gcc(1)+gcc(1)+g -s+ld(1)+ld(1)+g -s+scanf(3)+scanf(3)+g +s+F(n)+F(n)+g +s+F(n)+F(n)+g s+fseek(3)+fseek(3)+g +s+gcc(1)+gcc(1)+g s+gnuplot(1)+gnuplot(1)+g -s+plot(1)+plot(1)+g -s+plot(3)+plot(3)+g -s+printf(3)+printf(3)+g -s+X(1)+X(1)+g -s+sh(1)+sh(1)+g -s+xview(1)+xview(1)+g -s+F(n)+F(n)+g -s+F(n)+F(n)+g +s+iconedit(1)+iconedit(1)+g +s+ld(1)+ld(1)+g s+osigfopen(nsig)+osigfopen(nsig)+g s+N (1)+N (1)+g s+N (2)+N (2)+g s+N (3)+N (3)+g s+N (4)+N (4)+g s+N (8)+N (8)+g -s+iconedit(1)+iconedit(1)+g s+openwin(1)+openwin(1)+g +s+plot(1)+plot(1)+g +s+plot(3)+plot(3)+g +s+printf(3)+printf(3)+g +s+scanf(3)+scanf(3)+g +s+sh(1)+sh(1)+g +s+X(1)+X(1)+g s+xdpyinfo(1)+xdpyinfo(1)+g s+xhost(1)+xhost(1)+g s+xlsfonts(1)+xlsfonts(1)+g s+xmodmap(1)+xmodmap(1)+g s+xnews(1)+xnews(1)+g +s+xview(1)+xview(1)+g s+strtim+strtim+ s+BGCOLOR="[^"]*"+BGCOLOR="#FFFFFF"+ s+(http://www.physionet.org/physiobank/database)+(http://www.physionet.org/physiobank/database)+ s+(http://www.aami.org/)+(http://www.aami.org/)+ s+"http://www.gnuplot.info/"+"http://www.gnuplot.info/" target="other"+ s+http://www.mstarlabs.com/+http://www.mstarlabs.com/+ -s+(http://www.hsr.nl/edf/)+(http://www.hsr.nl/edf/)+ +s+Evaluating ECG Analyzers+Evaluating ECG Analyzers+ s+WFDB Programmer's Guide+WFDB Programmer's Guide+ s+WFDB Applications Guide+WFDB Applications Guide+ diff -Naur wfdb-10.3.0/doc/wag-src/wabp.1 wfdb-10.3.1/doc/wag-src/wabp.1 --- wfdb-10.3.0/doc/wag-src/wabp.1 Wed Dec 31 19:00:00 1969 +++ wfdb-10.3.1/doc/wag-src/wabp.1 Thu Dec 5 03:32:47 2002 @@ -0,0 +1,77 @@ +.TH WABP 1 "5 December 2002" "WFDB 10.3.1" "WFDB Applications Guide" +.SH NAME +wabp \- arterial blood pressure (ABP) pulse detector +.SH SYNOPSIS +\fBwabp -r\fR \fIrecord\fR [ \fIoptions\fR ... ] +.SH DESCRIPTION +.PP +\fBwabp\fR attempts to locate arterial blood pressure (ABP) pulse +waveforms in a continuous ABP signal in the specified \fIrecord\fR. +The detector algorithm is based on analysis of the first derivative of +the ABP waveform. The output of \fBwabp\fR is an annotation file +(with annotator name \fBwabp\fR) in which all detected beats are +labelled normal. +.PP +\fBwabp\fR can process records containing any number of signals, but +it uses only one signal for ABP pulse detection (by default, the +lowest-numbered ABP, ART, or BP signal; this can be changed using the +\fB-s\fR option, see below). \fBwabp\fR is optimized for use with +adult human ABPs. It has been designed and tested to work best on +signals sampled at 125 Hz. For other ABPs, it may be necessary to +experiment with the sampling frequency as recorded in the input +record's header file (see \fBheader\fR(5)). +.PP +\fBwabp\fR optionally uses the WFDB library's \fIsetifreq\fR function +to resample the input signal at 125 Hz. +.PP +\fIOptions\fR include: +.TP +\fB-d\fR +Dump the raw and pre-processed input samples in text format on the +standard output, but do not detect or annotate ABP pulses. +.TP +\fB-f\fR \fItime\fR +Begin at the specified \fItime\fR in \fIrecord\fR (default: the beginning of +\fIrecord\fR). +.TP +\fB-h\fR +Print a brief usage summary. +.TP +\fB-R\fR +Resample the input at 125 Hz (default: do not resample). +.TP +\fB-s\fR \fIsignal\fR +Specify the \fIsignal\fR to be used for ABP pulse detection (default: the +lowest-numbered ABP, ART, or BP signal). +.TP +\fB-t\fR \fItime\fR +Process until the specified \fItime\fR in \fIrecord\fR (default: the end of the +\fIrecord\fR). +.TP +\fB-v\fR +Verbose mode: print information about the detector parameters. +.SH ENVIRONMENT +.PP +It may be necessary to set and export the shell variable \fBWFDB\fR (see +\fBsetwfdb\fR(1)). +.SH EXAMPLES +.PP +To mark ABP pulses in record slp60 of the slpdb database, beginning 5 minutes +from the start, ending 10 minutes and 35 seconds from the start, and using +signal 1, use the command: +.br + \fBwabp -r slpdb/slp60 -f 5:0 -t 10:35 -s 1\fR +.br +The output annotations may be read using (for example): +.br + \fBrdann -a slpdb/slp60 -r 100\fR +.PP +.br + +.SH SEE ALSO +\fBbxb\fR(1), \fBecgpuwave\fR(1), \fBrdann\fR(1), \fBsetwfdb\fR(1), +\fBsqrs\fR(1), \fBwqrs\fR(1) +.SH AUTHORS +Wei Zong (wzong@mit.edu) and George B. Moody (george@mit.edu). +.SH SOURCE +http://www.physionet.org/physiotools/wfdb/app/wabp.c diff -Naur wfdb-10.3.0/doc/wag-src/wqrs.1 wfdb-10.3.1/doc/wag-src/wqrs.1 --- wfdb-10.3.0/doc/wag-src/wqrs.1 Fri Nov 22 15:06:46 2002 +++ wfdb-10.3.1/doc/wag-src/wqrs.1 Thu Dec 5 01:40:31 2002 @@ -56,7 +56,7 @@ .TP \fB-R\fR Resample the input at 120 Hz if the power line frequency is 60 Hz, or at -150 Hz otherwise. +150 Hz otherwise (default: do not resample). .TP \fB-s\fR \fIsignal\fR Specify the \fIsignal\fR to be used for QRS detection (default: 0). diff -Naur wfdb-10.3.0/doc/wpg-src/Makefile wfdb-10.3.1/doc/wpg-src/Makefile --- wfdb-10.3.0/doc/wpg-src/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/doc/wpg-src/Makefile Thu Dec 5 02:57:46 2002 @@ -65,12 +65,12 @@ # wpg.info' again. # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -87,9 +87,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000 diff -Naur wfdb-10.3.0/doc/wug-src/Makefile wfdb-10.3.1/doc/wug-src/Makefile --- wfdb-10.3.0/doc/wug-src/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/doc/wug-src/Makefile Thu Dec 5 02:57:46 2002 @@ -55,12 +55,12 @@ # PostScript 'make wug.ps' (requires latex and dvips) # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -77,9 +77,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000 diff -Naur wfdb-10.3.0/examples/Makefile wfdb-10.3.1/examples/Makefile --- wfdb-10.3.0/examples/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/examples/Makefile Thu Dec 5 02:57:46 2002 @@ -34,12 +34,12 @@ # `make clean' to remove them. # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -56,9 +56,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000 diff -Naur wfdb-10.3.0/lib/Makefile wfdb-10.3.1/lib/Makefile --- wfdb-10.3.0/lib/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/lib/Makefile Thu Dec 5 02:57:46 2002 @@ -33,12 +33,12 @@ # type `make slib'. # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official diff -Naur wfdb-10.3.0/lib/signal.c wfdb-10.3.1/lib/signal.c --- wfdb-10.3.0/lib/signal.c Fri Nov 22 23:20:08 2002 +++ wfdb-10.3.1/lib/signal.c Wed Nov 27 15:55:38 2002 @@ -2836,7 +2836,9 @@ #define BUFLN 4096 /* must be a power of 2, see sample() */ -WFDB_Sample sample(WFDB_Signal s, WFDB_Time t) +FSAMPLE sample(s, t) +WFDB_Signal s; +WFDB_Time t; { static WFDB_Time tt; @@ -2876,7 +2878,7 @@ return (*(sbuf + nisig * (t&(BUFLN-1)) + s)); } -int sample_valid(void) +FINT sample_valid() { return (sample_vflag); } diff -Naur wfdb-10.3.0/lib/wfdb.h wfdb-10.3.1/lib/wfdb.h --- wfdb-10.3.0/lib/wfdb.h Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/lib/wfdb.h Thu Dec 5 02:57:46 2002 @@ -1,5 +1,5 @@ /* file: wfdb.h G. Moody 13 June 1983 - Last revised: 14 November 2002 wfdblib 10.3.0 + Last revised: 27 November 2002 wfdblib 10.3.1 WFDB library type, constant, structure, and function interface definitions _______________________________________________________________________________ @@ -33,7 +33,7 @@ /* WFDB library version. */ #define WFDB_MAJOR 10 #define WFDB_MINOR 3 -#define WFDB_RELEASE 0 +#define WFDB_RELEASE 1 #define WFDB_NETFILES 1 /* if 1, library includes code for HTTP, FTP clients */ /* Determine what type of compiler is being used. */ @@ -264,6 +264,8 @@ extern FSAMPLE muvadu(WFDB_Signal s, int microvolts); extern FDOUBLE aduphys(WFDB_Signal s, WFDB_Sample a); extern FSAMPLE physadu(WFDB_Signal s, double v); +extern FSAMPLE sample(WFDB_Signal s, WFDB_Time t); +extern FINT sample_valid(); extern FINT calopen(char *calibration_filename); extern FINT getcal(char *description, char *units, WFDB_Calinfo *cal); extern FINT putcal(WFDB_Calinfo *cal); @@ -307,9 +309,10 @@ isigsettime(), isgsettime(), iannsettime(), strecg(), setecgstr(), strann(), setannstr(), setanndesc(), adumuv(), newheader(), setheader(), setmsheader(), setsampfreq(), setbasetime(), putinfo(), setibsize(), - setobsize(), calopen(), getcal(), putcal(), newcal(), wfdbgetskew(); + setobsize(), calopen(), getcal(), putcal(), newcal(), wfdbgetskew(), + sample_valid(); extern FLONGINT wfdbgetstart(); -extern FSAMPLE muvadu(), physadu(); +extern FSAMPLE muvadu(), physadu(), sample(); extern FSTRING ecgstr(), annstr(), anndesc(), timstr(), mstimstr(), datstr(), getwfdb(), getinfo(), wfdberror(), wfdbfile(); extern FSITIME strtim(); diff -Naur wfdb-10.3.0/lib/wfdbdll.def wfdb-10.3.1/lib/wfdbdll.def --- wfdb-10.3.0/lib/wfdbdll.def Sat Oct 26 11:15:06 2002 +++ wfdb-10.3.1/lib/wfdbdll.def Wed Nov 27 15:58:25 2002 @@ -1,6 +1,6 @@ LIBRARY WFDB -DESCRIPTION 'WFDB library, version 10.2.9 Copyright (C) George B. Moody 2002.' +DESCRIPTION 'WFDB library, version 10.3.1 Copyright (C) George B. Moody 2002.' EXETYPE WINDOWS @@ -81,4 +81,6 @@ oannclose @66 setifreq @67 setmsheader @68 - WEP @69 RESIDENTNAME + sample @69 + sample_valid @70 + WEP @71 RESIDENTNAME diff -Naur wfdb-10.3.0/psd/Makefile wfdb-10.3.1/psd/Makefile --- wfdb-10.3.0/psd/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/psd/Makefile Thu Dec 5 02:57:46 2002 @@ -32,12 +32,12 @@ # directory). # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -54,9 +54,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000 diff -Naur wfdb-10.3.0/wave/Makefile wfdb-10.3.1/wave/Makefile --- wfdb-10.3.0/wave/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/wave/Makefile Thu Dec 5 02:57:46 2002 @@ -45,12 +45,12 @@ # just type `make' (from within this directory). # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -67,9 +67,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000 diff -Naur wfdb-10.3.0/wave/init.c wfdb-10.3.1/wave/init.c --- wfdb-10.3.0/wave/init.c Mon Nov 26 23:35:58 2001 +++ wfdb-10.3.1/wave/init.c Wed Dec 4 13:56:02 2002 @@ -1,10 +1,10 @@ /* file: init.c G. Moody 1 May 1990 - Last revised: 26 November 2001 + Last revised: 4 December 2002 Initialization functions for WAVE ------------------------------------------------------------------------------- WAVE: Waveform analyzer, viewer, and editor -Copyright (C) 2001 George B. Moody +Copyright (C) 2002 George B. Moody This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff -Naur wfdb-10.3.0/wave/modepan.c wfdb-10.3.1/wave/modepan.c --- wfdb-10.3.0/wave/modepan.c Sun Jan 30 04:13:21 2000 +++ wfdb-10.3.1/wave/modepan.c Thu Dec 5 02:54:37 2002 @@ -1,10 +1,10 @@ /* file: modepan.c G. Moody 30 April 1990 - Last revised: 29 April 1999 + Last revised: 5 December 2002 Mode panel functions for WAVE ------------------------------------------------------------------------------- WAVE: Waveform analyzer, viewer, and editor -Copyright (C) 1999 George B. Moody +Copyright (C) 2002 George B. Moody This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -68,7 +68,8 @@ int mode_popup_active = -1; char *tchoice[] = {"0.25 mm/min", "1 mm/min", "5 mm/min", "25 mm/min", "50 mm/min", "125 mm/min", "250 mm/min", "500 mm/min", - "12.5 mm/sec", "25 mm/sec", "50 mm/sec", "125 mm/sec", "250 mm/sec" }; + "12.5 mm/sec", "25 mm/sec", "50 mm/sec", "125 mm/sec", "250 mm/sec", + "500 mm/sec", "1000 mm/sec"}; char *vchoice[] = { "1 mm/mV", "2.5 mm/mV", "5 mm/mV", "10 mm/mV", "20 mm/mV", "40 mm/mV", "100 mm/mV" }; @@ -102,7 +103,8 @@ PANEL_CHOICE_STRINGS, tchoice[0], tchoice[1], tchoice[2], tchoice[3], tchoice[4], tchoice[5], tchoice[6], tchoice[7], tchoice[8], tchoice[9], - tchoice[10],tchoice[11],tchoice[12], NULL, + tchoice[10],tchoice[11],tchoice[12],tchoice[13],tchoice[14], + NULL, PANEL_VALUE, DEF_TSA_INDEX, PANEL_DEFAULT_VALUE, DEF_TSA_INDEX, 0); @@ -259,7 +261,7 @@ small displays, or if the frame has been resized to a small size), the calculated widths in seconds are usually integers, at worst expressible as an integral number of tenths of seconds. */ - if ((i = xv_get(ts_item, PANEL_VALUE)) >= 0 && i < 13) { + if ((i = xv_get(ts_item, PANEL_VALUE)) >= 0 && i < 15) { int u = ((int)(canvas_width/dmmx(1) + 1)/5); /* number of 5 mm time-grid units */ switch (tsa_index = i) { @@ -301,7 +303,13 @@ canvas_width_sec = u / 25; break; case 12: /* 250 mm/sec */ mmpersec = 250.; - canvas_width_sec = u / 50; break; + canvas_width_sec = u / 50.0; break; + case 13: /* 500 mm/sec */ + mmpersec = 500.; + canvas_width_sec = u / 100.0; break; + case 14: /* 1000 mm/sec */ + mmpersec = 1000.; + canvas_width_sec = u / 200.0; break; } } diff -Naur wfdb-10.3.0/wave/xvwave.c wfdb-10.3.1/wave/xvwave.c --- wfdb-10.3.0/wave/xvwave.c Thu Nov 14 19:13:59 2002 +++ wfdb-10.3.1/wave/xvwave.c Wed Dec 4 13:56:18 2002 @@ -1,5 +1,5 @@ /* file: xvwave.c G. Moody 27 April 1990 - Last revised: 14 November 2002 + Last revised: 4 December 2002 XView support functions for WAVE ------------------------------------------------------------------------------- @@ -112,7 +112,7 @@ /* Recalibrate based on selected scales, clear the display list cache. */ if (*record) { set_baselines(); - alloc_sigdata(2); + alloc_sigdata(nsig > 2 ? nsig : 2); dismiss_mode(); /* read and set user-selected scales, if any */ vscale[0] = 0.; /* force clear_cache() -- see calibrate() */ diff -Naur wfdb-10.3.0/waverc/Makefile wfdb-10.3.1/waverc/Makefile --- wfdb-10.3.0/waverc/Makefile Tue Nov 26 13:40:19 2002 +++ wfdb-10.3.1/waverc/Makefile Thu Dec 5 02:57:46 2002 @@ -25,12 +25,12 @@ # please visit PhysioNet (http://www.physionet.org/). # _____________________________________________________________________________ # file: version.def G. Moody 24 May 2000 -# Last revised: 25 November 2002 +# Last revised: 30 November 2002 # Each release of the WFDB Software Package is identified by a three-part # version number, defined here: MAJOR = 10 MINOR = 3 -RELEASE = 0 +RELEASE = 1 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # RPMRELEASE can be incremented if changes are made between official @@ -47,9 +47,9 @@ # Definitions generated by 'configure' -PACKAGE = wfdb-10.3.0 -LONGDATE = 26 November 2002 -SHORTDATE = NOVEMBER 2002 +PACKAGE = wfdb-10.3.1 +LONGDATE = 5 December 2002 +SHORTDATE = DECEMBER 2002 # _____________________________________________________________________________ # file: linux.def G. Moody 31 May 2000