2
J. ELECTROCARDIOLOGY, 6 (2) 175-176, 1973 Letters to the Editor An ECG Compression Code To the Editor: Real-time transmission of high-quality electro- cardiographic signals in three-channel analog form is not feasible over one standard long- distance telephone line. Low cost transmission of tape recorded X, Y, Z, signals is required in a mass-screening program we are developing in British Columbia. Our solution to this problem, which involves digital processing and data com- pression, may be of interest to your readers. Digitization The analog system has a signal-to-noise ratio of 150:1. Each channel is converted to an eight-bit binary-offset word, where negative values are less than 128 and positive values are greater than 128. The data are scaled with extreme values at 16 and 239. The scale thus contains 224 units; more reso- lution is not justified by the original signal. The analog system has an upper cut-off fre- quency of 330 Hz. The required sampling rate of 1,000 samples per second, 50% above Shannon's theoretic minimum, was found experimentally. With data compression, there is no need to sample at the lowest possible rate because the compression scheme eliminates unnecessary samples. In effect, it varies the rate to suit the patient. Compression Compression operates on the number of samples and the number of bits which represent each sample. The sampling frequency of the X, Y, Z signals is uniform. Only those samples are stored which show a significant change from the previously stored sample. The number of dropped samples is recorded so the compression is reversible. The high sampling rate gives rise to small changes in each channel. The expected maximum is less than 16 units per millisecond. Given one reference sample, the differences between suc- ceeding samples can represent the heart signal with five bits per channel, compared to the original eight bits. Coding The ECG Compression Code organizes these data into a string of eight-bit characters or bytes for practical transmission or storage in code- sensitive devices. Characters are grouped into blocks to reduce redundant housekeeping infor- mation. These extra data are the only coded char- acters which have decimal representations in two reserved ranges: 0 to 15 and 240 to 255. This reduces conflicts with the Teletype Data Inter- change Code. Other features of the ECG Compression Code are the abilities to detect transmission errors and to intermix heart data and patient identification blocks. Each block contains an identifying start character, a stop character, and two check-sum characters. Data Frames The basic unit of heart data is a frame. This is a set of three or more numbers which represents the heart signal at one instant. There are two types of frames, reference frames and delta frames. Reference frames are three eight-bit numbers, X, Y, and Z, in binary-offset form. For com- pression, the frame must be expanded to show how many sample periods have passed since the last frame was stored. Let dT be this number. Resting patients rarely have a constant heart signal for longer than 15 ms, so little is lost by restricting dT to the range 1 to 63. This needs six bits of storage. Delta frames consist of dT and the differences, dX, dY, and dZ, packed into three eight-bit bytes. Each frame contains 21 information bits (six for dT, five each for dX, dY, and dZ). The extra bits are distributed one to a byte in such a way that the reserved characters do not occur. The delta packing process splits the six bits of dT into three parts. Numbering the bits from left to right we get dT = t o, tl, t2, t3, t4, t 5. Each of the three extra bits is the binary complement of the adjacent bit on the right. Then if dX, dY, and dZ are the five-bit differences, we have this form for the delta frame: First Byte Second Byte Third Byte to, to, tl, dX; t2, t2, t3, dY; t4, t4, ts, dZ, where the bars signify complementary bits. Each byte is in the numeric range 64 to 191. 175

An ECG compression code

Embed Size (px)

Citation preview

Page 1: An ECG compression code

J. ELECTROCARDIOLOGY, 6 (2) 175-176, 1973

Letters to the Editor

An ECG Compression Code

To the Editor: Real-time transmission of high-quality electro-

cardiographic signals in three-channel analog form is not feasible over one standard long- distance telephone line. Low cost transmission of tape recorded X, Y, Z, signals is required in a mass-screening program we are developing in British Columbia. Our solution to this problem, which involves digital processing and data com- pression, may be of interest to your readers. Digitization

The analog system has a signal-to-noise ratio of 150:1. Each channel is converted to an eight-bit binary-offset word, where negative values are less than 128 and positive values are greater than 128. The data are scaled with extreme values at 16 and 239. The scale thus contains 224 units; more reso- lution is not justified by the original signal.

The analog system has an upper cut-off fre- quency of 330 Hz. The required sampling rate of 1,000 samples per second, 50% above Shannon's theoretic minimum, was found experimentally.

With data compression, there is no need to sample at the lowest possible rate because the compression scheme eliminates unnecessary samples. In effect, it varies the rate to suit the patient. Compression

Compression operates on the number of samples and the number of bits which represent each sample. The sampling frequency of the X, Y, Z signals is uniform. Only those samples are stored which show a significant change from the previously stored sample. The number of dropped samples is recorded so the compression is reversible.

The high sampling rate gives rise to small changes in each channel. The expected maximum is less than 16 units per millisecond. Given one reference sample, the differences between suc- ceeding samples can represent the heart signal with five bits per channel, compared to the original eight bits. Coding

The ECG Compression Code organizes these data into a string of eight-bit characters or bytes for practical transmission or storage in code-

sensitive devices. Characters are grouped into blocks to reduce redundant housekeeping infor- mation. These extra data are the only coded char- acters which have decimal representations in two reserved ranges: 0 to 15 and 240 to 255. This reduces conflicts with the Teletype Data Inter- change Code.

Other features of the ECG Compression Code are the abilities to detect transmission errors and to intermix heart data and patient identification blocks. Each block contains an identifying start character, a stop character, and two check-sum characters. Data Frames

The basic unit of heart data is a frame. This is a set of three or more numbers which represents the heart signal at one instant. There are two types of frames, reference frames and delta frames.

Reference frames are three eight-bit numbers, X, Y, and Z, in binary-offset form. For com- pression, the frame must be expanded to show how many sample periods have passed since the last frame was stored. Let dT be this number. Resting patients rarely have a constant heart signal for longer than 15 ms, so little is lost by restricting dT to the range 1 to 63. This needs six bits of storage.

Delta frames consist of dT and the differences, dX, dY, and dZ, packed into three eight-bit bytes. Each frame contains 21 information bits (six for dT, five each for dX, dY, and dZ). The extra bits are distributed one to a byte in such a way that the reserved characters do not occur.

The delta packing process splits the six bits of dT into three parts. Numbering the bits from left to right we get dT = t o, tl, t2, t3, t4, t 5. Each of the three extra bits is the binary complement of the adjacent bit on the right. Then if dX, dY, and dZ are the five-bit differences, we have this form for the delta frame:

First Byte Second Byte Third Byte to, to, tl, dX; t2, t2, t3, dY; t4, t4, ts, dZ,

where the bars signify complementary bits. Each byte is in the numeric range 64 to 191.

175

Page 2: An ECG compression code

1 76 STEWART ET AL

Heart Data Blocks Heart data blocks contain one reference frame

followed by many delta frames. Usable values are produced at the receiver by the inverse of compression. Each reference frame (except the initial one) matches the last delta frame of the previous block.

When transmission errors occur, all points in the same block and after the erroneous frame are shifted in time, magnitude, or both. However, the error is corrected by the next reference frame. Since an abundance of data is collected routinely, it is satisfactory to ignore a block in which the errors have been detected.

The block length could be set at any number of frames from 20 to 100. Longer blocks may be awkward to discard in the event of an error. Shorter blocks reduce the efficiency of the code below 90%.

Our heart data blocks consist of a start charac- ter (251), a reference frame, 31 delta frames, a stop character (13), and two check-sum characters. This gives a total block length of 100 characters, which is 93% efficient.

Error Detection The lack of redundancy in the coded heart data

makes error-detection techniques mandatory. The exclusive- or check-sum is easily implemented on mini-computers. Pairs of characters, starting with the start character, are combined in parallel. If the

Y

block length is odd, a null character is inserted before the stop character. The final result, including the two check-sum characters as the last 16-bit operand, should be zero.

Errors can also be detected by the occurrence of restricted characters. Long bursts of errors would cause these. Short bursts and independent errors have two chances in a million of creating errors which cannot be detected with the check-sum (as- suming .00001 error rate and 100 byte block length).

Conclusion This ECG compression code typically reduces

our data by 90%, due to the fact that high frequency components occur in only a brief part of the heart cycle. The amount of compression depends upon the heart rate, individual variations, and the amount of muscle tremor and other noise in the analog signal.

Dale Stewart Gordon E. Dower, M.B. Oscar Suranyi

Department of Cardiology Vancouver General Hospital

Department of Polarcardiograpby Shaughnessy Hospital

Department of Pharmacology University of British Columbia Vancouver, B.C., Canada

Supported by the B. C. Heart Foundation

X r .... ------. 4"

Y ,~ . ~ . ~

SEC.

O .0 0 .3 O .6

I I I

0.9 1.2 1.5 0 0 D.3 0 .6 0 .9 1.2 1.5

Y c

EOPIPRESSEB TIME 5gALE COMPRESSED ;]PIE SE,qLE

CARDIAC DATA COMPRESSION. FRANK LEADS CARDIAC DATA COMPRESSION FRANK LEADS

Two examples of compression. Computer plots of digitized EGG signals before compression (X, Y, Z) and after compression (Xc, Yc, Zc). The average compression achieved over several beats was 78% for the first example and 92% for the second, giving compression ratios of approximately 5:1 and 13:1, respectively. Note that there is relatively little compression of the QRS complex compared to that of slower parts of the tracings: (Resolution: vertical, 8 bits; horizontal, 1000 samples/second.)

J. ELECTROCARDIOLOGY, VOL 6, NO. 2. 1973