Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bucanl_pipelines
bids_lossless_eeg
Commits
fbe83c5d
Commit
fbe83c5d
authored
Sep 18, 2018
by
Tyler Collins
Browse files
New structure additions.
parent
687c77b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
fbe83c5d
...
...
@@ -6,7 +6,7 @@ octave-workspace
# But keep the pipeline code.
# !derivatives/lossless/code/*
derivatives/lossless/log
code/eeg_init
code/eeg_init
/*
code/misc
# Specifically hide the staging script
...
...
@@ -22,3 +22,4 @@ sub-*
participants.tsv
dataset_description.json
grp_*
*.mat
code/eeg_init/eeg_init.m
deleted
100644 → 0
View file @
687c77b4
function
eeg_init
(
EEG
,
infname
)
disp
([
'current file: '
,
infname
(
1
:
end
-
1
)])
%parse infname.
[
p
,
n
]
=
fileparts
(
infname
);
%subject ID
subids_ind
=
strfind
(
lower
(
n
),
'ec_t'
)
+
6
;
subide_ind
=
strfind
(
lower
(
n
),
'ec_t'
)
+
8
;
subid
=
n
(
subids_ind
:
subide_ind
);
if
isempty
(
str2num
(
subid
));
ecs_ind
=
strfind
(
lower
(
n
),
'ec'
);
if
strcmp
(
lower
(
n
(
ecs_ind
+
7
)),
't'
);
subid
=
n
(
ecs_ind
+
3
:
ecs_ind
+
5
);
elseif
strcmp
(
lower
(
n
(
ecs_ind
+
6
)),
't'
);
subid
=
n
(
ecs_ind
+
2
:
ecs_ind
+
4
);
elseif
strcmp
(
lower
(
n
(
ecs_ind
+
3
)),
'p'
);
subid
=
n
(
ecs_ind
+
5
:
ecs_ind
+
7
);
end
if
isempty
(
str2num
(
subid
));
disp
(
'COULD NOT FIND THE SUBJECT ID.'
);
return
;
end
end
%session ID
sesids_ind
=
strfind
(
n
,
'_t'
)
+
2
;
sesid
=
n
(
sesids_ind
);
if
isempty
(
str2num
(
sesid
));
disp
(
'COULD NOT FIND THE SESSION ID.'
);
return
;
end
if
strcmp
(
sesid
,
'1'
);
agelab
=
'm06'
;
tasklab
=
't1task'
;
elseif
strcmp
(
sesid
,
'2'
);
agelab
=
'm12'
;
tasklab
=
't2task'
;
elseif
strcmp
(
sesid
,
'3'
);
agelab
=
'm18'
;
tasklab
=
't3task'
;
end
outfpath
=
[
'sub-s'
,
subid
,
'/ses-'
,
agelab
,
'/eeg/'
];
disp
([
'outpath: '
,
outfpath
]);
disp
([
'current session: '
sesid
]);
EEG
=
pop_readegi
(
infname
(
1
:
end
-
1
),
[],[],
'auto'
);
%ADD Cz TO DATA ARRAY.
EEG
.
data
(
129
,:)
=
zeros
(
size
(
EEG
.
data
(
1
,:)));
EEG
.
nbchan
=
129
;
EEG
.
chanlocs
(
129
)
=
EEG
.
chanlocs
(
128
);
EEG
.
chanlocs
(
129
)
.
labels
=
EEG
.
chaninfo
.
nodatchans
(
4
)
.
labels
;
EEG
.
chanlocs
(
129
)
.
Y
=
EEG
.
chaninfo
.
nodatchans
(
4
)
.
Y
;
EEG
.
chanlocs
(
129
)
.
X
=
EEG
.
chaninfo
.
nodatchans
(
4
)
.
X
;
EEG
.
chanlocs
(
129
)
.
Z
=
EEG
.
chaninfo
.
nodatchans
(
4
)
.
Z
;
EEG
.
chanlocs
(
129
)
.
sph_theta
=
EEG
.
chaninfo
.
nodatchans
(
4
)
.
sph_theta
;
EEG
.
chanlocs
(
129
)
.
sph_phi
=
EEG
.
chaninfo
.
nodatchans
(
4
)
.
sph_phi
;
EEG
.
chanlocs
(
129
)
.
sph_radius
=
EEG
.
chaninfo
.
nodatchans
(
4
)
.
sph_radius
;
EEG
.
chanlocs
(
129
)
.
theta
=
EEG
.
chaninfo
.
nodatchans
(
4
)
.
theta
;
EEG
.
chanlocs
(
129
)
.
radius
=
EEG
.
chaninfo
.
nodatchans
(
4
)
.
radius
;
EEG
.
chanlocs
(
129
)
.
type
=
'EEG'
;
EEG
.
chaninfo
.
nodatchans
=
EEG
.
chaninfo
.
nodatchans
(
1
:
3
);
EEG
=
pop_chanedit
(
EEG
,
'load'
,{
'sourcedata/misc/GSN129.sfp'
'filetype'
'autodetect'
});
if
~
isempty
(
EEG
.
event
);
for
i
=
1
:
length
(
EEG
.
event
);
if
strcmp
(
EEG
.
event
(
i
)
.
type
,
'epoc'
);
EEG
.
event
(
i
)
.
type
=
'boundary'
;
end
end
end
% CHECK FOR OUTPUT PATH AND CRETAE IF NECESSARY
if
~
exist
(
outfpath
);
disp
([
'Making directory '
,
outfpath
]);
eval
([
'mkdir '
outfpath
]);
end
outfname
=
[
'sub-s'
,
subid
,
'_ses-'
,
agelab
,
'_task-'
,
tasklab
,
'_eeg.set'
];
if
strcmp
(
n
(
1
:
2
),
'p0'
);
outfname
=
[
'sub-s'
,
subid
,
'_ses-'
,
agelab
,
'_task-'
,
tasklab
,
'_eeg_'
,
n
(
1
:
3
),
'.set'
];
end
if
strcmp
(
n
(
end
-
5
:
end
-
3
),
'eeg'
);
outfname
=
[
'sub-s'
,
subid
,
'_ses-'
,
agelab
,
'_task-'
,
tasklab
,
'_eeg_p'
,
n
(
end
-
1
:
end
),
'.set'
];
end
disp
(
outfname
);
%save output set file
EEG
=
pop_saveset
(
EEG
,
'filename'
,[
outfpath
,
'/'
,
outfname
]);
end
code/eeg_init/init_script.m
deleted
100644 → 0
View file @
687c77b4
[x,y] = system('find . -type f -name *.raw');
filenames = strsplit(y,'./');
filenames = filenames(2:end);
for i=1:length(filenames);
eeg_init(EEG,filenames{i});
end
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment