Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion external/fieldtrip/.fieldtrip-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
adf8a8b58f88ae194ecab4e18e2615f332694dbd
cfdad9b80757f9394404680d54ecb6e452fcc43b
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@
root_dir = fileparts(which('ft_defaults'));
if ~isempty(root_dir)
external_stats_dir = fullfile(root_dir, 'external', 'stats');
% these files are only used by the other functions in the external/stats directory
exclude_mfiles = {
'common_size.m'
'iscomplex.m'
};
tf = has_all_functions_in_dir(external_stats_dir, exclude_mfiles);
else
% this probably only works for MATLAB, not for Octave
Expand Down
16 changes: 8 additions & 8 deletions external/fieldtrip/data2bids.m
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@
end
end % if emptyroom

elseif isfield(hdr, 'grad') && ft_senstype(hdr.grad, 'neuromag')
elseif isfield(hdr, 'grad') && (ft_senstype(hdr.grad, 'neuromag') || ft_senstype(hdr.grad, 'fieldline_v3'))

if ~issubfield(hdr, 'orig.dig')
% the data was not read using the default Neuromag import function
Expand All @@ -1594,17 +1594,17 @@
ft_notice('this seems to be an empty room recording')
coordsystem_json.MEGCoordinateSystem = 'Other';
coordsystem_json.MEGCoordinateUnits = 'm';
coordsystem_json.MEGCoordinateSystemDescription = 'ElektaNeuromag dewar coordinates, orientation RAS';
coordsystem_json.MEGCoordinateSystemDescription = 'NeuromagElekta dewar coordinates, orientation RAS';
else
% coordinate system for MEG sensors
coordsystem_json.MEGCoordinateSystem = 'ElektaNeuromagMEGIN';
coordsystem_json.MEGCoordinateSystem = 'NeuromagElektaMEGIN';
coordsystem_json.MEGCoordinateUnits = 'm';
coordsystem_json.MEGCoordinateSystemDescription = 'ElektaNeuromag head coordinates, orientation RAS, origin between the ears';
coordsystem_json.MEGCoordinateSystemDescription = 'NeuromagElekta head coordinates, orientation RAS, origin between the ears';
% coordinate system for head localization coils
coordsystem_json.HeadCoilCoordinates = []; % see below
coordsystem_json.HeadCoilCoordinateSystem = 'ElektaNeuromagMEGIN';
coordsystem_json.HeadCoilCoordinateSystem = 'NeuromagElektaMEGIN';
coordsystem_json.HeadCoilCoordinateUnits = 'm';
coordsystem_json.HeadCoilCoordinateSystemDescription = 'ElektaNeuromag head coordinates, orientation RAS, origin between the ears';
coordsystem_json.HeadCoilCoordinateSystemDescription = 'NeuromagElekta head coordinates, orientation RAS, origin between the ears';
if isempty(coordsystem_json.HeadCoilCoordinates)
idxHPI = find([hdr.orig.dig.kind] == 2); % count the kind==2 (HLU in the Elekta/Megin system), usually 4 or 5
for i=1:length(idxHPI)
Expand All @@ -1614,9 +1614,9 @@
end
% coordinates of the anatomical landmarks (LPA/RPA/NAS)
coordsystem_json.AnatomicalLandmarkCoordinates = []; % see below
coordsystem_json.AnatomicalLandmarkCoordinateSystem = 'ElektaNeuromagMEGIN';
coordsystem_json.AnatomicalLandmarkCoordinateSystem = 'NeuromagElektaMEGIN';
coordsystem_json.AnatomicalLandmarkCoordinateUnits = 'm';
coordsystem_json.AnatomicalLandmarkCoordinateSystemDescription = 'ElektaNeuromag head coordinates, orientation RAS, origin between the ears';
coordsystem_json.AnatomicalLandmarkCoordinateSystemDescription = 'NeuromagElekta head coordinates, orientation RAS, origin between the ears';
if isempty(coordsystem_json.AnatomicalLandmarkCoordinates)
coordsystem_json = rmfield(coordsystem_json, 'AnatomicalLandmarkCoordinates'); % needed to set the names afterwards
coordsystem_json.AnatomicalLandmarkCoordinates.lpa = hdr.orig.dig(1).r';
Expand Down
15 changes: 9 additions & 6 deletions external/fieldtrip/fileio/ft_read_data.m
Original file line number Diff line number Diff line change
Expand Up @@ -766,15 +766,18 @@
dat = dat.data(chanindx,:); % select the desired channels

case 'eyelink_asc'
if isfield(hdr.orig, 'dat')
% this is inefficient, since it keeps the complete data in memory
% but it does speed up subsequent read operations without the user
% having to care about it
if isfield(hdr, 'orig')
asc = hdr.orig;
else
asc = read_eyelink_asc(filename);
% for some reason the orig is not present, but needed
hdr = read_eyelink_asc(filename);
asc = hdr.orig;
end
if checkboundary && (asc.trialidx(begsample)~=asc.trialidx(endsample))
ft_error('requested data segment extends over a discontinuous trial boundary');
end
dat = asc.dat(chanindx,begsample:endsample);
asc = read_eyelink_asc(filename, asc, begsample, endsample, chanindx);
dat = asc.dat;

case 'fcdc_buffer'
% read from a networked buffer for realtime analysis
Expand Down
65 changes: 1 addition & 64 deletions external/fieldtrip/fileio/ft_read_event.m
Original file line number Diff line number Diff line change
Expand Up @@ -1183,71 +1183,8 @@
end

case 'eyelink_asc'
if isempty(hdr)
hdr = ft_read_header(filename, 'headerformat', headerformat);
end
if isfield(hdr.orig, 'input')
% this is inefficient, since it keeps the complete data in memory
% but it does speed up subsequent read operations without the user
% having to care about it
asc = hdr.orig;
else
asc = read_eyelink_asc(filename);
end

% the input events are handled differently (because they already
% contain a timestamp and value, as per read_eyelink_asc
if ~isempty(asc.input)
timestamp = asc.input.timestamp;
value = asc.input.value;
sample = (timestamp-hdr.FirstTimeStamp)/hdr.TimeStampPerSample + 1;

% note that in this dataformat the first input trigger can be before
% the start of the data acquisition
for i=1:length(timestamp)
event(end+1).type = 'INPUT';
event(end ).sample = sample(i);
event(end ).timestamp = timestamp(i);
event(end ).value = value(i);
event(end ).duration = 1;
event(end ).offset = 0;
end
end

% these fields are dealt with a bit differently, the 'e' -events
% contain more information than the 's' -events
fnames = {'eblink', 'efix', 'esacc'};
tnames = {'BLINK', 'FIX', 'SACC'};
if isfield(asc, 'msg') && istable(asc.msg) && size(asc.msg,2)==2
fnames(end+1) = {'msg'};
tnames(end+1) = {'MSG'};
end
for k=1:length(fnames)
if isfield(asc, fnames{k}) && ~isempty(asc.(fnames{k}))
bfs = asc.(fnames{k});

timestamp = bfs.stime;
sample = (timestamp-hdr.FirstTimeStamp)/hdr.TimeStampPerSample + 1;
if ~strcmp(fnames{k}, 'msg')
value = bfs.eye;
duration = bfs.dur;
else
value = bfs.message;
duration = nan(size(bfs,1),1);
end
[hdr, event] = read_eyelink_asc(filename); % hdr and event are both returned in FT-style

% note that in this dataformat the first input trigger can be before
% the start of the data acquisition
for i=1:length(timestamp)
event(end+1).type = tnames{k};
event(end ).sample = sample(i);
event(end ).timestamp = timestamp(i);
event(end ).value = value(i);
event(end ).duration = duration(i);
event(end ).offset = 0;
end
end
end
case 'fcdc_global'
event = event_queue;

Expand Down
24 changes: 2 additions & 22 deletions external/fieldtrip/fileio/ft_read_header.m
Original file line number Diff line number Diff line change
Expand Up @@ -970,28 +970,8 @@
hdr.orig = orig;

case 'eyelink_asc'
asc = read_eyelink_asc(filename);
hdr.nChans = size(asc.dat,1);
hdr.nSamples = size(asc.dat,2);
hdr.nSamplesPre = 0;
hdr.nTrials = 1;
hdr.FirstTimeStamp = asc.dat(1,1);
hdr.TimeStampPerSample = median(diff(asc.dat(1,:)));
hdr.Fs = 1000/hdr.TimeStampPerSample; % these timestamps are in miliseconds
% give this warning only once
ft_warning('creating fake channel names');
for i=1:hdr.nChans
hdr.label{i} = sprintf('%d', i);
end

% remember all header and data details upon request
if cache
hdr.orig = asc;
else
% remember the original header details
hdr.orig = removefields(asc, 'dat');
end

hdr = read_eyelink_asc(filename);

case 'spmeeg_mat'
hdr = read_spmeeg_header(filename);

Expand Down
17 changes: 12 additions & 5 deletions external/fieldtrip/fileio/private/bids_sidecar.m
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,21 @@
% sort them to get the tsv files first in the list, followed by the json files
filelist = [filelist(endsWith(filelist', 'tsv')) filelist(endsWith(filelist', 'json'))];

% we are searching for a file with the datatype as suffix and that ends with json
% we are searching for a file with the same suffix and the extension tsv or json
evidence = zeros(size(filelist));
for i=1:numel(filelist)
[p, f, x] = fileparts(filelist{i});
tmp = split(f, '_');
% check the file extension, the suffix and the entities of each candidate file
if ismember(x, {'.tsv', '.json'}) && strcmp(tmp{end}, suffix) && all(ismember(tmp(1:end-1), entities))
ft_info('found matching BIDS sidecar ''%s''', filelist{i})
sidecar = filelist{i};
break % do not consider any of the other potential matches
if ismember(x, {'.tsv', '.json'}) && strcmp(tmp{end}, suffix) && sum(ismember(entities, tmp(1:end-1)))>0
% count how many entities of the sidecar match with the data file
evidence(i) = sum(ismember(entities, tmp(1:end-1)));
end
end

if any(evidence)
% take the first sidecar file that has most matching entities
[dum, sel] = max(evidence);
ft_info('found matching BIDS sidecar ''%s''', filelist{sel});
sidecar = filelist{sel};
end
2 changes: 1 addition & 1 deletion external/fieldtrip/fileio/private/ft_hastoolbox.m
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
case 'COMM'
dependency = {has_license('communication_toolbox'), 'de2bi', 'fskmod', 'pskmod'}; % also check the availability of a toolbox license
case 'SIGNAL'
dependency = {has_license('signal_toolbox'), 'window', 'hanning'}; % also check the availability of a toolbox license
dependency = {has_license('signal_toolbox'), 'medfilt1', 'freqz'}; % these must not be functions that external/signal provides
case 'IMAGES'
dependency = {has_license('image_toolbox'), 'imerode', 'imdilate'}; % also check the availability of a toolbox license
case 'VISION'
Expand Down
5 changes: 0 additions & 5 deletions external/fieldtrip/fileio/private/ft_platform_supports.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@
root_dir = fileparts(which('ft_defaults'));
if ~isempty(root_dir)
external_stats_dir = fullfile(root_dir, 'external', 'stats');
% these files are only used by the other functions in the external/stats directory
exclude_mfiles = {
'common_size.m'
'iscomplex.m'
};
tf = has_all_functions_in_dir(external_stats_dir, exclude_mfiles);
else
% this probably only works for MATLAB, not for Octave
Expand Down
Loading
Loading