Evaluation of PainWaive: a consumer-grade EEG headset for remote EEG monitoring and neurofeedback research in chronic pain.
The 6 matches
- [1] § Methods › EEG data post-processing pipeline ↔ experimental_data_analysis_final.m, lines 249 to 331 · score 0.84 · ft_freqanalysis, epoch overlap, FieldTrip, tapsmofrq, keeptrials, mtmfft · Report a mismatch
- [2] § Methods › EEG data post-processing pipeline ↔ clinical_data_analysis_final.m, lines 299 to 405 · score 0.83 · ft_freqanalysis, FieldTrip, analysed, keeptrials, mtmfft, yes · Report a mismatch
- [3] § Results › Relative test-retest reliability (clinical sample) ↔ clinical_data_analysis_final.m, lines 58 to 93 · score 0.79 · neuropathic eye pain, reward band, chronic low, 10–15 Hz, overlapping window, beta power · Report a mismatch
- [4] § Results › Relative test-retest reliability (clinical sample) ↔ clinical_data_analysis_final.m, lines 58 to 93 · score 0.75 · reward band power, Fixed window PAF, 10–15 Hz, 8–12 Hz, high beta, overlapping · Report a mismatch
- [5] § Methods › EEG data pre-processing pipeline ↔ experimental_data_analysis_final.m, lines 137 to 183 · score 0.65 · bad channel, EEGLAB, analogous, PainWaive, pop, LiveAmp · Report a mismatch
- [6] § Methods › Data collection procedures—clinical sample ↔ clinical_data_analysis_final.m, lines 1 to 34 · score 0.63 · 10–15 Hz, 20–30 Hz, feedback, 4–7 Hz, raw, windows · 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 · 808 lines · 25 KB · no license · 4 matches
- %% clinical_data_analysis_final.m
- % Clinical PainWaive EEG reliability analysis from saved preprocessed recordings.
- %
- % This script starts from the saved *_eeg_preprocessed.mat files generated by
- % the clinical preprocessing pipeline. It does not re-import raw CSV or JSON
- % files.
- %
- % Outputs:
- % 1. Long-form short-window EEG feature table
- % 2. Pooled descriptive ICCs across all sessions
- % 3. Participant-level ICCs for the standard 5-s analysis
- % 4. Cohort-stratified ICCs for the standard 5-s analysis
- % 5. Separate 2-s 80%-overlap analysis for feedback-timescale estimates
- %
- % Window definitions:
- % - Non-overlapping windows: 1, 2, 3, 4, and 5 s
- % - PAF is computed only for windows >= 2 s
- % - Additional 2-s windows with 80% overlap are computed for all metrics
- %
- % Metrics:
- % alpha_power = 8-12 Hz
- % beta_power = 13-30 Hz
- % theta_power = 4-7 Hz
- % highbeta_power = 20-30 Hz
- % band1015_power = 10-15 Hz
- % paf_fixed = centre-of-gravity PAF in 8-12 Hz
- %
- % Spectral features are computed from C1/C2 when both labels are available.
- clearvars
- close all
- clc
- set(0, 'DefaultFigureVisible', 'off');
- %% ------------------------------------------------------------------------
- % Paths and toolboxes
- %% ------------------------------------------------------------------------
- addpath('C:\Users\nchowdhury\eeglab2023.0') %Replace with EEGLAB Path
- eeglab; close all;
- addpath('C:\Users\nchowdhury\fieldtrip-20250106');
- addpath('C:\Users\nchowdhury\fieldtrip-20250106\external\eeglab')
- addpath('C:\Users\nchowdhury\eeglab2023.0\functions\sigprocfunc')
- addpath(genpath('C:\Users\nchowdhury\mcolonFolder'))
- ft_defaults;
- root_dir = "C:\Users\nchowdhury\Clinical_Data"; %Replace with Data directory
- out_dir = fullfile(root_dir, 'clinical_data_analysis_outputs');
- if ~exist(out_dir, 'dir')
- mkdir(out_dir);
- end
- %% ------------------------------------------------------------------------
- % Analysis settings
- %% ------------------------------------------------------------------------
- nonoverlap_windows_sec = 1:5;
- overlap_window_sec = 2;
- overlap_fraction = 0.80;
- artifact_threshold_uv = 150;
- bands.alpha = [8 12];
- bands.beta = [13 30];
- bands.theta = [4 7];
- bands.highbeta = [20 30];
- bands.band1015 = [10 15];
- bands.paf = [8 12];
- metric_names = {'alpha_power', 'beta_power', 'theta_power', ...
- 'highbeta_power', 'band1015_power', 'paf_fixed'};
- metric_labels = containers.Map( ...
- {'alpha_power','beta_power','theta_power','highbeta_power','band1015_power','paf_fixed'}, ...
- {'Alpha power 8-12 Hz', ...
- 'Beta power 13-30 Hz', ...
- 'Theta power 4-7 Hz', ...
- 'High beta power 20-30 Hz', ...
- '10-15 Hz reward-band power', ...
- 'Fixed-window PAF 8-12 Hz'} );
- % Edit this mapping so it matches the participant folders in root_dir.
- % Extra rows are ignored. Participants without a listed cohort are labelled
- % as "unassigned" in the cohort outputs.
- cohort_map = table( ...
- ["1"; "2"; "3"; "4"; "BBADE"; "CCSYD"; "EJSYD"; "MDMEL"], ...
- ["neuropathic_eye_pain"; "neuropathic_eye_pain"; "neuropathic_eye_pain"; "neuropathic_eye_pain"; ...
- "chronic_low_back_pain"; "chronic_low_back_pain"; "chronic_low_back_pain"; "chronic_low_back_pain"], ...
- 'VariableNames', {'participant_id','cohort'} );
- %% ------------------------------------------------------------------------
- % Discover participant folders
- %% ------------------------------------------------------------------------
- participant_dirs = dir(root_dir);
- participant_dirs = participant_dirs([participant_dirs.isdir]);
- folder_names = string({participant_dirs.name});
- participant_ids_to_include = string(cohort_map.participant_id);
- keep = ismember(folder_names, participant_ids_to_include);
- participant_dirs = participant_dirs(keep);
- if isempty(participant_dirs)
- error('No participant folders matching cohort_map were found in %s', root_dir);
- end
- fprintf('\nParticipant folders retained:\n');
- disp(string({participant_dirs.name})');
- %% ------------------------------------------------------------------------
- % Extract spectral features from saved preprocessed recordings
- %% ------------------------------------------------------------------------
- rows = repmat(make_empty_output_row(), 0, 1);
- row_count = 0;
- for p = 1:numel(participant_dirs)
- participant_id = string(participant_dirs(p).name);
- participant_path = fullfile(participant_dirs(p).folder, participant_dirs(p).name);
- session_dirs = dir(participant_path);
- session_dirs = session_dirs([session_dirs.isdir]);
- session_names = string({session_dirs.name});
- keep_sessions = ~startsWith(session_names, ".");
- session_dirs = session_dirs(keep_sessions);
- fprintf('\nParticipant %s\n', participant_id);
- for s = 1:numel(session_dirs)
- session_id = string(session_dirs(s).name);
- session_path = fullfile(session_dirs(s).folder, session_dirs(s).name);
- rec_files = dir(fullfile(session_path, '*_eeg_preprocessed.mat'));
- rec_files = sort_files_by_name(rec_files);
- if isempty(rec_files)
- fprintf(' %s: no saved preprocessed recordings found\n', session_id);
- continue
- end
- fprintf(' Session %s\n', session_id);
- for r = 1:numel(rec_files)
- recording_name = string(rec_files(r).name);
- mat_path = fullfile(rec_files(r).folder, rec_files(r).name);
- fprintf(' Recording %d: %s\n', r, recording_name);
- S = load(mat_path, 'EEG');
- if ~isfield(S, 'EEG') || isempty(S.EEG)
- fprintf(' Missing EEG structure. Skipping.\n');
- continue
- end
- EEG = S.EEG;
- try
- data_ft = eeglab2fieldtrip(EEG, 'preprocessing');
- data_ft.label = {EEG.chanlocs.labels};
- catch ME
- fprintf(' Could not convert to FieldTrip format: %s\n', ME.message);
- continue
- end
- % Non-overlapping analyses, 1 to 5 s.
- for w = 1:numel(nonoverlap_windows_sec)
- window_sec = nonoverlap_windows_sec(w);
- overlap_prop = 0;
- analysis_id = "nonoverlap";
- allow_paf = window_sec >= 2;
- feature_row = analyse_one_window( ...
- data_ft, window_sec, overlap_prop, artifact_threshold_uv, bands, allow_paf);
- if ~feature_row.success
- fprintf(' %s %ds failed: %s\n', analysis_id, window_sec, feature_row.message);
- continue
- end
- row_count = row_count + 1;
- rows(row_count) = make_output_row( ...
- participant_id, session_id, s, r, recording_name, ...
- analysis_id, window_sec, overlap_prop, feature_row);
- end
- % Additional 2-s 80%-overlap analysis.
- window_sec = overlap_window_sec;
- overlap_prop = overlap_fraction;
- analysis_id = "overlap_2s_80pct";
- allow_paf = true;
- feature_row = analyse_one_window( ...
- data_ft, window_sec, overlap_prop, artifact_threshold_uv, bands, allow_paf);
- if feature_row.success
- row_count = row_count + 1;
- rows(row_count) = make_output_row( ...
- participant_id, session_id, s, r, recording_name, ...
- analysis_id, window_sec, overlap_prop, feature_row);
- else
- fprintf(' %s failed: %s\n', analysis_id, feature_row.message);
- end
- end
- end
- end
- if isempty(rows)
- error('No clinical feature rows were created.');
- end
- LongTableClinical = struct2table(rows);
- LongTableClinical = add_cohort_labels(LongTableClinical, cohort_map);
- writetable(LongTableClinical, fullfile(out_dir, 'clinical_long_features.csv'));
- save(fullfile(out_dir, 'clinical_long_features.mat'), ...
- 'LongTableClinical', 'bands', 'nonoverlap_windows_sec', ...
- 'overlap_window_sec', 'overlap_fraction', 'artifact_threshold_uv');
- %% ------------------------------------------------------------------------
- % Descriptive pooled ICC summaries
- %% ------------------------------------------------------------------------
- PooledICCs = compute_pooled_icc_table(LongTableClinical, metric_names, metric_labels);
- disp(' ');
- disp('Pooled descriptive ICCs');
- disp(PooledICCs);
- writetable(PooledICCs, fullfile(out_dir, 'clinical_pooled_iccs.csv'));
- save(fullfile(out_dir, 'clinical_pooled_iccs.mat'), 'PooledICCs');
- PooledICCs_5s = PooledICCs( ...
- PooledICCs.analysis_id == "nonoverlap" & PooledICCs.window_sec == 5, :);
- PooledICCs_2sOverlap = PooledICCs( ...
- PooledICCs.analysis_id == "overlap_2s_80pct", :);
- writetable(PooledICCs_5s, fullfile(out_dir, 'clinical_pooled_iccs_5s_nonoverlap.csv'));
- writetable(PooledICCs_2sOverlap, fullfile(out_dir, 'clinical_pooled_iccs_2s_80pct_overlap.csv'));
- %% ------------------------------------------------------------------------
- % Participant-level and cohort-level summaries for the standard 5-s analysis
- %% ------------------------------------------------------------------------
- T5 = LongTableClinical( ...
- LongTableClinical.analysis_id == "nonoverlap" & ...
- LongTableClinical.window_sec == 5, :);
- ParticipantICCs_5s = compute_participant_icc_table(T5, metric_names, metric_labels);
- CohortICCs_5s = compute_cohort_icc_table(T5, metric_names, metric_labels);
- disp(' ');
- disp('Participant-level ICCs, 5-s non-overlapping analysis');
- disp(ParticipantICCs_5s);
- disp(' ');
- disp('Cohort-stratified ICCs, 5-s non-overlapping analysis');
- disp(CohortICCs_5s);
- writetable(ParticipantICCs_5s, fullfile(out_dir, 'clinical_participant_iccs_5s_nonoverlap.csv'));
- writetable(CohortICCs_5s, fullfile(out_dir, 'clinical_cohort_iccs_5s_nonoverlap.csv'));
- save(fullfile(out_dir, 'clinical_5s_icc_tables.mat'), ...
- 'ParticipantICCs_5s', 'CohortICCs_5s', 'PooledICCs_5s');
- %% ------------------------------------------------------------------------
- % Participant-level and cohort-level summaries for 2-s overlapping analysis
- %% ------------------------------------------------------------------------
- T2overlap = LongTableClinical(LongTableClinical.analysis_id == "overlap_2s_80pct", :);
- ParticipantICCs_2sOverlap = compute_participant_icc_table(T2overlap, metric_names, metric_labels);
- CohortICCs_2sOverlap = compute_cohort_icc_table(T2overlap, metric_names, metric_labels);
- writetable(ParticipantICCs_2sOverlap, fullfile(out_dir, 'clinical_participant_iccs_2s_80pct_overlap.csv'));
- writetable(CohortICCs_2sOverlap, fullfile(out_dir, 'clinical_cohort_iccs_2s_80pct_overlap.csv'));
- save(fullfile(out_dir, 'clinical_2s_80pct_overlap_icc_tables.mat'), ...
- 'ParticipantICCs_2sOverlap', 'CohortICCs_2sOverlap', 'PooledICCs_2sOverlap');
- fprintf('\nAnalysis complete. Outputs saved to:\n%s\n', out_dir);
- %% =========================================================================
- % Local functions
- %% =========================================================================
- function out = analyse_one_window(data_ft, window_sec, overlap_prop, artifact_threshold_uv, bands, allow_paf)
- out = empty_feature_row();
- out.window_sec = window_sec;
- out.overlap_prop = overlap_prop;
- out.update_interval_sec = window_sec * (1 - overlap_prop);
- out.nominal_freq_resolution_hz = 1 / window_sec;
- try
- cfg = [];
- cfg.length = window_sec;
- cfg.overlap = overlap_prop;
- data_epo = ft_redefinetrial(cfg, data_ft);
- catch ME
- out.message = "trial definition failed: " + string(ME.message);
- return
- end
- try
- cfg = [];
- cfg.artfctdef.threshold.channel = 'all';
- cfg.artfctdef.threshold.min = -artifact_threshold_uv;
- cfg.artfctdef.threshold.max = artifact_threshold_uv;
- cfg.continuous = 'no';
- [cfg, artifact] = ft_artifact_threshold(cfg, data_epo);
- cfg.artfctdef.reject = 'complete';
- cfg.artfctdef.threshold.artifact = artifact;
- data_clean = ft_rejectartifact(cfg, data_epo);
- catch ME
- out.message = "artifact rejection failed: " + string(ME.message);
- return
- end
- if ~isfield(data_clean, 'trial') || isempty(data_clean.trial)
- out.message = "no surviving trials";
- return
- end
- foi = make_foi(window_sec, 2, 45);
- try
- cfg = [];
- cfg.method = 'mtmfft';
- cfg.taper = 'hanning';
- cfg.foi = foi;
- cfg.keeptrials = 'yes';
- cfg.pad = window_sec;
- freq_data = ft_freqanalysis(cfg, data_clean);
- catch ME
- out.message = "spectral analysis failed: " + string(ME.message);
- return
- end
- freqs = freq_data.freq(:)';
- pow_allch = freq_data.powspctrm;
- % Use the PainWaive central channels for all clinical features. If C1/C2
- % labels are unavailable, fall back to all available EEG channels and record
- % this in the output table.
- labels = string(freq_data.label);
- c12_idx = find(ismember(upper(labels), ["C1", "C2"]));
- if numel(c12_idx) == 2
- pow_selected = pow_allch(:, c12_idx, :);
- out.channels_used = "C1;C2";
- else
- pow_selected = pow_allch;
- out.channels_used = strjoin(labels, ";");
- end
- mean_power_trials = squeeze(mean(pow_selected, 2, 'omitnan'));
- if isvector(mean_power_trials)
- mean_power_trials = mean_power_trials(:)';
- end
- mean_power = squeeze(mean(mean_power_trials, 1, 'omitnan'));
- mean_power = mean_power(:)';
- if numel(mean_power) > 1 && any(isfinite(mean_power))
- mean_power_z = zscore(mean_power);
- else
- mean_power_z = NaN(size(mean_power));
- end
- out.alpha_power = band_sum(mean_power_z, freqs, bands.alpha);
- out.beta_power = band_sum(mean_power_z, freqs, bands.beta);
- out.theta_power = band_sum(mean_power_z, freqs, bands.theta);
- out.highbeta_power = band_sum(mean_power_z, freqs, bands.highbeta);
- out.band1015_power = band_sum(mean_power_z, freqs, bands.band1015);
- if allow_paf
- out.paf_fixed = compute_paf_cog(mean_power, freqs, bands.paf);
- else
- out.paf_fixed = NaN;
- end
- out.n_epochs_kept = numel(data_clean.trial);
- out.n_freq_bins = numel(freqs);
- out.n_paf_bins = sum(freqs >= bands.paf(1) & freqs <= bands.paf(2));
- out.success = true;
- out.message = "ok";
- end
- function out = empty_feature_row()
- out = struct();
- out.success = false;
- out.message = "";
- out.window_sec = NaN;
- out.overlap_prop = NaN;
- out.update_interval_sec = NaN;
- out.nominal_freq_resolution_hz = NaN;
- out.n_epochs_kept = NaN;
- out.n_freq_bins = NaN;
- out.n_paf_bins = NaN;
- out.channels_used = "";
- out.alpha_power = NaN;
- out.beta_power = NaN;
- out.theta_power = NaN;
- out.highbeta_power = NaN;
- out.band1015_power = NaN;
- out.paf_fixed = NaN;
- end
- function row = make_output_row(participant_id, session_id, session_index, recording_index, recording_name, ...
- analysis_id, window_sec, overlap_prop, feature_row)
- row = struct();
- row.participant_id = string(participant_id);
- row.group_id = string(participant_id);
- row.session_id = string(session_id);
- row.session_index = session_index;
- row.recording_index = recording_index;
- row.recording_name = string(recording_name);
- row.analysis_id = string(analysis_id);
- row.window_sec = window_sec;
- row.overlap_prop = overlap_prop;
- row.update_interval_sec = feature_row.update_interval_sec;
- row.nominal_freq_resolution_hz = feature_row.nominal_freq_resolution_hz;
- row.n_epochs_kept = feature_row.n_epochs_kept;
- row.n_freq_bins = feature_row.n_freq_bins;
- row.n_paf_bins = feature_row.n_paf_bins;
- row.channels_used = feature_row.channels_used;
- row.alpha_power = feature_row.alpha_power;
- row.beta_power = feature_row.beta_power;
- row.theta_power = feature_row.theta_power;
- row.highbeta_power = feature_row.highbeta_power;
- row.band1015_power = feature_row.band1015_power;
- row.paf_fixed = feature_row.paf_fixed;
- end
- function row = make_empty_output_row()
- row = struct();
- row.participant_id = "";
- row.group_id = "";
- row.session_id = "";
- row.session_index = NaN;
- row.recording_index = NaN;
- row.recording_name = "";
- row.analysis_id = "";
- row.window_sec = NaN;
- row.overlap_prop = NaN;
- row.update_interval_sec = NaN;
- row.nominal_freq_resolution_hz = NaN;
- row.n_epochs_kept = NaN;
- row.n_freq_bins = NaN;
- row.n_paf_bins = NaN;
- row.channels_used = "";
- row.alpha_power = NaN;
- row.beta_power = NaN;
- row.theta_power = NaN;
- row.highbeta_power = NaN;
- row.band1015_power = NaN;
- row.paf_fixed = NaN;
- end
- function foi = make_foi(window_sec, min_freq, max_freq)
- df = 1 / window_sec;
- foi = min_freq:df:max_freq;
- foi = round(foi * 1e10) / 1e10;
- end
- function val = band_sum(power_vec, freqs, band)
- idx = freqs >= band(1) & freqs <= band(2);
- if ~any(idx) || all(~isfinite(power_vec(idx)))
- val = NaN;
- else
- val = sum(power_vec(idx), 'omitnan');
- end
- end
- function paf = compute_paf_cog(power_vec, freqs, band)
- idx = freqs >= band(1) & freqs <= band(2);
- f = freqs(idx);
- p = power_vec(idx);
- if isempty(p) || all(~isfinite(p)) || sum(p, 'omitnan') <= 0
- paf = NaN;
- else
- paf = sum(f .* p, 'omitnan') ./ sum(p, 'omitnan');
- end
- end
- function T = add_cohort_labels(T, cohort_map)
- T.participant_id = string(T.participant_id);
- cohort_map.participant_id = string(cohort_map.participant_id);
- cohort_map.cohort = string(cohort_map.cohort);
- T.cohort = repmat("unassigned", height(T), 1);
- for i = 1:height(cohort_map)
- idx = T.participant_id == cohort_map.participant_id(i);
- T.cohort(idx) = cohort_map.cohort(i);
- end
- unassigned_ids = unique(T.participant_id(T.cohort == "unassigned"));
- if ~isempty(unassigned_ids)
- fprintf('\nParticipants without cohort labels:\n');
- disp(unassigned_ids);
- end
- end
- function ICCSummary = compute_pooled_icc_table(T, metric_names, metric_labels)
- rows = struct([]);
- rr = 0;
- analysis_ids = unique(T.analysis_id, 'stable');
- for a = 1:numel(analysis_ids)
- analysis_id = analysis_ids(a);
- Ta = T(T.analysis_id == analysis_id, :);
- window_vals = unique(Ta.window_sec, 'stable');
- for w = 1:numel(window_vals)
- window_sec = window_vals(w);
- Tw = Ta(Ta.window_sec == window_sec, :);
- overlap_prop = unique(Tw.overlap_prop);
- if isempty(overlap_prop)
- overlap_prop = NaN;
- else
- overlap_prop = overlap_prop(1);
- end
- for m = 1:numel(metric_names)
- metric_name = metric_names{m};
- if strcmp(metric_name, 'paf_fixed') && window_sec < 2
- continue
- end
- X = build_stack_matrix(Tw, metric_name);
- [icc31, icc3k, n_sessions, n_recordings] = compute_icc31_icc3k(X);
- rr = rr + 1;
- rows(rr).analysis_id = analysis_id;
- rows(rr).window_sec = window_sec;
- rows(rr).overlap_prop = overlap_prop;
- rows(rr).update_interval_sec = window_sec * (1 - overlap_prop);
- rows(rr).nominal_freq_resolution_hz = 1 / window_sec;
- rows(rr).metric = string(metric_name);
- rows(rr).metric_label = string(metric_labels(metric_name));
- rows(rr).n_participants = numel(unique(Tw.participant_id));
- rows(rr).n_sessions = n_sessions;
- rows(rr).n_recordings = n_recordings;
- rows(rr).icc31 = icc31;
- rows(rr).icc3k = icc3k;
- end
- end
- end
- ICCSummary = struct2table(rows);
- end
- function ParticipantICCs = compute_participant_icc_table(T, metric_names, metric_labels)
- rows = struct([]);
- rr = 0;
- participant_ids = unique(T.participant_id, 'stable');
- for p = 1:numel(participant_ids)
- participant_id = participant_ids(p);
- Tp = T(T.participant_id == participant_id, :);
- cohort_vals = unique(Tp.cohort);
- if isempty(cohort_vals)
- cohort = "unassigned";
- else
- cohort = cohort_vals(1);
- end
- for m = 1:numel(metric_names)
- metric_name = metric_names{m};
- if strcmp(metric_name, 'paf_fixed') && all(isnan(Tp.(metric_name)))
- continue
- end
- X = build_matrix_one_participant(Tp, metric_name);
- [icc31, icc3k, n_sessions, n_recordings] = compute_icc31_icc3k(X);
- rr = rr + 1;
- rows(rr).participant_id = participant_id;
- rows(rr).cohort = cohort;
- rows(rr).analysis_id = unique_scalar_string(Tp.analysis_id);
- rows(rr).window_sec = unique_scalar_numeric(Tp.window_sec);
- rows(rr).overlap_prop = unique_scalar_numeric(Tp.overlap_prop);
- rows(rr).metric = string(metric_name);
- rows(rr).metric_label = string(metric_labels(metric_name));
- rows(rr).n_sessions = n_sessions;
- rows(rr).n_recordings = n_recordings;
- rows(rr).icc31 = icc31;
- rows(rr).icc3k = icc3k;
- end
- end
- if isempty(rows)
- ParticipantICCs = table();
- else
- ParticipantICCs = struct2table(rows);
- end
- end
- function CohortICCs = compute_cohort_icc_table(T, metric_names, metric_labels)
- rows = struct([]);
- rr = 0;
- cohort_vals = unique(T.cohort, 'stable');
- for c = 1:numel(cohort_vals)
- cohort = cohort_vals(c);
- Tc = T(T.cohort == cohort, :);
- for m = 1:numel(metric_names)
- metric_name = metric_names{m};
- if strcmp(metric_name, 'paf_fixed') && all(isnan(Tc.(metric_name)))
- continue
- end
- X = build_stack_matrix(Tc, metric_name);
- [icc31, icc3k, n_sessions, n_recordings] = compute_icc31_icc3k(X);
- rr = rr + 1;
- rows(rr).cohort = cohort;
- rows(rr).analysis_id = unique_scalar_string(Tc.analysis_id);
- rows(rr).window_sec = unique_scalar_numeric(Tc.window_sec);
- rows(rr).overlap_prop = unique_scalar_numeric(Tc.overlap_prop);
- rows(rr).metric = string(metric_name);
- rows(rr).metric_label = string(metric_labels(metric_name));
- rows(rr).n_participants = numel(unique(Tc.participant_id));
- rows(rr).n_sessions = n_sessions;
- rows(rr).n_recordings = n_recordings;
- rows(rr).icc31 = icc31;
- rows(rr).icc3k = icc3k;
- end
- end
- if isempty(rows)
- CohortICCs = table();
- else
- CohortICCs = struct2table(rows);
- end
- end
- function X = build_matrix_one_participant(T, metric_name)
- if isempty(T)
- X = [];
- return
- end
- n_sessions = max(T.session_index);
- n_recordings = max(T.recording_index);
- if isempty(n_sessions) || isnan(n_sessions) || isempty(n_recordings) || isnan(n_recordings)
- X = [];
- return
- end
- X = nan(n_sessions, n_recordings);
- for i = 1:height(T)
- s = T.session_index(i);
- r = T.recording_index(i);
- if s >= 1 && r >= 1
- X(s, r) = T.(metric_name)(i);
- end
- end
- X = clean_icc_matrix(X);
- end
- function Xstack = build_stack_matrix(T, metric_name)
- participant_ids = unique(T.participant_id, 'stable');
- Xstack = [];
- for p = 1:numel(participant_ids)
- participant_id = participant_ids(p);
- Tp = T(T.participant_id == participant_id, :);
- Xp = build_matrix_one_participant(Tp, metric_name);
- Xstack = [Xstack; Xp]; %#ok<AGROW>
- end
- Xstack = clean_icc_matrix(Xstack);
- end
- function X = clean_icc_matrix(X)
- if isempty(X)
- return
- end
- X = X(:, ~all(isnan(X), 1));
- X = X(~any(isnan(X), 2), :);
- end
- function [icc31, icc3k, n, k] = compute_icc31_icc3k(X)
- n = size(X, 1);
- k = size(X, 2);
- if n < 2 || k < 2
- icc31 = NaN;
- icc3k = NaN;
- return
- end
- grand_mean = mean(X(:), 'omitnan');
- mean_per_session = mean(X, 2, 'omitnan');
- mean_per_record = mean(X, 1, 'omitnan');
- SS_session = k * sum((mean_per_session - grand_mean).^2, 'omitnan');
- SS_record = n * sum((mean_per_record - grand_mean).^2, 'omitnan');
- SS_total = sum(sum((X - grand_mean).^2, 'omitnan'), 'omitnan');
- SS_error = SS_total - SS_session - SS_record;
- MS_session = SS_session / (n - 1);
- MS_error = SS_error / ((n - 1) * (k - 1));
- if ~isfinite(MS_session) || ~isfinite(MS_error) || MS_session == 0
- icc31 = NaN;
- icc3k = NaN;
- return
- end
- icc31 = (MS_session - MS_error) / (MS_session + (k - 1) * MS_error);
- icc3k = (MS_session - MS_error) / MS_session;
- end
- function value = unique_scalar_string(x)
- u = unique(string(x), 'stable');
- if isempty(u)
- value = "";
- else
- value = u(1);
- end
- end
- function value = unique_scalar_numeric(x)
- u = unique(x, 'stable');
- if isempty(u)
- value = NaN;
- else
- value = u(1);
- end
- end
- function files_out = sort_files_by_name(files_in)
- files_out = files_in;
- if isempty(files_in)
- return
- end
- names = string({files_in.name});
- [~, idx] = sort(names);
- files_out = files_in(idx);
- end
clinical_data_analysis_final.m at commit ffcc1bd, no license · at the source
Overview
- Centre for Pain IMPACT, Neuroscience Research Australia, Sydney, NSW Australia
- NeuroRecovery Research Hub, School of Psychology, University of New South Wales, Sydney, NSW Australia
- School of Computer Science, Faculty of Engineering and Information Technology, University of Technology Sydney, Sydney, NSW Australia
- Faculty of Health, University of Technology Sydney, Sydney, NSW Australia
- John Walsh Centre for Rehabilitation Research, The Kolling Institute, Faculty of Medicine and Health, University of Sydney, Sydney, NSW Australia
- Department of Rehabilitation Medicine, University of Washington, Seattle, WA USA
- School of Health Science, University of New South Wales, Sydney, NSW Australia
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 6 matches between paragraphs and lines of code.
DrNahianC/PainWaive-Evaluation-Paper
ffcc1bd0ee8bcaf5cae9449bf9a74a5036e70c55, 24 June 2026Availability: 1 check, the latest on 9 November 2026: the link answers
- 9 November 2026: the link answers
2 files
- clinical_data_analysis_f
inal.m , MATLAB, 808 lines, 4 matches - experimental_data_analys
is_final.m , MATLAB, 667 lines, 2 matches
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:
- it points to the authors' code: DrNahianC/
PainWaive-Evaluation-Pap er - it says that the code is available on request
Read it in the paper: doi.org/10.1038/s41746-026-03424-5.
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;
- 2 scripts, each with its path and the digest of its content;
- 6 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
No dataset and no data link were found in the paper.
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:
- it says that the data are available on request
Read it in the paper: doi.org/10.1038/s41746-026-03424-5.
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, 9 November 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 16 authors, 5 keywords, 2 funders, 69 references.
Cite
This paper
Chowdhury, N. S., Rawsthorne, J., Hesam-Shariati, N., Quidé, Y., Alexander, L., Ermolenko, E., McIntyre, A., Restrepo, S., Chen, K., Lin, C.-T., Newton-John, T., Middleton, J. W., Craig, A., Jensen, M. P., McAuley, J. H., & Gustin, S. M. (2026). Evaluation of PainWaive: a consumer-grade EEG headset for remote EEG monitoring and neurofeedback research in chronic pain. NPJ digital medicine, 9(1), 864. https://
BibTeX
@article{chowdhury2026ev
author = {Chowdhury, Nahian S and Rawsthorne, Joshua and Hesam-Shariati, Negin and Quidé, Yann and Alexander, Lara and Ermolenko, Ekaterina and McIntyre, Angus and Restrepo, Sebastian and Chen, Kevin and Lin, Chin-Teng and Newton-John, Toby and Middleton, James W and Craig, Ashley and Jensen, Mark P and McAuley, James H and Gustin, Sylvia M},
title = {{Evaluation of PainWaive: a consumer-grade EEG headset for remote EEG monitoring and neurofeedback research in chronic pain}},
journal = {NPJ digital medicine},
year = {2026},
month = nov,
volume = {9},
number = {1},
pages = {864},
publisher = {Nature Publishing Group},
issn = {2398-6352},
doi = {10.1038/
url = {https://
pmid = {42995173},
pmcid = {PMC13743753}
}
RIS
TY - JOUR
AU - Chowdhury, Nahian S
AU - Rawsthorne, Joshua
AU - Hesam-Shariati, Negin
AU - Quidé, Yann
AU - Alexander, Lara
AU - Ermolenko, Ekaterina
AU - McIntyre, Angus
AU - Restrepo, Sebastian
AU - Chen, Kevin
AU - Lin, Chin-Teng
AU - Newton-John, Toby
AU - Middleton, James W
AU - Craig, Ashley
AU - Jensen, Mark P
AU - McAuley, James H
AU - Gustin, Sylvia M
TI - Evaluation of PainWaive: a consumer-grade EEG headset for remote EEG monitoring and neurofeedback research in chronic pain
T2 - NPJ digital medicine
J2 - NPJ Digit Med
PY - 2026
DA - 2026/
VL - 9
IS - 1
SP - 864
SN - 2398-6352
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Evaluation of PainWaive: a consumer-grade EEG headset for remote EEG monitoring and neurofeedback research in chronic pain",
"container-title": "NPJ digital medicine",
"author": [
{
"family": "Chowdhury",
"given": "Nahian S"
},
{
"family": "Rawsthorne",
"given": "Joshua"
},
{
"family": "Hesam-Shariati",
"given": "Negin"
},
{
"family": "Quidé",
"given": "Yann"
},
{
"family": "Alexander",
"given": "Lara"
},
{
"family": "Ermolenko",
"given": "Ekaterina"
},
{
"family": "McIntyre",
"given": "Angus"
},
{
"family": "Restrepo",
"given": "Sebastian"
},
{
"family": "Chen",
"given": "Kevin"
},
{
"family": "Lin",
"given": "Chin-Teng"
},
{
"family": "Newton-John",
"given": "Toby"
},
{
"family": "Middleton",
"given": "James W"
},
{
"family": "Craig",
"given": "Ashley"
},
{
"family": "Jensen",
"given": "Mark P"
},
{
"family": "McAuley",
"given": "James H"
},
{
"family": "Gustin",
"given": "Sylvia M"
}
],
"container-title-short":
"volume": "9",
"issue": "1",
"page": "864",
"DOI": "10.1038/
"PMID": "42995173",
"PMCID": "PMC13743753",
"ISSN": "2398-6352",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
11,
6
]
]
}
}
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.1016/j.ebiom.2025.105955 [code]
- Exploring electroencephalographic chronic pain biomarkers: a mega-analysis.Journal: EBioMedicineIn common: EEGLAB, FieldTrip, Statistics and Machine Learning Toolbox, pain, EEG, 1 reference, author Mark P Jensen
- [2] doi:10.1016/j.neuroimage.2023.120116 [code]
- Stability, change, and reliable individual differences in electroencephalography measures: A lifespan perspective on progress and opportunities.Journal: NeuroImageIn common: EEG, 6 references
- [3] doi:10.7717/peerj.20416 [code]
- Evaluating portable EEG: a comparison between two wireless systems (EPOC Flex and LiveAmp) and the wired BrainAmp system.Journal: PeerJIn common: EEG, 6 references
- [4] doi:10.1097/j.pain.0000000000003571 [code]
- Assessing the predictive value of peak alpha frequency for the sensitivity to pain.Journal: PainIn common: EEGLAB, FieldTrip, Statistics and Machine Learning Toolbox, pain, EEG, 3 references
- [5] doi:10.1186/s12859-024-05865-9 [code]
- HEROIC: a platform for remote collection of electroencephalographic data using consumer-grade brain wearables.Journal: BMC bioinformaticsIn common: EEG, 5 references
- [6] doi:10.1038/s41598-026-52672-8 [code]
- Validation of portable, semi-dry electrode-based electroencephalography device for its application in brain-computer interface solutions.Journal: Scientific reportsIn common: EEG, 5 references
- [7] doi:10.1007/s10548-026-01210-w [code]
- Resting-State Theta and Alpha Oscillations in Amputation and Phantom Limb Pain: A Pre-Registered High-Density EEG Study.Journal: Brain topographyIn common: EEGLAB, FieldTrip, Statistics and Machine Learning Toolbox, pain, EEG, 2 references
- [8] doi:10.1371/journal.pone.0279881 [code]
- Stimulus-induced narrow-band gamma oscillations in humans can be recorded using open-hardware low-cost EEG amplifier.Journal: PloS oneIn common: EEGLAB, Statistics and Machine Learning Toolbox, EEG, 3 references
- [9] doi:10.1371/journal.pone.0291186
- A scoping review on the use of consumer-grade EEG devices for research.Journal: PloS oneIn common: EEG, 4 references
- [10] doi:10.1002/brb3.70448
- The Feasibility and Test-Retest Reliability of Wireless Dry-Electrode EEG During a Dynamic Psychomotor Virtual Reality Task.Journal: Brain and behaviorIn common: EEG, 4 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.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 2 scripts, and 6 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:ce0e62aa0561bf00…
Add the badge to the code's README
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 -->
[](https://openscicode.org/badge/doi/10.1038/s41746-026-03424-5)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.1038/s41746-026-03424-5.svg
:target: https://openscicode.org/badge/doi/10.1038/s41746-026-03424-5
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41746-026-03424-5"><img src="https://openscicode.org/badge/doi/10.1038/s41746-026-03424-5.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.
