Abstract:
A filter system for removing small amplitude, high frequency signals such as muscle artifact signals from an ECG signal is provided. The filter system includes a low pass filter with variable cutoff frequencies, an electronic delay and a system for detecting the R wave in the ECG signal and determining the variable cutoff frequency in response to the detection of the R wave. A digitized input ECG signal is simultaneously presented to the electronic delay and the system for detecting the R wave. During the portion of the ECG signal exclusive of the QRS complex, the filter is operated at a low cutoff frequency to filter the muscle artifact signals for a maximum smoothing effect. At a time slightly prior to the on set of the QRS complex, the cutoff frequency is rapidly incrementally increased to a higher cutoff frequency to pass the QRS complex with a minimum reduction of amplitude of the QRS signal. At the end of the QRS signal, the cutoff frequency of the filter is rapidly incrementally returned to the low cutoff frequency.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The instant invention relates to a filter system for removing small amplitude, high frequency signals such as muscle artifact signals from an ECG signal, and more particularly relates to a filter system having a low pass filter with variable cutoff frequencies which cutoff frequencies are implemented in response to the detection of a QRS complex in an ECG signal. 
     2. Background of the Invention 
     A common problem in electrocardiography is the contamination of the ECG signal with artifacts from skeletal muscle tremors, which appear on the ECG signal as rapid, wavy deflections. These deflections render the electrocardiogram difficult to read. A common solution for the muscle artifact problem has been to pass the ECG signal through a low pass filter having a low cut-off frequency, typically approximately 25 Hz. Since muscle artifact signals typically have significant energy at frequencies higher than 25 Hz, the low pass filter effectively reduces the muscle artifact signal. However, the low pass filter has the disadvantage of reducing the amplitude of the QRS complex because the high frequency components of the ECG signal necessary to describe the relatively high peaks of the QRS signal are also removed as the ECG signal passes through the low pass filter. 
     SUMMARY OF THE INVENTION 
     The input ECG signal is passed through a low pass filter having variable cut-off frequencies. During the portion of the ECG signal exclusive of the QRS complex, the filter is operated at a low cut-off frequency to filter the muscle artifact signals for a maximum smoothing effect. At a time slightly prior to the onset of the QRS complex, the cut-off frequency is incrementally increased to a higher cut-off frequency to pass the QRS complex with a minimum reduction of amplitude of the QRS signal. At the end of the QRS signal, the cut-off frequency of the filter is incrementally returned to the low cut-off frequency. 
     A system to determine the variable cut-off frequency of the low-pass filter is provided. In the system, because the R wave of the QRS complex typically has the largest amplitude and corresponding slope of any portion of the ECG signal, the R wave is detected and used to direct when the cut-off frequency of the low pass filter is to be altered. 
     The input ECG signal is simultaneously presented to an electronic delay and to the system which determines the variable cut-off frequency in response to the detection of the R wave. The output of the electronic delay is in turn connected to the variable frequency low-pass filter which is directed by the R wave detection system to determine the variable cut-off frequency. Upon detection of the R wave, the cut-off frequency of the low pass filter, under the direction of the system for determining the variable cut-off frequency, is incrementally altered to higher and higher cut-off frequencies until the maximum cut-off frequency is reached. The filter remains at this maximum cut-off frequency for a time slightly longer than the time length of the QRS signal so that the QRS complex may pass through the filter while it is operating at its maximum cut-off frequency. Thereafter, the filter incrementally returns to its lowest cut-off frequency. 
     Since the filter is directed to move to the higher cut-off frequency only upon the detection of the R wave, which is located in the middle of the QRS complex, the original input ECG signal is electronically delayed for a time sufficient to allow the R wave of the input ECG signal to be centered in the time span during which the variable cut-off frequency low pass filter is operating at its highest cut-off frequency. After passing through the delay circuitry, the ECG signal is passed to the variable cut-off frequency low pass filter for filtering. In this way, the filter is directed to operate at its highest low pass frequency during the time the QRS complex passes through the filter whereafter the filter is directed to operate at its lowest low pass frequency during the passing of the part of the ECG signal between QRS complexes. This system maximizes the reduction of muscle artifact signals without greatly reducing the amplitude of the QRS complex. 
     It is therefore an object of the instant invention to provide a filter system for filtering muscle artifact signals which maximizes the filtering of the muscle artifact signals during part of the ECG signal where the QRS complex is not present, yet which passes the QRS signal with a minimum of distortion due to filtering. 
     It is a further object of the instant invention to provide a filtering system which may be readily implemented on a digital processing system. 
     It is a further object of the instant invention to provide a filter system which may be easily implemented with other filter systems in an ECG monitoring system. 
     Finally, it is an object of the instant invention to provide a filtering system which is relatively simple and easy to make and use. 
     These and other objects of the instant invention will become clear from the description contained herein and more particularly with reference to the following detailed description where like elements are referred to by like reference numbers. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of the instant invention. 
     FIG. 2 is a more detailed block diagram of the elements of the block diagram of FIG. 1. 
     FIG. 3 is a graphic representation of the ECG signal in various stages of processing by the instant invention. 
     FIG. 4 is a schematic representation of the difference system of the instant invention. 
     FIG. 5 is a state diagram showing the implementation of the reference slope detection system. 
     FIG. 6A is a schematic representation of the FIR filter of the instant invention. 
     FIG. 6B is a chart containing the co-efficient values for the multiplication blocks of the FIR filter of FIG. 6A and the corresponding cut-off frequencies. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     In FIG. 1, the filter system generally labeled 10, is shown in a block diagram of its basic elements. An analog ECG signal taken from each of a series of electrodes placed on a patient is first converted to a digital signal through an A to D converter 9 such as is common in the art. The digitized ECG signals from each electrode are thereafter passed to input 12 of the filter system 10. Input 12 comprises all the ECG leads from the patient. All of the ECG signals are simultaneously passed to delay 16. Selected ECG signals are also simultaneously passed to the slope determination system 20. 
     Throughout this disclosure reference will be made to parallel processing in various elements of the filter system 10 of either all or selected of the ECG signals. By parallel processing it is meant that a series of input signals produce a corresponding series of output signals. This parallel processing is preferably accomplished by sequential processing by a single digital device such as a microprocessor of the individual input signals during the interval between the collection of samples so that a virtual or apparent parallel processing is performed. Of course, actual parallel processing of the ECG signals could be done by parallel hardware where the input signals are each processed by their own processing hardware. These individual pieces of processing hardware could include individual microprocessors for each signal. 
     In the preferred embodiment, only the ECG signals from the II, V2 and V5 leads of the commonly applied ECG leads are passed to the slope determination system 20 while each and every ECG lead from the patient&#39;s chest is passed to delay 16. A typical input ECG signal is shown in FIG. 3 labeled as &#34;I&#34;. In FIG. 3, the horizontal axis represents time and the various electrical signals displayed are aligned vertically so that simultaneous events occur on the same vertical line. It is recognized that the ECG signal shown is representative of the ECG signals detected by each ECG electrode which signals may vary from ECG lead to ECG lead. However, for the purpose of illustrating the operation of the instant invention, only one ECG signal is shown. The inputs for the entire group of ECG leads are labeled in FIG. 2 as 12A-N, where N represents the total number of ECG leads attached to the patient. 
     The II, V2 and V5 ECG leads are referred to as &#34;basis leads&#34; and are numbered 22A, 22B and 22C respectively. Basis leads II, V2 and V5 are used in slope determination system 20 because of their approximate location on orthogonal axes to each other on the human body. Of course, it is clear that basis leads 22A, B, C correspond to their respective ECG input leads 12 so that the ECG signals from these ECG leads are passed to both the delay 16 and the slope determination system 20. The designation of ECG leads II, V2 and V5 as &#34;basis leads&#34; is for the purpose of clarifying their role in the R wave detection. 
     In FIG. 2, the details of slope determination system 20 is contained within the block with the dotted outline labeled 20. Each of the basis leads 22A, B, and C is connected to a respective difference system 24A, B, and C. The difference system 24 is a software system shown in block diagram in FIG. 4 which implements the following transfer function: 
     
         transfer function=1-Z.sup.-D 
    
     where &#34;D&#34; is the difference parameter. &#34;D&#34; stands for the number of the previous sample whose value is to be subtracted from the value of the current sample. In the preferred embodiment, &#34;D&#34; equals 5 so that the value of the sample 5 previous to the current sample is subtracted from the value of the current sample. 
     Difference system 24 comprises a series of unit delays 72 connected in serial to an input 25. The unit delays 72 delay the signal for a preselected time. The digital signal from the basis leads 22 is presented to input 25 where it passes from unit delay 72 to unit delay 72 after a pause at each delay corresponding to one sample interval. The digital signal from basis leads 22 presented at input 25 is also simultaneously presented to adder/substracter 27 via line 29. Adder/substracter 27 substracts the value of the input signal delayed by the series of unit delays 72 from the value of the current sample present at input 25. 
     The purpose of difference system 20 is to get a kind of long term average slope of the input ECG signal. The comparatively long term slope is used because the filter 10 responds to the detection of the R wave to control the filtering process, which R wave has the highest amplitude and also the highest slope over several samples of any part of the ECG signal. The reason the sample point 5 samples prior to the current sample point is used to determine the average slope of the input signal rather than the immediately prior sample point or sample points less than five from the current sample point is that random fluctuations from sample point to sample point or across sample intervals caused by noise including muscle artifact signals may cause measured slopes on these shorter sample intervals to be comparable to the slope of the R wave over the same shorter sample intervals. 
     This is particularly true where, as is common for such devices, the sample rate for the ECG signal is high, typically on the order of 500 samples per second. However, the muscle artifact signals tend to be random in nature so that the occasionally measured high slopes due to noise or muscle artifact signals are also random and not sustained over several sampling intervals. By contrast, in the case of an R wave, there is a relatively high slope over several sample points upon the sampling of the R wave. Therefore, in order to detect and distinguish the R wave from noise such as muscle artifact noise, a high slope must be maintained over several sample point intervals to indicate the detection of the R wave. For this reason, the difference system determines the slope over 5 sample points so that the local variations due to such things as noise and muscle artifact signals may be effectively averaged out. Because the sample rate in the preferred embodiment is 500 samples per second, the average slope over 5 samples is the average slope over the last 1/100th of a second. The ultimate effect of this difference system 24 is that the R wave clearly stands out from the noise. 
     The output from the difference system 24A, B, C is passed in parallel to an absolute value system 26. Absolute value system 26 contains individual absolute value systems 6A, B, C, connected to difference system 24A, B, C respectively. Absolute value system 26 finds the absolute value of each slope found by the difference system 24 and passes this absolute value to its output. The slope determination system 20 is interested in determining the absolute slope of the ECG signal since the slope of the R wave will typically have a large positive value as the amplitude of the R wave increases and a large negative value as the amplitide of the R wave decreases. By using the absolute value of the slope, if for some reason the large positive slope of the increase in the amplitude of the R wave is masked or distorted, the system would still be able to detect the R wave from the large absolute value of the slope of the R wave as the amplitude of the R wave decreases. After the absolute values of the slopes determined by the difference systems 24 have been found by the absolute value systems 26, the corresponding outputs of the absolute value systems 26A, B, and C are passed in parallel to the maximum slope determination system 28. Although the absolute value system 26 is used in the preferred embodiment, in an alternate embodiment it may be eliminated so that the output of the difference system 24 is passed directly to the maximum slope determination system 28. In this embodiment, the large negative slope of the R wave as its amplitude decreases would not be used to detect the R wave if the slope of the R wave as its amplitude increases is masked or distorted. 
     The maximum slope determination system 28 compares the values of the outputs of each absolute value system 26A, B and C and passes the maximum value to its output. The output of maximum slope determination system 28 is shown in FIG. 3 as &#34;A&#34;. Because the basis leads II, V2 and V5 are placed in various positions on the body, they each detect the ECG signal in different ways. For this reason, one of the basis leads 22 may detect a higher amplitude of the R wave, which will most likely result in a correspondingly greater slope than that found from the detection of the R wave from other leads. In order to maximize the ability of the instant invention to detect the R wave in a possibly noisy signal contaminated by, among other things, muscle artifact signals, the maximum slope determined by each of the difference systems 24 is used to detect the R wave and consequently control the band width control mechanism 30. 
     The slope determination system 20 described above uses three basis leads in its determination of the maximum value of the slope of the R wave. However, a greater or lesser number of basis leads could be used where each basis lead would be provided with its own difference system 24 and absolute value determination system 26 whose output would then be passed to maximum slope determination system 28. In fact, a single basis lead having its corresponding difference system 24 and absolute value determination system 26 could be used if desired. 
     The output of the maximum slope determination system 28 is passed from the slope determination system 20 to the band width control mechanism 30. As shown in FIG. 2, an erode system 32 is located at the input to the band width control mechanism 30. The purpose of the erode system 32 is to minimize the high frequency noise between QRS complexes present on the output of the maximum slope determination system 28. This high frequency noise is manifest as &#34;fuzz&#34; on the ECG signal at the output of the maximum slope determination system 28 which output signal is shown in FIG. 3 labeled &#34;A&#34;. 
     The particular erosion system 32 used in the instant invention is a special case of grayscale erosion defined as: 
     
         [fΘg](n)=min{f(m)-g(m-n)} 
    
     where 
     f(k)=the signal to be eroded 
     g(j)=the structuring function 
     Θ=the erosion operator 
     and where 
     m ε F and m-n ε G, 
     F=the domain of f, and 
     G=the domain of g. 
     The structuring function g(j) is defined as: 
     
         g(j)={0:0≧j&gt;-W.sub.erode } 
    
     
         i.e. G={0, -1, . . . ,-(W.sub.erode -1)} 
    
     where W erode  is the number of sample points used in the erosion operation. In the preferred embodiment, W erode  equals 4, so that the values of &#34;j&#34; are 0, 1, 2 and 3. 
     In this case, the grayscale erosion is a special case of the well known erosion operation where the value of the structuring function g(j) equals 0 wherever g(j) is defined. Simply put, the erode system 32 in the preferred embodiment, takes the last four samples and finds the minimum value. The minimum value is then passed to the output of the erode system 32. The output of the erosion system 32 is shown in FIG. 3 and is labeled &#34;S&#34;. As can been by comparison to the maximum absolute slope &#34;A&#34;, also shown in FIG. 3, the eroded slope signal &#34;S&#34; has slightly lower amplitudes on the QRS signal, but has a significant reduction of noise between the QRS complexes. Although in the preferred embodiment the structuring function g(j) equals 0 wherever g(j) is defined, other values of the structuring function may be used as desired. 
     An excellent discussion of grayscale erosion is found in Chapter 6 of Non-linear Digital Filter; Principles and Applications by I. Pitas and A. N. Venetsanopulos, published by Kluwer Academic Publishers, copyright 1990, the teaching of which is incorporated herein by reference. 
     The output of the erosion system 32 is simultaneously passed to a dilation system 34 and a reference slope determination system 36. 
     The dilation system 34 used in the instant invention is a special case of grayscale dilation defined as: 
     
         [fΘg](n)=max{f(m)+g(m-n)} 
    
     where 
     f(k)=the signal to be dilated 
     g(j)=the structuring function 
     Θ=the dilation operator 
     and where 
     m ε F and m-n ε G, 
     F=the domain of F, and 
     G=the domain of g. 
     The structuring function g(j) is defined as: 
     
         g(j)={(0:0≧j&gt;-W.sub.dilate } 
    
     
         i.e. G={0, -1, . . . ,-(W.sub.dilate -1)}. 
    
     where W dilate  is the number of sample points used in the dilation operation. In the preferred embodiment, W dilate  equals 4, so that the values of &#34;j&#34; are 0, 1, 2 and 3. 
     In this case, the grayscale dilation is a special case of the well known dilation operation where the value of the structuring function g(j) equals zero wherever g(j) is defined. Although the structuring function g(j) in the preferred embodiment equals 0 wherever g(j) is defined, other values of the structuring function may be used as desired. 
     The dilation system 34 passes to its output the maximum value for the last predetermined number of samples, called a &#34;dilation sample length&#34;, from the erosion system 32. In the preferred embodiment, the dilation sample length equals 47 samples so that the output of dilation system 34 equals the maximum value contained in the last 47 samples. The number 47 is chosen because at a sample rate of 500 samples per second, 47/500 of a second is slightly larger than the time length of a QRS complex. The output of dilation system 34 will eventually be used to time the duration that the linear smoothing filter 18 operates at its highest low pass cut-off frequency in order to pass the QRS wave with a minimum of amplitude reduction. The output of dilation system 34 is passed to a ratio determination system 38 at ratio input 39(b). The output signal of dilation system 34 is shown in FIG. 3 labeled as &#34;D&#34;. 
     An excellent discussion of grayscale dilation is found in Chapter 6 of Non-linear Digital Filter; Principles and Applications by I. Pitas and A. N. Venetsanopulos, published by Kluwer Academic Publishers, copyright 1990, the teaching of which is incorporated herein by reference. 
     As stated, the output from the erosion system 32 is passed to a reference slope determination system 36 simultaneously as the output from the erosion system 32 is passed to the dilation system 34. The reference slope determination system 36 holds the long term maximum slope found by the maximum slope determination system 28 and passed through the erosion system 32 as directed by a software controlled state machine shown symbolically in FIG. 5. The state machine is used to find the new peak on the reference slope shown in FIG. 3, labeled as &#34;R&#34;. A slope threshold, shown in FIG. 3 labeled as &#34;L&#34;, is used as a long term maximum value of the eroded slope &#34;S&#34; which may decay in time if the values of &#34;S&#34; fail to periodically have comparatively high values. The state machine compares the values of the eroded slope &#34;S&#34; to the slope threshold &#34;L&#34; to determine the reference slope &#34;R&#34;. 
     The state machine consists of states &#34;0&#34;, &#34;1&#34;, &#34;2&#34;, and &#34;3&#34; which represent logical conditions. The logical conditions are dependent upon the relative values of &#34;L&#34;, &#34;S&#34;, and &#34;R&#34; as well as the values stored in counters used with the state machine. When the relationships or values of these registers and counters changes, the state machine moves from whatever state it is in to a different state as will be described hereafter. 
     The state machine of FIG. 5 uses &#34;Counters 0-3&#34; which correspond to &#34;States 0-3&#34;. Counter 0 is used to time an initial pause while the state machine accumulates a reservoir of samples for the state machine to work with. Counter 1 is used as the timer for &#34;State 1&#34;, the logical state where the slope threshold &#34;L&#34; is a constant. Counter 2 is used as a timer for logical &#34;State 2&#34; which causes the slope of threshold &#34;L&#34; to decay while no new peak value of the eroded slope &#34;S&#34; is found. Counter 3 is used as the timer for logical &#34;State 3&#34; which finds a new peak for slope threshold &#34;L&#34; when the eroded slope &#34;S&#34; is greater than or equal to the slope threshold &#34;L&#34;. 
     A special symbol, &#34;==&#34;, is used in FIG. 5 between a reference to one of the Counters 0-3 on its left side and the number 0 on its right side such as &#34;Counter 1 ==0&#34;. This symbol, &#34;==&#34;, means that when the respective Counter contains the value &#34;0&#34;, the program leaves the logical state corresponding to that counter along the path adjacent to the phrase containing the &#34;==&#34; symbol. 
     The machine begins at step 40 which initializes Counter 0 to 75 and Counter 1 to 160. In addition, the value of the register R, which contains the reference slope &#34;R&#34;, and the value of register L, which contains the slope threshold &#34;L&#34;, are both set equal to 0. After Counters 0 and 1 have been initialized and registers R and L set equal to 0, the program passes from step 40 to &#34;State 0&#34; which is labeled 42. &#34;State 0&#34; 42 is the Initial Clearing Time state for the state machine. While at &#34;State 0&#34;, the program passes in a loop from &#34;State 0&#34; 42 back to &#34;State 0 42 through step 44 which decrements Counter 0 from its initial value of 75 to 0. During this time, transient effects from turning on the device are allowed to dissipate and a collection of sample points is accumulated. When Counter 0 has decremented to 0, the program leaves &#34;State 0&#34; 42 and passes to &#34;State 1&#34; labeled 46 along path 45. 
     &#34;State 1&#34; is a logical state where the program will reside while the value of the slope threshold &#34;L&#34; is held constant. As noted above, in the initialization step 40, the value of the slope threshold &#34;L&#34; is set equal to zero. At &#34;State 1&#34;, the value of the eroded slope &#34;S&#34; is constantly compared to the value of the slope threshold &#34;L&#34;. These relative values must either be such that the value of &#34;S&#34; is less than, equal to, or greater than the value of &#34;L&#34;. Accordingly, in &#34;State 1&#34; as well as in &#34;State 2&#34; and &#34;State 3&#34;, the relationship between &#34;S&#34; and &#34;L&#34; determines the path from the respective &#34;States 1, 2 and 3&#34;. The only exception to this general rule is where a counter associated with &#34;States 1, 2 or 3&#34; has been allowed to decrement to zero. When this occurs, regardless of the relationship between &#34;S&#34; and &#34;L&#34;, the program must exit that &#34;State&#34; along the path indicating that the counter has decremented to zero. 
     Initially, as the program passes from &#34;State 0&#34; 42 to &#34;State 1&#34; 46, the value of the eroded slope &#34;S&#34; will be equal to or greater than the initial value of threshold slope &#34;L&#34; which has been initialized to zero. Therefore, the program will pass from &#34;State 1&#34; along path 49 to step 58. Step 58 initializes Counter 3 to 75 and sets the value of the slope threshold &#34;L&#34; equal to the value of the eroded slope &#34;S&#34;. In other words, the value of the slope threshold &#34;L&#34; is now set equal to the higher or equal value of the eroded slope &#34;S&#34;. 
     From step 58, the program passes to &#34;State 3&#34; labeled 60. The purpose of &#34;State 3&#34; 60 is to find a new peak for the reference slope &#34;R&#34;. While at &#34;State 3&#34; 60, so long as the value of the eroded slope &#34;S&#34; is greater than or equal to the value of the threshold slope &#34;L&#34;, the program will loop from &#34;State 3&#34; 60 through step 58 back to &#34;State 3&#34; 60. This has the effect of raising the value of &#34;L&#34; to the continuously increasing value of &#34;S&#34;. However, if the value of &#34;S&#34; becomes less than the value of &#34;L&#34;, the program will pass from &#34;State 3&#34; 60 through step 62, which decrements Counter 3 by 1, back to &#34;State 3&#34; 60. 
     So long as &#34;S&#34; remains less than &#34;L&#34;, and the value of Counter 3 is greater than zero, the program will loop from &#34;State 3&#34; 60 through step 62 back to &#34;State 3&#34; 60 while decrementing Counter 3. If, however, the value of &#34;S&#34; becomes greater than or equal to &#34;L&#34;, the program will immediately exit &#34;State 3&#34; 60 and loop through step 58 back to &#34;State 3&#34; 60 thereby raising &#34;L&#34; to the new higher value of &#34;S&#34; and re-initializing Counter 3. If, however, no value of &#34;S&#34; is greater than or equal to &#34;L&#34; while Counter 3 decrements, when Counter 3 reaches 0, the program passes from &#34;State 3&#34; 60 along path 63 to step 64. Step 64 initializes Counter 1, in the preferred embodiment, to 160,  and sets the value of the reference slope &#34;R&#34; equal to the value of the slope threshold &#34;L&#34;. Leaving &#34;State 3&#34; 60 by path 63 indicates that a new peak for the reference slope &#34;R&#34; has been found. Thereafter, the program continues along path 63 from step 64 to &#34;State 1&#34; 46, where the value of the slope threshold &#34;L&#34; will be continuously compared to the value of the eroded slope &#34;S&#34;. 
     The program will stay at &#34;State 1&#34; 46 and the value of the slope threshold &#34;L&#34; will be held constant while the value of the eroded slope &#34;S&#34; is less than the value of the slope threshold &#34;L&#34; and Counter 1 has a value greater than 0. When both of these conditions occur, the program loops from &#34;State 1&#34; back to &#34;State 1&#34; through step 48 which decrements Counter 1 from its initial value of 160. However, if the value of &#34;S&#34; becomes equal to or greater than the value of &#34;L&#34;, the program exits &#34;State 1&#34; 46 through path 49 to step 58 as explained above. 
     If Counter 1 is allowed to decrement to 0, &#34;State 1&#34; is exited through path 47 marked &#34;Counter 1==0&#34; where the program passes to step 50. Step 50 initializes Counter 2 to 1000. Thereafter, the program continues on path 47 to &#34;State 2&#34; labeled 52, which is the state where the value of the slope threshold &#34;L&#34; is decayed. In &#34;State 2&#34;, if the value of the eroded slope &#34;S&#34; is less than the value of the slope threshold &#34;L&#34; the program passes through step 54. Step 54 decrements Counter 2 by 1 and multiplies the current value of the slope threshold &#34;L&#34; by a decay value. In the preferred embodiment, the decay value equals 0.9995. So long as the value of &#34;S&#34; is less than &#34;L&#34; the value of &#34;L&#34; will decay by 0.05% on each pass through step 54 until the value of Counter 2 is decremented to 0. Because Counter 2 was initialized to contain 1000  and because &#34;L&#34; decays by 0.05% on each loop through step 54, after passing through step 54 for the 1000 counts in Counter 2, the value of &#34;L&#34; will decay to 0.606 its original value. This process of having &#34;L&#34; decay is shown in FIG. 3 labeled &#34;State 2&#34; on the signal line corresponding to the threshold slope &#34;L&#34;. 
     When the value of Counter 2 has decremented to 0, as indicated by the label &#34;Counter 2==0&#34;, the program passes to step 56. Step 56 initializes Counter 2 to a new value of 1000, and sets &#34;R&#34;, the reference slope value, and the slope threshold &#34;L&#34; equal to R 0 . R 0  is chosen to represent a small, possibly even zero value. A non-zero value for R 0  may be chosen so that the program will remain at &#34;State 2&#34; 52 for small values of the eroded slope. If a zero value is chosen for R 0 , the program will immediately leave &#34;State 2&#34; 52 via path 57 to step 58 because the value for &#34;S&#34; will be greater than or equal to the zero value for &#34;L&#34;. From step 56, the program continues back to &#34;State 2&#34; 52. If &#34;S&#34;remains less than &#34;L&#34;, the program will continue to pass through step 54, looping from &#34;State 2&#34; back to &#34;State 2&#34; as described above. In this way, the value of the slope threshold &#34;L&#34; will continue to decay. 
     However, if the value of the eroded slope &#34;S&#34; becomes greater than or equal to the value of the slope threshold &#34;L&#34;, the program exits &#34;State 2&#34; 52 along path 57 and passes to step 58 where the process of finding a new peak value for the reference slope &#34;R&#34; is determined as described above. 
     The value of &#34;160&#34; is used to initialize Counter 1 so that &#34;L&#34; will remain constant for a time of 160/500 of a second before the value of &#34;L&#34; is decayed by passing to &#34;State 2&#34; 52. This allows the state machine to avoid moving to &#34;State 3&#34; 60 upon detection of a value for &#34;S&#34; larger than the decayed value of &#34;L&#34;. Therefore, if the state machine moved from &#34;State 1&#34; 46 to &#34;State 2&#34; 52 immediately upon &#34;S&#34; becoming less than &#34;L&#34;, the value of &#34;L&#34; would immediately begin to decay by the program passing through step 54. Since &#34;L&#34; is decaying, a value of &#34;S&#34; greater than or equal to the decayed value of &#34;L&#34; will cause the program to exit &#34;State 2&#34; 52 along path 57 and pass to &#34;State 3&#34; 60 through step 58. Once in &#34;State 3&#34; 60, the program will exit &#34;State 3&#34; 60 through step 64 which will set the value of the reference slope &#34;R&#34; to the value of &#34;L&#34; which was set in step 58 to the comparatively lower value of &#34;S&#34;. This value of the eroded slope &#34;S&#34; which now has set the value of the reference slope &#34;R&#34; could be lower than value of the eroded slope &#34;S&#34; that would move the program from &#34;State 1&#34; 46 to &#34;State 3&#34; 60 when the program pauses at &#34;State 1&#34; 46 by looping through step 48. By pausing at &#34;State 1&#34; 46, the value of &#34;L&#34; remains higher than the decayed value of &#34;L&#34; found in &#34;State 2&#34; 52 so that a higher value of the eroded slope &#34;S&#34; is required to enter &#34;State 3&#34; 60 which higher value of the eroded slope &#34;S&#34; becomes the new value for the reference slope &#34;R&#34;. 
     As can be seen, step 58 may be entered from either &#34;State 1&#34; along path 49, &#34;State 2&#34; along path 57 or &#34;State 3&#34; along path 59. Regardless of the path taken to step 58, the actions of step 58, and the corresponding passing of the program into and the operation of &#34;State 3&#34;, occur independently of the path taken to enter step 58. Further, it is to be noted that paths 49, 57 and 59 all leave their respective states upon the condition that the value of &#34;S&#34; is greater than or equal to the value of &#34;L&#34;. This has the effect of allowing a new peak for the reference slope &#34;R&#34; to be found regardless of which state the state machine finds itself in. 
     The output of the reference slope determination system 36 is the reference slope &#34;R&#34;. The reference slope &#34;R&#34; is passed to the ratio system 38 through ratio input 39(a). 
     Ratio determination system 38 compares the output from the dilation system 34, which is shown in FIG. 3 labeled as the dilated slope &#34;D&#34;, with the output of the reference sloped determination system 36 which is shown in FIG. 3 labeled as reference slope &#34;R&#34; to produce a ratio &#34;r&#34;. 
     As can be seen in FIG. 3, the value of the dilated slope &#34;D&#34; increases substantially with the presence of the R wave, and remains high for the &#34;dilation sample length&#34;, which in the preferred embodiment is 47 samples. This is because the current dilated slope value is the maximum value of the slopes of the last 47 samples. In the time before the presence of the R wave in the ECG signal, the slope values of the ECG signal are typically comparatively small. However, with the presence of the R wave, the slope of the ECG signal at the R wave becomes quite high so that as the R wave begins its rapid climb in amplitude, a correspondingly high slope is also present. By contrast, the reference slope &#34;R&#34; is the maximum value for the eroded slope found during operation of the state machine unless no R waves are found. If for some reason, no subsequent R waves are detected after an initial R wave is detected, the reference slope &#34;R&#34; is set to a low value R 0  by step 56 of &#34;State 2&#34; of the state machine of the reference slope determination system 36. As soon as a subsequent R wave is detected, the state machine will re-establish a maximum value for the reference slope &#34;R&#34; as explained above. 
     Referring to FIG. 3, after an initial time has elapsed to establish a reference slope &#34;R&#34; having a relatively high value corresponding to the detection of the &#34;R&#34; wave, when the value of reference slope &#34;R&#34; and dilated slope &#34;D&#34; differ substantially, the &#34;dilation sample length&#34; after the detection of the R wave has passed. The resulting dilated slope &#34;D&#34; with a relatively low value corresponds to the portion of the input ECG signal between QRS complexes. 
     As an R wave is detected, the ratio &#34;r&#34; of &#34;R&#34; to &#34;D&#34; will approach 1. The ratio &#34;r&#34; of reference slope &#34;R&#34; to dilated slope &#34;D&#34; will be near 1 when the dilation slope &#34;D&#34; indicates the presence of an &#34;R&#34; wave and for the &#34;dilation sample length&#34; thereafter. After the R wave passes and the dilation time length has passed, the ratio &#34;r&#34; will decrease toward 0. Ratio determination system 38 produces an output signal indicative of the ratio &#34;r&#34; of the reference slope &#34;R&#34; to the dilated slope &#34;D&#34;. The output signal from ratio determination system 38 is passed to linear smoothing filter 18 to determine the cut-off frequency of filter 18. 
     Filter 18, is preferably a finite impulse response (FIR) filter as shown schematically in FIG. 6A. Chapter 8 of Digital Signal Processing, 42nd Edition, by William D. Stanley, Gary R. Dougherty and Ray Dougherty contains an excellent treatment of digital FIR filters and their design, the teaching of which is incorporated herein by reference. 
     In the preferred embodiment, the FIR filter is a twelfth order filter. Also in the preferred embodiment, filter 18 has six different cut-off frequencies shown in the chart of FIG. 6B corresponding to different values of ratio &#34;r&#34; so that the filter 18 can smoothly change cut-off frequencies from the lowest to the highest cut-off frequencies, and vice-versa, without abrupt changes in the output of filter 18. Without such transitional filtering, the switch from the minimum to maximum filtering would manifest itself in an abrupt transition in the output ECG signal which would affect the diagnostic value of the ECG. 
     The cut-off frequency used in filter 18 depends on the ratio &#34;r&#34; of the dilated slope &#34;D&#34; to the reference slope &#34;R&#34; as explained above. Different values of ratio &#34;r&#34; are designated by subscripts from 0 to 5 corresponding to the 6 different cut-off frequencies. As shown in FIG. 6B, when the ratio &#34;r&#34; is greater than or equal to 0.64, corresponding to a ratio of &#34;r 0  &#34;, the filter operates at its maximum cut-off frequency. Conversely, when the ratio &#34;r&#34; is less than 0.2, corresponding to a ratio of &#34;r 5  &#34;, the filter operates at its minimum cut-off frequency. The other four cut-off frequencies correspond to the following values for &#34;r&#34;: 0.53≦r 1  &lt;0.64, 0.42≦r 2  &lt;0.53, 0.31≦r 3  &lt;0.42, and 0.2≦r 4  &lt;0.31. 
     As stated, the schematic representation of the filter 18 is shown in FIG. 6A. In FIG. 6A, the ECG signal from delays 16A-N are passed to filter input 70. In the preferred embodiment, filter 18 is implemented on a microprocessor. In this case, each ECG signal is preferably passed to filter 18 in a sequential order so that virtual parallel processing of the ECG signals takes place. However, each ECG signal may have its own filter 18 as desired. From filter input 70, the input ECG signal is sequentially passed through a series of unit delays 72. In the preferred embodiment, filter 18 has 12 unit delays 72. A multiplication block 74, denoted as C n  according to the coefficient values it will contain as explained hereafter, is connected to the line before each unit delay 72. In the schematic representation of FIG. 6A, a line connecting unit delays 72 or leading from the line connecting unit delays 72 to multiplication blocks 74 indicates that whatever digital value is present on the line is presented to all points along the line simultaneously. In the preferred embodiment there are 12 unit delays 72 with 12 corresponding multiplication blocks C 0  through C 11  connected to the inputs of the 12 unit delays 72. In addition, the output of the twelfth and farthest unit delay 72 from filter input 70 is connected to a multiplication block C 12  so that there are a total of 13 multiplication blocks 74. 
     Multiplication blocks C 0  through C 12  contain corresponding coefficients also denoted as values of C 0  through C 12  which are multiplied by the values of the processed ECG signal presented to the inputs of multiplication blocks C 0  through C 12 . The values of the coefficients determines the cut-off frequency of the filter 18 according to the operation of such FIR filters as is well understood in the art. The coefficients C 0  through C 12  for the respective cut-off frequencies are shown in the chart of FIG. 6B. The cut-off frequencies corresponding to the use of respective coefficients C 0  through C 12  are also shown in FIG. 6B. 
     The resulting values from multiplication blocks 74 are passed to adder 76 which adds the values from each of the multiplication blocks 74 and passes the sum to normalizing block 78. Normalizing block 78 multiplies the output from adder 76 by the inverse of the sum of the values of the coefficients C 0  through C 12 . The result of this multiplication operation is passed to the output 14 of the filter 18. 
     As mentioned, each of the ECG inputs 12A-N are passed to the delay 16 which delays the input ECG signal for an amount of time equal to the processing time of the slope determination system 20 and the band width control mechanism 30 plus one half of the dilation sample length. This timing allows the R wave in the input ECG signal to be precisely centered in time on the &#34;window&#34; that the filter 18 is open to its maximum cut-off frequency as directed by the band width control mechanism 30 as described above. After each ECG input 12A-N is delayed in its respective delay 16A-N, each individual ECG input signal 12A-N is passed to its corresponding FIR filter 18A-N. As mentioned, each of these individual ECG signals is preferably sequentially passed to a single digital FIR filter 18 so that a series of virtual parallel filters 18A-N is produced. After each ECG input signal 12A-N has been filtered in filter 18, the filtered ECG signal is output through output 14A-N of filter 18 to an appropriate device to record or display the respective filtered ECG signals such as a video display screen or a chart recorder. 
     The source code implementing the instant invention, including the state machine shown in FIG. 5 and described above, is in the attached Appendix I. 
     The instant invention has been described in connection with a specific embodiment. However, the details described herein in connection with the disclosure of the embodiment have been given by means of example and not for limitation. It is clear that changes and modifications may be made to the description contained herein and still be within the scope of the invention. Further, obvious changes and modifications will occur to those skilled in the art. ##SPC1##