
ECG Parser Module
The ECG Parser Module is designed to extract and process ECG (Electrocardiogram) signal data from a DICOM dataset. It generates a normalized array of points representing the ECG signal, suitable for visualization or analysis in medical imaging workflows
Features
Signal Downsampling:
- Reduces the number of points in the ECG signal for efficient processing and rendering.
- Adjustable via the
nSampling
parameter.
Normalization:
- Converts raw ECG signal values to a normalized scale for consistent visualization.
Integration with Series Metadata:
- The processed ECG data is stored directly in the series
metadata
, making it accessible throughout the application.
- The processed ECG data is stored directly in the series
API Reference
parseECG
Generates an array of points representing the ECG signal from a DICOM dataset and stores the processed data in the series metadata.
Syntax
parseECG(
seriesId: string,
metadata: MetaData,
nSampling?: number
): void
Parameters
Parameter | Type | Description |
---|---|---|
seriesId | string | The unique identifier of the series to which the ECG data belongs. |
metadata | MetaData | Thes metadata object containing the ECG signal data |
nSampling | number | The sampling rate to downsample the signal. Defaults to 2. |
Returns
void
– The function does not return a value. The processed ECG data is stored directly in the series metadata under ecgData
.
How It Works
- Data Extraction:
The function first looks for the raw ECG data within the metadata object using the private DICOM tag (5000,3000). It's designed to handle two common formats:
A Base64 encoded string, which it decodes into a byte array (Uint8Array) -> singleFrame / frame by frame case.
A pre-existing byte array (Uint8Array) -> default multiframe DICOM.
Downsampling:
- The signal is downsampled to reduce the number of points based on the
nSampling
parameter. For example, ifnSampling
is2
, every second point is retained.
- The signal is downsampled to reduce the number of points based on the
Normalization:
- The signal values are normalized to a range of
0
to100
for consistent scaling, calculated using the formula: Normalized Value = ((Value - Min) / (Max - Min)) × 100
- The signal values are normalized to a range of
Data Storage:
- The processed ECG points are stored in the series metadata under the
ecgData
field.
- The processed ECG points are stored in the series metadata under the
Error Handling
Invalid Tag:
- If the specified DICOM tag does not exist in the dataset, an error will occur.
Empty Data:
- If the data element is empty or the byte array is invalid, the function will silently skip processing.
Limitations
Assumes Two-Byte Data:
- The function assumes that the ECG data is stored as two-byte values (Uint16). Datasets with different formats may require modifications.
Single Signal Tag:
- Currently processes a single ECG tag at a time. Multiple tags or multichannel ECG data would require additional handling.
Fixed Normalization:
- Normalization scales values to 0-100, which may not be suitable for all visualization needs.
