OSCR

SSDLabeler: realistic semi-synthetic data generation for multi-label artifact classification in EEG.

Code ↔ Paper

8 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

5 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 8 matches · 2 of them tie a paragraph to a whole file without given lines: weak matches, whose lines are not tinted
  1. [1] § Methods › Semi-synthetic data generation (SSDLabeler) ↔ SSDLabeler/SSDLabeler.m, lines 1 to 88 · score 0.86 · brain ICs, raw EEG recordings, clean EEG epochs, raw EEG epochs, artifact components, multi artifact · block oscr:b:F36K4MNDBHHQ4-T · Report a mismatch
  2. [2] § Methods › Semi-synthetic data generation (SSDLabeler) ↔ SSDLabeler/SSDLabeler.m, lines 1 to 88 · score 0.71 · artifact presence, ICLabel, SSDLabeler, confident, Raw EEG, ICs · block oscr:b:F36K4MNDBHHQ4-T · Report a mismatch
  3. [3] § Methods › SSD labeler for artifact annotation › SSDLabeler hyperparameter optimization ↔ SSDLabeler/main.m, the whole file · a weak match · score 0.63 · PSD verification, probability threshold, ICLabel, SSDLabeler, motor, hyperparameters · block oscr:b:25Q0MA77PR1B2-5 · Report a mismatch
  4. [4] § Methods › Model › Model architecture and losses ↔ EEG_Artifact_Classification/artifact_classification/module/eeg_artifact_classification.py, lines 158 to 166 · score 0.58 · binary cross entropy, loss, predictions, classification · block oscr:b:R8SXYVWS4CQ10-3 · Report a mismatch
  5. [5] § Methods › SSD labeler for artifact annotation ↔ SSDLabeler/main.m, the whole file · a weak match · score 0.56 · PSD verification, PSD thresholding, events, labeler, RMS, channel · block oscr:b:25Q0MA77PR1B2-5 · Report a mismatch
  6. [6] § Methods › Dataset and preprocessing ↔ EEG_Artifact_Classification/main_EEGArtifact.py, lines 42 to 110 · score 0.55 · cross validation, artifact classification, subset, training, model, raw · block oscr:b:37KMW1Y9MW5JR-Y · Report a mismatch
  7. [7] § Methods › ICA and artifact IC selection ↔ SSDLabeler/SSDLabeler.m, lines 123 to 131 · score 0.53 · mixing matrix, clean EEG, reconstructing, brain, heart, signals · block oscr:b:JX84RWY4PW0Y4-Q · Report a mismatch
  8. [8] § Methods › Model ↔ EEG_Artifact_Classification/main_EEGArtifact.py, lines 42 to 110 · score 0.51 · EEG encoder, artifact classification, module, model, trained, SSD · block oscr:b:37KMW1Y9MW5JR-Y · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

MATLAB · 473 lines · 19 KB · CC-BY-SA-4.0 · 3 matches

  1. function [SSD, contamination_label_all] = SSDLabeler(EEG_data, fs, target_fs, locs, EEG_channels, ...
  2. event_idx, trial_mixing, prob_threshold, mix_artifact, thresh_use, clean_use, ...
  3. thresh_e, thresh_h, thresh_l, thresh_c, thresh_o, thresh_m)
  4. % SSDLabeler
  5. % -------------------------------------------------------------------------
  6. % Generate semi-synthetic EEG datasets (SSD) using ICA + ICLabel-derived
  7. % artifact component signals, plus RMS/PSD-based epoch-level artifact masks.
  8. %
  9. % The function:
  10. % 1) Filters + epochs raw EEG around event indices
  11. % 2) Runs PCA+FastICA, then ICLabel to identify IC classes (A)
  12. % 3) Reconstructs:
  13. % - "clean" EEG from Brain ICs
  14. % - artifact-only signals (Eye/Muscle/Heart/Line/Channel/Other ICs)
  15. % 4) Computes epoch-level artifact presence masks:(B)
  16. % - Eye/Heart/Line/Channel/Other: Standardized RMS thresholds
  17. % - Muscle: PSD-template correlation threshold
  18. % 4.1) Mixes artifacts together (C)
  19. % 5) Generates mixed trials according to one of the supported modes:
  20. % A) SSDLabel (A+B+C): add artifact signals only when that epoch is
  21. % flagged by RMS/PSD masks (multi-artifact per epoch allowed)
  22. % B) Single-artifact (A+B): generate separate datasets per artifact
  23. % type (one artifact type at a time), only when that epoch is flagged
  24. % C) A+C: add all artifact signals regardless of masks (debug/ablation)
  25. %
  26. % Outputs:
  27. % SSD : [N x nChannels x nSamples] dataset
  28. % contamination_label_all : [N x 7] labels [clean, eye, muscle, heart, line, channel, other]
  29. %
  30. % -------------------------------------------------------------------------
  31. % Inputs
  32. % -------------------------------------------------------------------------
  33. % EEG_data : [nChannels x nTime] continuous EEG recording (raw or minimally processed).
  34. % NOTE: channels should correspond to 'locs' and 'EEG_channels'.
  35. %
  36. % fs : Original sampling rate (Hz) of EEG_data (e.g., 500).
  37. %
  38. % target_fs : Target sampling rate (Hz) after resampling (e.g., 125).
  39. % trial_length_sec * target_fs determines the samples per epoch.
  40. %
  41. % locs : EEGLAB-style channel locations struct array (chanlocs).
  42. % Used by ICLabel for topography features.
  43. %
  44. % EEG_channels : Vector of channel indices used for ICA/ICLabel (e.g., 1:19).
  45. % This should match the channels in EEG_data that are EEG (exclude EOG if desired).
  46. %
  47. % event_idx : Vector of sample indices (in fs) indicating epoch start points
  48. % (e.g., movement event onset indices). Each event creates a
  49. % trial_length_sec-long epoch if it fits in EEG_data.
  50. %
  51. % trial_mixing : Integer controlling trial mixing replication.
  52. % In the current method, ONLY trial_mixing == 0 is supported
  53. % (because only the 3 requested generation modes are enabled).
  54. %
  55. % prob_threshold : ICLabel confidence threshold in [0,1].
  56. % If max class probability for an IC < prob_threshold, that IC is treated as "unassigned"
  57. % (i.e., not included in brain or artifact groups via thresholding).
  58. %
  59. % mix_artifact : Boolean selecting generation mode:
  60. % - true : multi-artifact mixing modes (SSDLabel or A+C)
  61. % - false : single-artifact-per-dataset mode (A+B)
  62. %
  63. % thresh_use : Boolean selecting whether RMS/PSD epoch masks are respected:
  64. % - true : SSDLabel (A+B+C) or mode (A+B) mode uses masks to decide which artifacts
  65. % are injected into each epoch
  66. % - false : A+C mode injects ALL artifact signals for every epoch (debug/ablation)
  67. %
  68. % clean_use : Boolean controlling final dataset assembly:
  69. % - true : SSD = [clean_EEG_epochs; raw_epochs; generated_mixed_epochs]
  70. % labels = [clean_label; artifact_label; mix_label]
  71. % - false : SSD = [raw_epochs; generated_mixed_epochs]
  72. % labels = [artifact_label; mix_label]
  73. %
  74. % thresh_e : Percentile (0–100) for Eye RMS z-score thresholding.
  75. % Higher => fewer epochs labeled as Eye artifact (more conservative).
  76. %
  77. % thresh_h : Percentile (0–100) for Heart RMS z-score thresholding.
  78. %
  79. % thresh_l : Percentile (0–100) for Line-noise RMS z-score thresholding.
  80. %
  81. % thresh_c : Percentile (0–100) for Channel-noise RMS z-score thresholding.
  82. %
  83. % thresh_o : Percentile (0–100) for Other RMS z-score thresholding.
  84. %
  85. % thresh_m : Muscle PSD-template correlation threshold (typically in [-1, 1], often ~0.6–0.9).
  86. % Epochs with corr(Pxx_avg, template_PSD) < thresh_m are labeled as Muscle artifact.
  87. % -------------------------------------------------------------------------
  88. %% -------------------- Params --------------------
  89. trial_length_sec = 3;
  90. lp = 1;
  91. hp = 50;
  92. order = 6600;
  93. powerline_freq = 60;
  94. %% -------------------- 1) Filter + detrend --------------------
  95. EEG_data = filter_notch(EEG_data, fs, powerline_freq);
  96. EEG_data = filter_data(EEG_data, fs, lp, hp, order);
  97. EEG_data = detrend(EEG_data')';
  98. %% -------------------- 2) Epoch --------------------
  99. [epochs3d, ~] = epoch_by_events(EEG_data, event_idx, trial_length_sec*fs);
  100. % epochs3d: [ch x samp x trials]
  101. [num_channels, num_samples_fs, num_trials] = size(epochs3d);
  102. % ICA expects [ch x time]
  103. EEG_ica = reshape(epochs3d, num_channels, num_samples_fs*num_trials);
  104. %% -------------------- 3) ICA (PCA whitening + fastICA) --------------------
  105. [mixing_matrix, unmixing_matrix, IC] = run_fastica_with_pca(EEG_ica, fs);
  106. %% -------------------- 4) ICLabel --------------------
  107. class_prob = run_iclabel(EEG_ica, fs, locs, EEG_channels, mixing_matrix, unmixing_matrix);
  108. thresh_class_index = iclabel_threshold_classes(class_prob, prob_threshold);
  109. icIdx = ic_indices_from_thresh(thresh_class_index);
  110. brain_ic_index = icIdx.brain;
  111. if isempty(brain_ic_index)
  112. warning('No brain IC recovered! Please check.')
  113. end
  114. %% -------------------- 5) Build clean EEG + per-artifact reconstructed signals (at fs) --------------------
  115. EEG_clean_fs = mixing_matrix(:, brain_ic_index) * IC(brain_ic_index, :);
  116. Signal_fs.eye = mixing_matrix(:, icIdx.eye) * IC(icIdx.eye, :);
  117. Signal_fs.muscle = mixing_matrix(:, icIdx.muscle) * IC(icIdx.muscle, :);
  118. Signal_fs.heart = mixing_matrix(:, icIdx.heart) * IC(icIdx.heart, :);
  119. Signal_fs.line = mixing_matrix(:, icIdx.line) * IC(icIdx.line, :);
  120. Signal_fs.channel = mixing_matrix(:, icIdx.channel) * IC(icIdx.channel, :);
  121. Signal_fs.other = mixing_matrix(:, icIdx.other) * IC(icIdx.other, :);
  122. %% -------------------- 6) Resample + reshape to [trials x ch x samples] --------------------
  123. num_samples_target = trial_length_sec * target_fs;
  124. EEG_epochs = to_trials(EEG_clean_fs, num_channels, num_samples_target, num_trials, fs, target_fs);
  125. Signal_trials.eye = to_trials(Signal_fs.eye, num_channels, num_samples_target, num_trials, fs, target_fs);
  126. Signal_trials.muscle = to_trials(Signal_fs.muscle, num_channels, num_samples_target, num_trials, fs, target_fs);
  127. Signal_trials.heart = to_trials(Signal_fs.heart, num_channels, num_samples_target, num_trials, fs, target_fs);
  128. Signal_trials.line = to_trials(Signal_fs.line, num_channels, num_samples_target, num_trials, fs, target_fs);
  129. Signal_trials.channel = to_trials(Signal_fs.channel, num_channels, num_samples_target, num_trials, fs, target_fs);
  130. Signal_trials.other = to_trials(Signal_fs.other, num_channels, num_samples_target, num_trials, fs, target_fs);
  131. % Artifact-added (for RMS/PSD detection)
  132. EEG_plus.eye = EEG_epochs + Signal_trials.eye;
  133. EEG_plus.muscle = EEG_epochs + Signal_trials.muscle;
  134. EEG_plus.heart = EEG_epochs + Signal_trials.heart;
  135. EEG_plus.line = EEG_epochs + Signal_trials.line;
  136. EEG_plus.channel = EEG_epochs + Signal_trials.channel;
  137. EEG_plus.other = EEG_epochs + Signal_trials.other;
  138. %% -------------------- 7) RMS-based detection for eye/heart/line/channel/other --------------------
  139. rms_clean_mean = epoch_rms_mean(EEG_epochs);
  140. z_eye = (epoch_rms_mean(EEG_plus.eye) - rms_clean_mean) ./ std(rms_clean_mean);
  141. z_heart = (epoch_rms_mean(EEG_plus.heart) - rms_clean_mean) ./ std(rms_clean_mean);
  142. z_line = (epoch_rms_mean(EEG_plus.line) - rms_clean_mean) ./ std(rms_clean_mean);
  143. z_chan = (epoch_rms_mean(EEG_plus.channel) - rms_clean_mean) ./ std(rms_clean_mean);
  144. z_other = (epoch_rms_mean(EEG_plus.other) - rms_clean_mean) ./ std(rms_clean_mean);
  145. eye_artifact_idx = z_eye > prctile(z_eye, thresh_e);
  146. heart_artifact_idx = z_heart > prctile(z_heart, thresh_h);
  147. line_artifact_idx = z_line > prctile(z_line, thresh_l);
  148. channel_artifact_idx = z_chan > prctile(z_chan, thresh_c);
  149. other_artifact_idx = z_other > prctile(z_other, thresh_o);
  150. %% -------------------- 8) Muscle detection with PSD-template correlation --------------------
  151. muscle_artifact_idx = muscle_psd_template_mask(EEG_plus.muscle, target_fs, thresh_m);
  152. %% -------------------- 9) Build masks struct --------------------
  153. artifactMasks.eye = eye_artifact_idx;
  154. artifactMasks.muscle = muscle_artifact_idx;
  155. artifactMasks.heart = heart_artifact_idx;
  156. artifactMasks.line = line_artifact_idx;
  157. artifactMasks.channel = channel_artifact_idx;
  158. artifactMasks.other = other_artifact_idx;
  159. %% -------------------- 10) Build "epochs_all" (resampled original) --------------------
  160. epochs_all = to_trials(reshape(epochs3d, num_channels, []), num_channels, num_samples_target, num_trials, fs, target_fs);
  161. %% -------------------- 11) Generation stage (ONLY 3 MODES) --------------------
  162. if ~(trial_mixing == 0)
  163. error('Only trial_mixing == 0 is supported in this refactor (per your requested modes).');
  164. end
  165. if thresh_use == true && mix_artifact == true
  166. % SSDLabel: A+B+C
  167. [trial_mix_data, trial_mix_label] = gen_SSDLabel_ABC(EEG_epochs, Signal_trials, artifactMasks);
  168. elseif mix_artifact == false
  169. % A+B: single-artifact mixing
  170. [trial_mix_data, trial_mix_label] = gen_singleArtifact_AB(EEG_epochs, Signal_trials, artifactMasks);
  171. elseif thresh_use == false && mix_artifact == true
  172. % A+C: no RMS or PSD verification
  173. [trial_mix_data, trial_mix_label] = gen_allArtifacts_AC(EEG_epochs, Signal_trials, artifactMasks);
  174. else
  175. error('Unsupported configuration. Only the 3 requested generation modes are enabled.');
  176. end
  177. %% -------------------- 12) Labels for clean + artifact (non-mixed) --------------------
  178. clean_label = make_clean_labels(size(EEG_epochs,1));
  179. artifact_label = make_artifact_labels(size(EEG_epochs,1), artifactMasks);
  180. %% -------------------- 13) Concatenate outputs --------------------
  181. if clean_use
  182. contamination_label_all = [clean_label; artifact_label; trial_mix_label];
  183. SSD = [EEG_epochs; epochs_all; trial_mix_data];
  184. else
  185. contamination_label_all = [artifact_label; trial_mix_label];
  186. SSD = [epochs_all; trial_mix_data];
  187. end
  188. end
  189. %% ========================================================================
  190. % Helpers
  191. % ========================================================================
  192. function [epochs3d, valid_mask] = epoch_by_events(EEG, event_idx, epoch_samples)
  193. n_ch = size(EEG,1);
  194. epochs3d = [];
  195. valid_mask = false(size(event_idx));
  196. for i = 1:numel(event_idx)
  197. idx = event_idx(i);
  198. if idx + epoch_samples - 1 <= size(EEG,2)
  199. epochs3d = cat(3, epochs3d, EEG(:, idx:(idx+epoch_samples-1)));
  200. valid_mask(i) = true;
  201. end
  202. end
  203. if isempty(epochs3d)
  204. epochs3d = zeros(n_ch, epoch_samples, 0);
  205. end
  206. end
  207. function [A, W, IC] = run_fastica_with_pca(X, fs)
  208. [dewhitening, ~, latent] = pca(X','Centered','off');
  209. whitening = inv(dewhitening);
  210. PC = whitening * X;
  211. latent = 100 * latent / sum(latent);
  212. n_pcs = sum(latent > 0.01*mean(latent));
  213. [~, mixing, unmixing] = fastica(PC(1:n_pcs,:), 'approach','defl','g','tanh','maxNumIterations',fs);
  214. IC = unmixing * PC(1:n_pcs,:);
  215. A = dewhitening(:,1:n_pcs) * mixing;
  216. W = unmixing * whitening(1:n_pcs,:);
  217. end
  218. function class_prob = run_iclabel(EEG_ica, fs, locs, EEG_channels, A, W)
  219. data_len = size(EEG_ica,2);
  220. t = linspace(0, data_len/fs, data_len);
  221. EEG_struct = struct();
  222. EEG_struct.times = t;
  223. EEG_struct.data = EEG_ica;
  224. EEG_struct.chanlocs = locs;
  225. EEG_struct.srate = fs;
  226. EEG_struct.trials = 1;
  227. EEG_struct.pnts = data_len;
  228. EEG_struct.icawinv = A;
  229. EEG_struct.icaweights = W;
  230. EEG_struct.icaact = W * EEG_ica;
  231. EEG_struct.icachansind = EEG_channels;
  232. EEG_struct.ref = 'averef';
  233. EEG_struct = iclabel(EEG_struct);
  234. class_prob = EEG_struct.etc.ic_classification.ICLabel.classifications;
  235. end
  236. function thresh_class_index = iclabel_threshold_classes(class_prob, prob_threshold)
  237. [nIC, ~] = size(class_prob);
  238. thresh_class_index = zeros(1, nIC);
  239. for i = 1:nIC
  240. [mx, idx] = max(class_prob(i,:));
  241. if mx >= prob_threshold
  242. thresh_class_index(i) = idx;
  243. else
  244. thresh_class_index(i) = 0;
  245. end
  246. end
  247. end
  248. function icIdx = ic_indices_from_thresh(thresh_class_index)
  249. icIdx.brain = find(thresh_class_index == 1);
  250. icIdx.muscle = find(thresh_class_index == 2);
  251. icIdx.eye = find(thresh_class_index == 3);
  252. icIdx.heart = find(thresh_class_index == 4);
  253. icIdx.line = find(thresh_class_index == 5);
  254. icIdx.channel = find(thresh_class_index == 6);
  255. icIdx.other = find(thresh_class_index == 7);
  256. end
  257. function Xtr = to_trials(Xfs, n_ch, n_samp, n_trials, fs, target_fs)
  258. Xrs = resample(Xfs', target_fs, fs)'; % [ch x (samples_target*trials)]
  259. Xtr = reshape(Xrs, n_ch, n_samp, n_trials);
  260. Xtr = permute(Xtr, [3 1 2]); % [trials x ch x samp]
  261. end
  262. function m = epoch_rms_mean(X)
  263. m = squeeze(mean(sqrt(mean(X.^2, 3)), 2)); % [trials x 1]
  264. end
  265. function muscle_mask = muscle_psd_template_mask(EEG_plus_muscle, target_fs, corr_threshold)
  266. [epoch_num, channel_num, ~] = size(EEG_plus_muscle);
  267. frequencies = 1:50;
  268. template_PSD = exp(-1 * (1:length(frequencies)) / 20)';
  269. PSD_corr = zeros(epoch_num, 1);
  270. for i = 1:epoch_num
  271. epoch_data = squeeze(EEG_plus_muscle(i,:,:)); % [ch x samp]
  272. Pxx_all = zeros(length(frequencies), channel_num);
  273. for ch = 1:channel_num
  274. Pxx_all(:, ch) = pwelch(epoch_data(ch,:), [], [], frequencies, target_fs);
  275. end
  276. Pxx_avg = mean(Pxx_all, 2);
  277. PSD_corr(i) = corr(Pxx_avg, template_PSD);
  278. end
  279. muscle_mask = PSD_corr < corr_threshold;
  280. end
  281. function L = make_clean_labels(n)
  282. L = zeros(n,7);
  283. L(:,1) = 1;
  284. end
  285. function L = make_artifact_labels(n, masks)
  286. L = zeros(n,7);
  287. L(masks.eye, 2) = 1;
  288. L(masks.muscle, 3) = 1;
  289. L(masks.heart, 4) = 1;
  290. L(masks.line, 5) = 1;
  291. L(masks.channel, 6) = 1;
  292. L(masks.other, 7) = 1;
  293. no_art = sum(L(:,2:7),2) < 1;
  294. L(no_art,1) = 1;
  295. end
  296. %% ========================================================================
  297. % ONLY 3 GENERATION FUNCTIONS
  298. % ========================================================================
  299. function [trial_mix_data, trial_mix_label] = gen_SSDLabel_ABC(EEG_epochs, Signal_trials, masks)
  300. % thresh_use==true, trial_mixing==0, mix_artifact==true
  301. disp('SSDLabel')
  302. nTrials = size(EEG_epochs,1);
  303. trial_mix_data = [];
  304. trial_mix_label = [];
  305. for i = 1:nTrials
  306. mixed_trial = squeeze(EEG_epochs(i,:,:));
  307. if masks.eye(i)
  308. mixed_trial = mixed_trial + squeeze(Signal_trials.eye(i,:,:));
  309. end
  310. if masks.muscle(i)
  311. mixed_trial = mixed_trial + squeeze(Signal_trials.muscle(i,:,:));
  312. end
  313. if masks.heart(i)
  314. mixed_trial = mixed_trial + squeeze(Signal_trials.heart(i,:,:));
  315. end
  316. if masks.line(i)
  317. mixed_trial = mixed_trial + squeeze(Signal_trials.line(i,:,:));
  318. end
  319. if masks.channel(i)
  320. mixed_trial = mixed_trial + squeeze(Signal_trials.channel(i,:,:));
  321. end
  322. if masks.other(i)
  323. mixed_trial = mixed_trial + squeeze(Signal_trials.other(i,:,:));
  324. end
  325. temp_label = [0, masks.eye(i), masks.muscle(i), masks.heart(i), masks.line(i), masks.channel(i), masks.other(i)];
  326. if sum(temp_label) == 0
  327. temp_label = [1,0,0,0,0,0,0];
  328. end
  329. trial_mix_data = cat(1, trial_mix_data, reshape(mixed_trial, [1, size(mixed_trial,1), size(mixed_trial,2)]));
  330. trial_mix_label = [trial_mix_label; temp_label];
  331. end
  332. end
  333. function [trial_mix_data, trial_mix_label] = gen_singleArtifact_AB(EEG_epochs, Signal_trials, masks)
  334. % trial_mixing==0, mix_artifact==false
  335. nTrials = size(EEG_epochs,1);
  336. trial_mix_data = [];
  337. trial_mix_label = [];
  338. for art = 2:7
  339. if art == 2 && sum(masks.eye) < 1, continue; end
  340. if art == 3 && sum(masks.muscle) < 1, continue; end
  341. if art == 4 && sum(masks.heart) < 1, continue; end
  342. if art == 5 && sum(masks.line) < 1, continue; end
  343. if art == 6 && sum(masks.channel) < 1, continue; end
  344. if art == 7 && sum(masks.other) < 1, continue; end
  345. for i = 1:nTrials
  346. mixed_trial = squeeze(EEG_epochs(i,:,:));
  347. temp_label = [0,0,0,0,0,0,0];
  348. if art == 2 && masks.eye(i)
  349. mixed_trial = mixed_trial + squeeze(Signal_trials.eye(i,:,:));
  350. temp_label = [0,1,0,0,0,0,0];
  351. elseif art == 3 && masks.muscle(i)
  352. mixed_trial = mixed_trial + squeeze(Signal_trials.muscle(i,:,:));
  353. temp_label = [0,0,1,0,0,0,0];
  354. elseif art == 4 && masks.heart(i)
  355. mixed_trial = mixed_trial + squeeze(Signal_trials.heart(i,:,:));
  356. temp_label = [0,0,0,1,0,0,0];
  357. elseif art == 5 && masks.line(i)
  358. mixed_trial = mixed_trial + squeeze(Signal_trials.line(i,:,:));
  359. temp_label = [0,0,0,0,1,0,0];
  360. elseif art == 6 && masks.channel(i)
  361. mixed_trial = mixed_trial + squeeze(Signal_trials.channel(i,:,:));
  362. temp_label = [0,0,0,0,0,1,0];
  363. elseif art == 7 && masks.other(i)
  364. mixed_trial = mixed_trial + squeeze(Signal_trials.other(i,:,:));
  365. temp_label = [0,0,0,0,0,0,1];
  366. end
  367. if sum(temp_label) == 0
  368. temp_label = [1,0,0,0,0,0,0];
  369. end
  370. trial_mix_data = cat(1, trial_mix_data, reshape(mixed_trial, [1, size(mixed_trial,1), size(mixed_trial,2)]));
  371. trial_mix_label = [trial_mix_label; temp_label];
  372. end
  373. end
  374. end
  375. function [trial_mix_data, trial_mix_label] = gen_allArtifacts_AC(EEG_epochs, Signal_trials, masks)
  376. % thresh_use==false, trial_mixing==0, mix_artifact==true
  377. nTrials = size(EEG_epochs,1);
  378. trial_mix_data = [];
  379. trial_mix_label = [];
  380. for i = 1:nTrials
  381. mixed_trial = squeeze(EEG_epochs(i,:,:));
  382. mixed_trial = mixed_trial + squeeze(Signal_trials.eye(i,:,:));
  383. mixed_trial = mixed_trial + squeeze(Signal_trials.muscle(i,:,:));
  384. mixed_trial = mixed_trial + squeeze(Signal_trials.heart(i,:,:));
  385. mixed_trial = mixed_trial + squeeze(Signal_trials.line(i,:,:));
  386. mixed_trial = mixed_trial + squeeze(Signal_trials.channel(i,:,:));
  387. mixed_trial = mixed_trial + squeeze(Signal_trials.other(i,:,:));
  388. temp_label = [0, masks.eye(i), masks.muscle(i), masks.heart(i), masks.line(i), masks.channel(i), masks.other(i)];
  389. if sum(temp_label) == 0
  390. temp_label = [1,0,0,0,0,0,0];
  391. end
  392. trial_mix_data = cat(1, trial_mix_data, reshape(mixed_trial, [1, size(mixed_trial,1), size(mixed_trial,2)]));
  393. trial_mix_label = [trial_mix_label; temp_label];
  394. end
  395. end

SSDLabeler.m at commit 10158c5, under CC-BY-SA-4.0 · at the source

Overview

Authors: Taketo Akama1, Akima Connelly1,2, Shun Minamikawa1, Natalia Polouliakh1
  1. Sony Computer Science Laboratories, Inc., Tokyo, Japan
  2. Institute of Science Tokyo, Tokyo, Japan
Journal: Scientific reports, volume 16, issue 1, article 25980
Dates: received 3 March 2026; accepted 28 May 2026; published online 8 June 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41598-026-56070-y · PMID 42259834 · PMCID PMC13487299 · OpenAlex W4417142610
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: EEG (modality), human (organism)
Methods: Spectral & time-frequency, Preprocessing, Connectivity, Smoothing, state filtering, decompositions, Machine learning, Physiology & signal measures
Keywords: EEG, Semi-synthetic data, Artifact, Multi-label classification, Biological techniques, Computational biology and bioinformatics, Engineering, Mathematics and computing, Neuroscience
MeSH: Artifacts*, Electroencephalography*, Signal Processing, Computer-Assisted*, Algorithms, Humans (* major topic)
Topic: EEG and Brain-Computer Interfaces (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: not cited yet (Europe PMC); 32 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

Its files are read in the Code ↔ Paper reader above, with 8 matches between paragraphs and lines of code.

AkimaCon/SSDLabeler

License: CC-BY-SA-4.0
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 10158c5989af6d7f8abba8d067b715f667bede6b, 5 June 2026
Languages: Python (11), MATLAB (2), Jupyter (1), Shell (1)
Size: 25 files, 15 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README, license file, environment (EEG_Artifact_Classification/requirements.txt), 1 notebook
Not found: CITATION.cff, tests, continuous integration, documentation
Tools: PyTorch (7 files), NumPy (6 files), pandas (4 files), scikit-learn (3 files), PyTorch Lightning (2 files), Matplotlib (2 files), EEGLAB (1 file), ICLabel (1 file), Signal Processing Toolbox (1 file), Statistics and Machine Learning Toolbox (1 file), seaborn (1 file), statsmodels (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
17 files

Code availability statement

The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41598-026-56070-y.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 15 scripts, each with its path and the digest of its content;
  • 8 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Data availability statement

The paper has a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41598-026-56070-y.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 9 keywords, 5 MeSH terms, 31 references.

Cite

This paper

Akama, T., Connelly, A., Minamikawa, S., & Polouliakh, N. (2026). SSDLabeler: realistic semi-synthetic data generation for multi-label artifact classification in EEG. Scientific reports, 16(1), 25980. https://doi.org/10.1038/s41598-026-56070-y

BibTeX

@article{akama2026ssdlabeler,
author = {Akama, Taketo and Connelly, Akima and Minamikawa, Shun and Polouliakh, Natalia},
title = {{SSDLabeler: realistic semi-synthetic data generation for multi-label artifact classification in EEG}},
journal = {Scientific reports},
year = {2026},
month = jun,
volume = {16},
number = {1},
pages = {25980},
publisher = {Nature Publishing Group},
issn = {2045-2322},
doi = {10.1038/s41598-026-56070-y},
url = {https://doi.org/10.1038/s41598-026-56070-y},
pmid = {42259834},
pmcid = {PMC13487299}
}

RIS

TY - JOUR
AU - Akama, Taketo
AU - Connelly, Akima
AU - Minamikawa, Shun
AU - Polouliakh, Natalia
TI - SSDLabeler: realistic semi-synthetic data generation for multi-label artifact classification in EEG
T2 - Scientific reports
J2 - Sci Rep
PY - 2026
DA - 2026/06/08
VL - 16
IS - 1
SP - 25980
SN - 2045-2322
PB - Nature Publishing Group
DO - 10.1038/s41598-026-56070-y
UR - https://doi.org/10.1038/s41598-026-56070-y
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41598-026-56070-y",
"type": "article-journal",
"title": "SSDLabeler: realistic semi-synthetic data generation for multi-label artifact classification in EEG",
"container-title": "Scientific reports",
"author": [
{
"family": "Akama",
"given": "Taketo"
},
{
"family": "Connelly",
"given": "Akima"
},
{
"family": "Minamikawa",
"given": "Shun"
},
{
"family": "Polouliakh",
"given": "Natalia"
}
],
"container-title-short": "Sci Rep",
"volume": "16",
"issue": "1",
"page": "25980",
"DOI": "10.1038/s41598-026-56070-y",
"PMID": "42259834",
"PMCID": "PMC13487299",
"ISSN": "2045-2322",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41598-026-56070-y",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
8
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.3390/s25010231 [code]
DHCT-GAN: Improving EEG Signal Quality with a Dual-Branch Hybrid CNN-Transformer Network.
Journal: Sensors (Basel, Switzerland)
In common: ICLabel, EEGLAB, Signal Processing Toolbox, 4 other tools, EEG, 8 references
[2] doi:10.1523/eneuro.0160-22.2022 [code]
Improved Manual Annotation of EEG Signals through Convolutional Neural Network Guidance.
Journal: eNeuro
In common: ICLabel, EEGLAB, Signal Processing Toolbox, 6 other tools, EEG, 5 references
[3] doi:10.1038/s41598-025-28855-0 [code]
ReHA-Net: a ReVIN-hybrid attention network with multiscale convolution for robust EEG artifact removal in brain-computer interfaces.
Journal: Scientific reports
In common: ICLabel, EEGLAB, Signal Processing Toolbox, 4 other tools, EEG, 5 references
[4] doi:10.1111/cns.70632 [code]
LRR-UNet: A Deep Unfolding Network With Low-Rank Recovery for EEG Signal Denoising.
Journal: CNS neuroscience & therapeutics
In common: ICLabel, EEGLAB, Signal Processing Toolbox, 4 other tools, EEG, 3 references
[5] doi:10.3390/s22082853 [code]
Scorepochs: A Computer-Aided Scoring Tool for Resting-State M/EEG Epochs.
Journal: Sensors (Basel, Switzerland)
In common: EEGLAB, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, 2 other tools, physionet.org/content/eegmmidb, EEG, 3 references
[6] doi:10.1016/j.ebiom.2024.105259 [code]
Machine learning of brain-specific biomarkers from EEG.
Journal: EBioMedicine
In common: ICLabel, PyTorch, Statistics and Machine Learning Toolbox, 4 other tools, EEG, 4 references
[7] doi:10.3390/s26134019 [code]
NeuroStat: An Open-Source EEG Connectivity Platform for Randomised Controlled Trials.
Journal: Sensors (Basel, Switzerland)
In common: ICLabel, pandas, Matplotlib, 1 other tool, physionet.org/content/eegmmidb, EEG, 3 references
[8] doi:10.3390/life13020391 [code]
On the Influence of Aging on Classification Performance in the Visual EEG Oddball Paradigm Using Statistical and Temporal Features.
Journal: Life (Basel, Switzerland)
In common: EEGLAB, seaborn, scikit-learn, 3 other tools, EEG, 5 references
[9] doi:10.1002/hbm.70528 [code]
Explainable AI Insights Into EEG Classification and Its Alignment to Neural Correlates.
Journal: Human brain mapping
In common: ICLabel, PyTorch, seaborn, 4 other tools, EEG, 3 references
[10] doi:10.3390/s23115051
Decoding Multi-Class Motor Imagery and Motor Execution Tasks Using Riemannian Geometry Algorithms on Large EEG Datasets.
Journal: Sensors (Basel, Switzerland)
In common: physionet.org/content/eegmmidb, EEG, 5 references

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1038/s41598-026-56070-y.svg)](https://openscicode.org/badge/doi/10.1038/s41598-026-56070-y)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1038/s41598-026-56070-y.svg
   :target: https://openscicode.org/badge/doi/10.1038/s41598-026-56070-y
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41598-026-56070-y"><img src="https://openscicode.org/badge/doi/10.1038/s41598-026-56070-y.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.