Skip to content

Commit ee9a5da

Browse files
committed
Merge branch 'master' of github.com:sccn/bids-matlab-tools
2 parents fc0d17e + 39b71e9 commit ee9a5da

12 files changed

+11
-31
lines changed

.gitattributes

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
*.fdt filter=lfs diff=lfs merge=lfs -text
2-
*.set filter=lfs diff=lfs merge=lfs -text
3-
*.tsv filter=lfs diff=lfs merge=lfs -text
41
testing/data/*.set filter=lfs diff=lfs merge=lfs -text
52
testing/data/*.fdt filter=lfs diff=lfs merge=lfs -text

bids_export.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,10 +915,13 @@ function copy_data_bids_eeg(sIn, subjectStr, sess, fileStr, opt)
915915
bids_writeelectrodefile(EEG, fileOutRed, 'export', opt.elecexport);
916916
if strcmpi(opt.modality, 'eeg')
917917
bids_writetinfofile(EEG, tInfo, notes, fileOutRed);
918+
EEG.etc.datatype = 'eeg';
918919
elseif strcmpi(opt.modality, 'ieeg')
919920
bids_writeieegtinfofile(EEG, tInfo, notes, fileOutRed);
921+
EEG.etc.datatype = 'ieeg';
920922
elseif strcmpi(opt.modality, 'meg')
921923
bids_writemegtinfofile(EEG, tInfo, notes, fileOutRed);
924+
EEG.etc.datatype = 'meg';
922925
end
923926

924927
% write channel information
@@ -1108,7 +1111,7 @@ function writetsv(fileName, matlabArray)
11081111
if fid == -1, error('Cannot write file - make sure you have writing permission'); end
11091112
for iRow=1:size(matlabArray,1)
11101113
for iCol=1:size(matlabArray,2)
1111-
if isempty(matlabArray{iRow,iCol})
1114+
if isempty(matlabArray{iRow,iCol}) || isnan(matlabArray{iRow,iCol})
11121115
%disp('Empty value detected, replacing by n/a');
11131116
fprintf(fid, 'n/a');
11141117
elseif ischar(matlabArray{iRow,iCol})

bids_writechanfile.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function eeg_writechanfile(EEG, fileOut)
2525
if contains(fileOut, 'ieeg')
2626
fprintf(fid, 'name\ttype\tunits\tlow_cutoff\thigh_cutoff\n');
2727
for iChan = 1:EEG.nbchan
28-
fprintf(fid, 'E%d\tEEG\tmicroV\tn/a\tn/a\n', iChan);
28+
fprintf(fid, 'E%d\tiEEG\tmicroV\tn/a\tn/a\n', iChan);
2929
end
3030
else
3131
fprintf(fid, 'name\ttype\tunits\n');

bids_writeelectrodefile.m

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,10 @@ function bids_writeelectrodefile(EEG, fileOut, varargin)
2020
else
2121
flagExport = 'auto';
2222
end
23-
isTemplate = false;
24-
% case { 32 33 }, fileloc = 'GSN-HydroCel-32.sfp';
25-
% case { 64 65 }, fileloc = 'GSN65v2_0.sfp';
26-
% case { 128 129 }, fileloc = 'GSN129.sfp';
27-
% case { 256 257 }, fileloc = 'GSN-HydroCel-257.sfp';
28-
%
23+
2924
if isfield(EEG.chaninfo, 'filename') && isequal(flagExport, 'auto')
30-
if ~isempty(strfind(EEG.chaninfo.filename, 'standard-10-5-cap385.elp')) || ...
31-
~isempty(strfind(EEG.chaninfo.filename, 'standard_1005.elc'))||...
32-
~isempty(strfind(EEG.chaninfo.filename, 'standard_1005.ced'))
25+
templates = {'GSN-HydroCel-32.sfp', 'GSN65v2_0.sfp', 'GSN129.sfp', 'GSN-HydroCel-257.sfp', 'standard-10-5-cap385.elp', 'standard_1005.elc', 'standard_1005.ced'};
26+
if any(contains(EEG.chaninfo.filename, templates))
3327
flagExport = 'off';
3428
disp('Template channel location detected, not exporting electrodes.tsv file');
3529
end
@@ -40,7 +34,7 @@ function bids_writeelectrodefile(EEG, fileOut, varargin)
4034
fprintf(fid, 'name\tx\ty\tz\n');
4135

4236
for iChan = 1:EEG.nbchan
43-
if isempty(EEG.chanlocs(iChan).X) || isnan(EEG.chanlocs(iChan).X)
37+
if isempty(EEG.chanlocs(iChan).X) || isnan(EEG.chanlocs(iChan).X) || contains(fileOut, 'ieeg')
4438
fprintf(fid, '%s\tn/a\tn/a\tn/a\n', EEG.chanlocs(iChan).labels );
4539
else
4640
fprintf(fid, '%s\t%2.6f\t%2.6f\t%2.6f\n', EEG.chanlocs(iChan).labels, EEG.chanlocs(iChan).X, EEG.chanlocs(iChan).Y, EEG.chanlocs(iChan).Z );

bids_writetinfofile.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@
4040
end
4141
if EEG.trials == 1
4242
tInfo.RecordingType = 'continuous';
43+
tInfo.RecordingDuration = EEG.pnts/EEG.srate;
4344
else
4445
tInfo.RecordingType = 'epoched';
4546
tInfo.EpochLength = EEG.pnts/EEG.srate;
47+
tInfo.RecordingDuration = (EEG.pnts/EEG.srate)*EEG.trials;
4648
end
47-
tInfo.RecordingDuration = EEG.pnts/EEG.srate;
4849
tInfo.SamplingFrequency = EEG.srate;
4950
if ~isempty(notes)
5051
tInfo.SubjectArtefactDescription = notes;

testing/data/eeglab_data.fdt

3.72 MB
Binary file not shown.

testing/data/eeglab_data.set

351 KB
Binary file not shown.

testing/data/sub-044_task-AuditoryVisualShift_run-01_channels.tsv

Lines changed: 0 additions & 3 deletions
This file was deleted.

testing/data/sub-044_task-AuditoryVisualShift_run-01_eeg.fdt

Lines changed: 0 additions & 3 deletions
This file was deleted.

testing/data/sub-044_task-AuditoryVisualShift_run-01_eeg.set

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)