[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These exercises are based on the material in the previous chapters. Answers to some of them are at the back of the book, but try to work through them first.
WFDB
(see section The Database Path and Other Environment Variables). It is a good idea to include this step in your
`.profile', `.cshrc', or `autoexec.bat'. As input, try
record `100s', input annotator `atr', and output annotator
`normal'. The program should finish in five seconds or less.
The annotations will have been written into a file called
`100s.nor' in the current directory. Now type
"rdann -r 100s -a atr
" and observe the output
for a few seconds, then try "rdann -r 100s -a nor
" and notice the
difference.
fname = "signal.dat" desc = "BP" units = "mmHg" gain = 10 initval = 80 group = 0 fmt = 212 spf = 1 bsize = 0 adcres = 12 adczero = 0 baseline = -300 nsamp = 1000000 cksum = 3109 |
For starters, convert a sample value of 280 into physical units.
your-program record 10:0 10:10 |
should skip the first ten minutes, then process the next ten seconds of signals from record.
1 #include <wfdb/wfdb.h> 2 3 main() 4 { 5 WFDB_Annotation *annot; 6 WFDB_Anninfo ai; 7 int t; 8 9 ai.name = "atr"; 10 ai.stat = WFDB_READ; 11 if (annopen(100, ai, 1)) { 12 while (getann(1, annot)) { 13 printf("%s\t(%d)\t%s\n", timstr(annot.time), 14 annot.time, mstimstr(annot.time - t)); 15 t = annot.time; 16 } 17 } 18 } |
Extra credit: Without actually trying it out, what does it produce on the standard output?
isigsettime
on a format 8 signal introduces a random offset
into the signal, since the contents of a format 8 signal file are first
differences rather than amplitudes. For an AC-coupled signal such as an
ECG, this is usually inconsequential, but a DC-coupled signal such as a
blood pressure signal is usually useful only if absolute levels are
known. If we store such a signal in format 8, we must read it
sequentially from the beginning in order to get correct sample values.
If we intend to do a lot of non-sequential processing of such a signal,
it may be worthwhile to build a table containing the correct sample
values at periodic intervals; then we can use isigsettime
to
skip to a sample in the table, and read forward sequentially from that
point. Write a program to build such a table, and wrappers for
isigsettime
and getvec
to give random access to format 8
signal files without introducing offset errors. On your system, how
many sample intervals should be allowed between table entries in order
to obtain an isigsettime
equivalent that executes in an average
of 100 msec or less?
putvec
(see section Example 7: A General-Purpose FIR Filter, for a
model program). Try it out on MIT-BIH record `122' (or use record
`mitdb/x_mitdb/x_122' from PhysioNet). Use your programs from
the previous exercises to display your output.
sample
to return a pointer to a vector of samples from all
signals (thereby reducing the number of function calls). Speed it up
further by defining a macro that calls the function only if the proper
sample vector is not already in the circular buffer; otherwise the macro
should evaluate to a pointer to the correct sample vector.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
George B. Moody (george@mit.edu)