Skip to content

Commit

Permalink
Corrected issue #28
Browse files Browse the repository at this point in the history
  • Loading branch information
VisLab committed Aug 1, 2021
1 parent 678fead commit d3a050f
Show file tree
Hide file tree
Showing 8 changed files with 646 additions and 644 deletions.
Binary file not shown.
94 changes: 47 additions & 47 deletions PrepPipeline/eegplugin_prepPipeline.m
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
% eegplugin_prepPipeline() - a wrapper to the prepPipeline, which does early stage
%
% Usage:
% >> eegplugin_prepPipeline(fig, try_strings, catch_strings);
%
% see also: prepPipeline

% Author: Kay Robbins, with contributions from Nima Bigdely-Shamlo, Tim Mullen, Christian Kothe, and Cassidy Matousek.

% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

%function eegplugin_clean_rawdata(fig,try_strings,catch_strings)

% create menu
% toolsmenu = findobj(fig, 'tag', 'tools');
% uimenu( toolsmenu, 'label', 'Clean continuous data using ASR', 'separator','on',...
% 'callback', 'EEG = pop_clean_rawdata(EEG); [ALLEEG EEG CURRENTSET] = eeg_store(ALLEEG, EEG); eeglab redraw');

% eegplugin_prepPipeline() - the PREP pipeline plugin
function vers = eegplugin_prepPipeline(fig, trystrs, catchstrs)

%% Add path to prepPipeline subdirectories if not in the list
tmp = which('getPrepDefaults');
if isempty(tmp)
myPath = fileparts(which('prepPipeline'));
addpath(genpath(myPath));
end;
vers = getPrepVersion();

% create menu
comprep = [trystrs.no_check '[EEG LASTCOM] = pop_prepPipeline(EEG);' catchstrs.new_and_hist];
menu = findobj(fig, 'tag', 'tools');
uimenu( menu, 'Label', 'Run PREP pipeline', 'callback', comprep, ...
'separator', 'on');

% eegplugin_prepPipeline() - a wrapper to the prepPipeline, which does early stage
%
% Usage:
% >> eegplugin_prepPipeline(fig, try_strings, catch_strings);
%
% see also: prepPipeline

% Author: Kay Robbins, with contributions from Nima Bigdely-Shamlo, Tim Mullen, Christian Kothe, and Cassidy Matousek.

% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

%function eegplugin_clean_rawdata(fig,try_strings,catch_strings)

% create menu
% toolsmenu = findobj(fig, 'tag', 'tools');
% uimenu( toolsmenu, 'label', 'Clean continuous data using ASR', 'separator','on',...
% 'callback', 'EEG = pop_clean_rawdata(EEG); [ALLEEG EEG CURRENTSET] = eeg_store(ALLEEG, EEG); eeglab redraw');

% eegplugin_prepPipeline() - the PREP pipeline plugin
function vers = eegplugin_prepPipeline(fig, trystrs, catchstrs)

%% Add path to prepPipeline subdirectories if not in the list
tmp = which('getPrepDefaults');
if isempty(tmp)
myPath = fileparts(which('prepPipeline'));
addpath(genpath(myPath));
end
vers = getPrepVersion();

% create menu
comprep = [trystrs.no_check '[EEG LASTCOM] = pop_prepPipeline(EEG);' catchstrs.new_and_hist];
menu = findobj(fig, 'tag', 'tools');
uimenu( menu, 'Label', 'Run PREP pipeline', 'callback', comprep, ...
'separator', 'on');

17 changes: 8 additions & 9 deletions PrepPipeline/examples/runVEPPrepPipeline.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,23 @@
params.keepFiltered = false;
basenameOut = [basename 'robust_1Hz_post_median_unfiltered'];


%% Get the filelist
fileList = getFileList('FILES', indir);
%% Run the pipeline
for k = 1%:length(fileList)
for k = 1:length(fileList)
[~, thisName, ~] = fileparts(fileList{k});
EEG = pop_loadset(fileList{k});
params.name = thisName;
[EEG, params, computationTimes] = prepPipeline(EEG, params);
fprintf('Computation times (seconds):\n %s\n', ...
getStructureString(computationTimes));
fprintf('Post-process\n')
% EEG = prepPostProcess(EEG, params);
% fname = [outdir filesep thisName '.set'];
% save(fname, 'EEG', '-mat', '-v7.3');
% if strcmpi(params.errorMsgs, 'verbose')
% outputPrepParams(params, 'Prep parameters (non-defaults)');
% outputPrepErrors(EEG.etc.noiseDetection, 'Prep error status');
% end
EEG = prepPostProcess(EEG, params);
fname = [outdir filesep thisName '.set'];
save(fname, 'EEG', '-mat', '-v7.3');
if strcmpi(params.errorMsgs, 'verbose')
outputPrepParams(params, 'Prep parameters (non-defaults)');
outputPrepErrors(EEG.etc.noiseDetection, 'Prep error status');
end

end
71 changes: 35 additions & 36 deletions PrepPipeline/examples/runVEPPrepReport.m
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
%% Read in the file and set the necessary parameters

% dataDir = 'O:\ARL_Data\VEP\VEP_Robust_1Hz';
% summaryFolder = 'O:\ARL_Data\VEP\VEP_Robust_1Hz_New_Report_B';

dataDir = 'D:\TempCTA';
summaryFolder = 'D:\TempCTA';
publishOn = true;
%% Get the directory list
inList = dir(dataDir);
inNames = {inList(:).name};
inTypes = [inList(:).isdir];
inNames = inNames(~inTypes);

%%
basename = 'vep';
summaryReportName = [basename '_summary.html'];
sessionFolder = '.';
summaryFileName = [summaryFolder filesep summaryReportName];
if exist(summaryFileName, 'file')
delete(summaryFileName);
end

%% Run the pipeline

for k = 1:length(inNames)
[~, theName, theExt] = fileparts(inNames{k});
if ~strcmpi(theExt, '.set') && ~strcmpi(theExt, '.mat')
continue;
end
sessionReportName = [theName '.pdf'];
fname = [dataDir filesep inNames{k}];
load(fname, '-mat');
sessionFileName = [summaryFolder filesep sessionReportName];
consoleFID = 1;
publishPrepReport(EEG, summaryFileName, sessionFileName, consoleFID, publishOn);
%% This script takes a directory of files that have been processed by PREP
% and produces reports.

%% Read in the file and set the necessary parameters
dataDir = 'F:\TempData';
summaryFolder = 'F:\TempDataReports';
publishOn = true;

%% Get the directory list
inList = dir(dataDir);
inNames = {inList(:).name};
inTypes = [inList(:).isdir];
inNames = inNames(~inTypes);

%% Setup up the names
basename = 'vep';
summaryReportName = [basename '_summary.html'];
sessionFolder = '.';
summaryFileName = [summaryFolder filesep summaryReportName];
if exist(summaryFileName, 'file')
delete(summaryFileName);
end

%% Publish the reports
for k = 1:length(inNames)
[~, theName, theExt] = fileparts(inNames{k});
if ~strcmpi(theExt, '.set') && ~strcmpi(theExt, '.mat')
continue;
end
sessionReportName = [theName '.pdf'];
fname = [dataDir filesep inNames{k}];
load(fname, '-mat');
sessionFileName = [summaryFolder filesep sessionReportName];
consoleFID = 1;
publishPrepReport(EEG, summaryFileName, sessionFileName, consoleFID, publishOn);
end
Loading

0 comments on commit d3a050f

Please sign in to comment.