fusionlab.datasets.ludb module#
Lobachevsky University Electrocardiography Database (LUDB) link: https://physionet.org/content/ludb/1.0.1/ patient id: 1~200 LEADS: i, ii, iii, avr, avl, avf, v1, v2, v3, v4, v5, v6 segment annotaion symbols: p(P), N(QRS), t(T) file extensions: .dat, .hea, .i, .ii, .iii, .avr, .avl, .avf, .v1, .v2, .v3, .v4, .v5, .v6 filename format: {patient_id}.{file extensions}
signal shape: (5000, 12)
annotation format: symbols: [‘(’, ‘N’, ‘)’, ‘(’, ‘t’, ‘)’, ‘(’, ‘p’, ‘)’] symbol tpye: [‘p’ ‘N’ ‘t’ ‘(’ ‘)’] sample: [ 641 664 690 773 840 887] first symbol in signal index: 641 (all 200 patients) last symbol in signal index: 3996 (all 200 patients)
The generated annotation file follows the format of the label-studio timeserieslabels segment annotation
NOTE: since the annotation is channel independent, we only use the first channel (I) annotation TODO: provide different annotation for different leads
- class fusionlab.datasets.ludb.LUDBDataset(data_dir, annotation_path, transform=None, start_idx=641, end_idx=3996, lead_name='i')[source]#
Bases:
Dataset- Parameters:
data_dir (str) – path to the dataset folder
annotation_path (str) – path to the annotation json file
transform (callable, optional) – Optional transform to be applied on a sample.
start_idx (int) – start index of the signal
end_idx (int) – end index of the signal
lead_name (str) – lead name to extract annotation, default: ‘i’
- Returns:
(channels, sequence lenth) label_seq: (sequence lenth,)
- Return type:
signal
- extract_signal_label(signal, label)[source]#
extract signal and label with respect to start and end index
- Parameters:
signal (np.array) – (signal length, 12)
label (np.array) – (signal length,)
- get_signal(DATA_FOLDER, index)[source]#
- Parameters:
DATA_FOLDER (str) – path to the data folder
index (int) – patient id
- Returns:
(signal length, 12)
- Return type:
signal (np.array)
- map_annotaion_to_label_seq(annotation, sig_len)[source]#
- Parameters:
annotation (dict) – annotation dict
sig_len (int) – signal length
- Returns:
label sequence with integer class index
- Return type:
label_seq (np.array)