Skip to content

Commit 9ac9ea0

Browse files
authored
Merge pull request #29 from VisLab/check-issues
Resolved parfor issue and updateNoisyChannels issue
2 parents 3ed337e + d3a050f commit 9ac9ea0

12 files changed

Lines changed: 1319 additions & 1298 deletions
Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1-
% eegplugin_prepPipeline() - a wrapper to the prepPipeline, which does early stage
2-
%
3-
% Usage:
4-
% >> eegplugin_prepPipeline(fig, try_strings, catch_strings);
5-
%
6-
% see also: prepPipeline
7-
8-
% Author: Kay Robbins, with contributions from Nima Bigdely-Shamlo, Tim Mullen, Christian Kothe, and Cassidy Matousek.
9-
10-
% This program is free software; you can redistribute it and/or modify
11-
% it under the terms of the GNU General Public License as published by
12-
% the Free Software Foundation; either version 2 of the License, or
13-
% (at your option) any later version.
14-
%
15-
% This program is distributed in the hope that it will be useful,
16-
% but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18-
% GNU General Public License for more details.
19-
%
20-
% You should have received a copy of the GNU General Public License
21-
% along with this program; if not, write to the Free Software
22-
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23-
24-
%function eegplugin_clean_rawdata(fig,try_strings,catch_strings)
25-
26-
% create menu
27-
% toolsmenu = findobj(fig, 'tag', 'tools');
28-
% uimenu( toolsmenu, 'label', 'Clean continuous data using ASR', 'separator','on',...
29-
% 'callback', 'EEG = pop_clean_rawdata(EEG); [ALLEEG EEG CURRENTSET] = eeg_store(ALLEEG, EEG); eeglab redraw');
30-
31-
% eegplugin_prepPipeline() - the PREP pipeline plugin
32-
function vers = eegplugin_prepPipeline(fig, trystrs, catchstrs)
33-
34-
%% Add path to prepPipeline subdirectories if not in the list
35-
tmp = which('getPrepDefaults');
36-
if isempty(tmp)
37-
myPath = fileparts(which('prepPipeline'));
38-
addpath(genpath(myPath));
39-
end;
40-
vers = getPrepVersion();
41-
42-
% create menu
43-
comprep = [trystrs.no_check '[EEG LASTCOM] = pop_prepPipeline(EEG);' catchstrs.new_and_hist];
44-
menu = findobj(fig, 'tag', 'tools');
45-
uimenu( menu, 'Label', 'Run PREP pipeline', 'callback', comprep, ...
46-
'separator', 'on');
47-
1+
% eegplugin_prepPipeline() - a wrapper to the prepPipeline, which does early stage
2+
%
3+
% Usage:
4+
% >> eegplugin_prepPipeline(fig, try_strings, catch_strings);
5+
%
6+
% see also: prepPipeline
7+
8+
% Author: Kay Robbins, with contributions from Nima Bigdely-Shamlo, Tim Mullen, Christian Kothe, and Cassidy Matousek.
9+
10+
% This program is free software; you can redistribute it and/or modify
11+
% it under the terms of the GNU General Public License as published by
12+
% the Free Software Foundation; either version 2 of the License, or
13+
% (at your option) any later version.
14+
%
15+
% This program is distributed in the hope that it will be useful,
16+
% but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
% GNU General Public License for more details.
19+
%
20+
% You should have received a copy of the GNU General Public License
21+
% along with this program; if not, write to the Free Software
22+
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23+
24+
%function eegplugin_clean_rawdata(fig,try_strings,catch_strings)
25+
26+
% create menu
27+
% toolsmenu = findobj(fig, 'tag', 'tools');
28+
% uimenu( toolsmenu, 'label', 'Clean continuous data using ASR', 'separator','on',...
29+
% 'callback', 'EEG = pop_clean_rawdata(EEG); [ALLEEG EEG CURRENTSET] = eeg_store(ALLEEG, EEG); eeglab redraw');
30+
31+
% eegplugin_prepPipeline() - the PREP pipeline plugin
32+
function vers = eegplugin_prepPipeline(fig, trystrs, catchstrs)
33+
34+
%% Add path to prepPipeline subdirectories if not in the list
35+
tmp = which('getPrepDefaults');
36+
if isempty(tmp)
37+
myPath = fileparts(which('prepPipeline'));
38+
addpath(genpath(myPath));
39+
end
40+
vers = getPrepVersion();
41+
42+
% create menu
43+
comprep = [trystrs.no_check '[EEG LASTCOM] = pop_prepPipeline(EEG);' catchstrs.new_and_hist];
44+
menu = findobj(fig, 'tag', 'tools');
45+
uimenu( menu, 'Label', 'Run PREP pipeline', 'callback', comprep, ...
46+
'separator', 'on');
47+
Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,50 @@
1-
%% Example: Running the pipeline on a directory of EEG files
2-
3-
%% Set up the input and the output directories
4-
basename = 'vep';
5-
indir = 'F:\DataPool\CTADATA\VEP\BiosemiOriginalSetCorrected';
6-
outdir = 'D:\TempCTA';
7-
8-
%% Make the output directory if needed
9-
if ~exist(outdir, 'dir')
10-
mkdir(outdir)
11-
end
12-
13-
%% Set up the params structure
14-
params = struct();
15-
params.lineFrequencies = [60, 120, 180, 212, 240];
16-
params.referenceChannels = 1:64;
17-
params.evaluationChannels = 1:64;
18-
params.rereferencedChannels = 1:70;
19-
params.detrendChannels = 1:70;
20-
params.lineNoiseChannels = 1:70;
21-
22-
params.detrendType = 'high pass';
23-
params.detrendCutoff = 1;
24-
params.referenceType = 'robust';
25-
params.meanEstimateType = 'median';
26-
params.interpolationOrder = 'post-reference';
27-
params.removeInterpolatedChannels = true;
28-
params.keepFiltered = false;
29-
basenameOut = [basename 'robust_1Hz_post_median_unfiltered'];
30-
31-
32-
%% Get the filelist
33-
fileList = getFileList('FILES', indir);
34-
%% Run the pipeline
35-
for k = 1:length(fileList)
36-
[~, thisName, ~] = fileparts(fileList{k});
37-
EEG = pop_loadset(fileList{k});
38-
params.name = thisName;
39-
[EEG, params, computationTimes] = prepPipeline(EEG, params);
40-
fprintf('Computation times (seconds):\n %s\n', ...
41-
getStructureString(computationTimes));
42-
fprintf('Post-process\n')
43-
EEG = prepPostProcess(EEG, params);
44-
fname = [outdir filesep thisName '.set'];
45-
save(fname, 'EEG', '-mat', '-v7.3');
46-
if strcmpi(params.errorMsgs, 'verbose')
47-
outputPrepParams(params, 'Prep parameters (non-defaults)');
48-
outputPrepErrors(EEG.etc.noiseDetection, 'Prep error status');
49-
end
50-
51-
end
1+
%% Example: Running the pipeline on a directory of EEG files
2+
3+
%% Set up the input and the output directories
4+
basename = 'vep';
5+
indir = 'F:\DataPool\CTADATA\VEP\BiosemiOriginalSetCorrected';
6+
outdir = 'F:\TempData';
7+
8+
%% Make the output directory if needed
9+
if ~exist(outdir, 'dir')
10+
mkdir(outdir)
11+
end
12+
13+
%% Set up the params structure
14+
params = struct();
15+
params.lineFrequencies = [60, 120, 180, 212, 240];
16+
params.referenceChannels = 1:64;
17+
params.evaluationChannels = 1:64;
18+
params.rereferencedChannels = 1:70;
19+
params.detrendChannels = 1:70;
20+
params.lineNoiseChannels = 1:70;
21+
22+
params.detrendType = 'high pass';
23+
params.detrendCutoff = 1;
24+
params.referenceType = 'robust';
25+
params.meanEstimateType = 'median';
26+
params.interpolationOrder = 'post-reference';
27+
params.removeInterpolatedChannels = true;
28+
params.keepFiltered = false;
29+
basenameOut = [basename 'robust_1Hz_post_median_unfiltered'];
30+
31+
%% Get the filelist
32+
fileList = getFileList('FILES', indir);
33+
%% Run the pipeline
34+
for k = 1:length(fileList)
35+
[~, thisName, ~] = fileparts(fileList{k});
36+
EEG = pop_loadset(fileList{k});
37+
params.name = thisName;
38+
[EEG, params, computationTimes] = prepPipeline(EEG, params);
39+
fprintf('Computation times (seconds):\n %s\n', ...
40+
getStructureString(computationTimes));
41+
fprintf('Post-process\n')
42+
EEG = prepPostProcess(EEG, params);
43+
fname = [outdir filesep thisName '.set'];
44+
save(fname, 'EEG', '-mat', '-v7.3');
45+
if strcmpi(params.errorMsgs, 'verbose')
46+
outputPrepParams(params, 'Prep parameters (non-defaults)');
47+
outputPrepErrors(EEG.etc.noiseDetection, 'Prep error status');
48+
end
49+
50+
end
Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
1-
%% Read in the file and set the necessary parameters
2-
3-
% dataDir = 'O:\ARL_Data\VEP\VEP_Robust_1Hz';
4-
% summaryFolder = 'O:\ARL_Data\VEP\VEP_Robust_1Hz_New_Report_B';
5-
6-
dataDir = 'D:\TempCTA';
7-
summaryFolder = 'D:\TempCTA';
8-
publishOn = true;
9-
%% Get the directory list
10-
inList = dir(dataDir);
11-
inNames = {inList(:).name};
12-
inTypes = [inList(:).isdir];
13-
inNames = inNames(~inTypes);
14-
15-
%%
16-
basename = 'vep';
17-
summaryReportName = [basename '_summary.html'];
18-
sessionFolder = '.';
19-
summaryFileName = [summaryFolder filesep summaryReportName];
20-
if exist(summaryFileName, 'file')
21-
delete(summaryFileName);
22-
end
23-
24-
%% Run the pipeline
25-
26-
for k = 1:length(inNames)
27-
[~, theName, theExt] = fileparts(inNames{k});
28-
if ~strcmpi(theExt, '.set') && ~strcmpi(theExt, '.mat')
29-
continue;
30-
end
31-
sessionReportName = [theName '.pdf'];
32-
fname = [dataDir filesep inNames{k}];
33-
load(fname, '-mat');
34-
sessionFileName = [summaryFolder filesep sessionReportName];
35-
consoleFID = 1;
36-
publishPrepReport(EEG, summaryFileName, sessionFileName, consoleFID, publishOn);
1+
%% This script takes a directory of files that have been processed by PREP
2+
% and produces reports.
3+
4+
%% Read in the file and set the necessary parameters
5+
dataDir = 'F:\TempData';
6+
summaryFolder = 'F:\TempDataReports';
7+
publishOn = true;
8+
9+
%% Get the directory list
10+
inList = dir(dataDir);
11+
inNames = {inList(:).name};
12+
inTypes = [inList(:).isdir];
13+
inNames = inNames(~inTypes);
14+
15+
%% Setup up the names
16+
basename = 'vep';
17+
summaryReportName = [basename '_summary.html'];
18+
sessionFolder = '.';
19+
summaryFileName = [summaryFolder filesep summaryReportName];
20+
if exist(summaryFileName, 'file')
21+
delete(summaryFileName);
22+
end
23+
24+
%% Publish the reports
25+
for k = 1:length(inNames)
26+
[~, theName, theExt] = fileparts(inNames{k});
27+
if ~strcmpi(theExt, '.set') && ~strcmpi(theExt, '.mat')
28+
continue;
29+
end
30+
sessionReportName = [theName '.pdf'];
31+
fname = [dataDir filesep inNames{k}];
32+
load(fname, '-mat');
33+
sessionFileName = [summaryFolder filesep sessionReportName];
34+
consoleFID = 1;
35+
publishPrepReport(EEG, summaryFileName, sessionFileName, consoleFID, publishOn);
3736
end

0 commit comments

Comments
 (0)