Abstract / Summary
ECG waveform data, which is increasingly required for artificial intelligence analyses, is often unavailable in raw data formats. Digitization can approximate original raw data from ECG images, but digitizers reconstruct ECG waveforms only approximately. Exact waveform reconstruction is needed to guarantee that any errors, even if small, do not unexpectedly propagate into downstream analyses. Portable document format (PDF) files containing vector graphics store waveforms derived directly from raw data. This improves reconstruction accuracy, but existing PDF reconstruction methods remain approximate because raw data values are rounded during PDF encoding/generation. Despite rounding, however, there is a 1:1 mapping between raw data and PDF-encoded values which can be reversed to recover the original raw data with no error. We developed open-source software in MATLAB and Python (http://github.com/BIVectors/pdf2ECG) for bit-exact waveform reconstruction of General Electric MUSE ECG PDFs based on double quantization of ECG waveform data. The software supports multiple PDF layouts and voltage gains, automatically flags waveform clipping under which exact reconstruction is not possible, and certifies if parameter values used for waveform reconstruction are consistent with parameter values used during PDF encoding. Accuracy was assessed by comparing PDF reconstructed waveforms to raw XML waveforms, and reconstruction parameters were perturbed to determine the accuracy of waveform certification. 1,632 PDF-XML pairs were assessed in 5 layouts, each at 3 gains. After software-identified waveform clipping was excluded, the software reconstructed 100% of ECG waveforms with zero error compared to ground-truth XML. Certification tests were extremely sensitive to minor perturbation in encoding parameters, and if passed, confirmed bit-exact waveform reconstruction without need for ground-truth comparisons. Although this method does not replace the need for general ECG image digitization, for MUSE generated PDFs this method is preferable to rasterization followed by image-based digitization.