/
CREx_MEG_BST_Pipeline_1_CreateProtocolFolders.m
71 lines (52 loc) · 2.32 KB
/
CREx_MEG_BST_Pipeline_1_CreateProtocolFolders.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
function CREx_MEG_BST_Pipeline_1_CreateProtocolFolders
% Example of script for Brainstorm software
% 1 - create a protocol and new sujets
% 2 - import 4D MEG Files per Run
% Author: Valérie Chanoine, Research Engineer at Brain and Language
% Research Institute (http://www.blri.fr/)
% Partners: Jean-Michel Badier and Christian Bénar from
% MEG Center of Marseille (Timone Hospital, France)
% Date: April 10, 2015
%%======= FILES TO IMPORT =======
RawDataDir = 'F:\blog_CREX\MEG\rawData';
AnatDir = fullfile(RawDataDir, 'IRM');
DataDir = fullfile(RawDataDir, 'MEG');
SubjectName = {'NV_001_A1', 'NV_002_A2'};
%% ===== START BRAINSTORM =====
if ~brainstorm('status')
brainstorm nogui
end
%% ======= CREATE PROTOCOL =======
% The protocol name has to be a valid folder name (no spaces, no weird characters...)
ProtocolName = 'Blog_tutorial';
% Delete existing protocol
gui_brainstorm('DeleteProtocol', ProtocolName);
% Create new protocol
gui_brainstorm('CreateProtocol', ProtocolName, 0, 0);
% Loop on subjects
for ixSub=1:numel(SubjectName)
%% ===== CREATE SUBJECT =====
UseDefaultAnat = 0;
UseDefaultChannel = 0;
db_add_subject(SubjectName{ixSub}, [], UseDefaultAnat, UseDefaultChannel);
%% ===== DEFINE MEG RECORDINGS =====
SubNameDir = fullfile(DataDir, SubjectName{ixSub}, 'NV_1');
RawFiles = {...
fullfile(SubNameDir, '1', 'c,rfDC_bp0p3_300_run1'),...
fullfile(SubNameDir, '2', 'c,rfDC_bp0p3_300_run2'),...
fullfile(SubNameDir, '3', 'c,rfDC_bp0p3_300_run3'),...
fullfile(SubNameDir, '4', 'c,rfDC_bp0p3_300_run4'),...
fullfile(SubNameDir, '5', 'c,rfDC_bp0p3_300_run5'),...
fullfile(SubNameDir, '6', 'c,rfDC_bp0p3_300_run6')...
}
%% ===== IMPORT MEG RECORDINGS =====
% Import options
ImportOptions = db_template('ImportOptions');
ImportOptions.ChannelReplace = 1;
ImportOptions.ChannelAlign = 0;
ImportOptions.DisplayMessages = 0;
ImportOptions.EventsMode = 'ask';
ImportOptions.EventsTrackMode = 'value';
OutputFiles = import_raw(RawFiles, '4D', ixSub, ImportOptions);
end
end