Skip to content

Commit

Permalink
automatically synchronized identical files to 6637749
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoostenveld committed Jan 21, 2021
1 parent 6637749 commit c54f7ac
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 14 deletions.
1 change: 0 additions & 1 deletion fileio/private/ft_datatype_raw.m
Expand Up @@ -85,7 +85,6 @@
end
assert(length(unique(data.label))==length(data.label), 'channel labels must be unique');


% convert it into true/false
if isequal(hassampleinfo, 'ifmakessense')
hassampleinfo = makessense(data, 'sampleinfo');
Expand Down
23 changes: 19 additions & 4 deletions fileio/private/ft_datatype_sens.m
Expand Up @@ -152,10 +152,25 @@
% this is needed further down
nchan = length(sens.label);

% there are many cases which are MEG, EEG or NIRS specific
ismeg = ft_senstype(sens, 'meg');
iseeg = ft_senstype(sens, 'eeg');
isnirs = ft_senstype(sens, 'nirs');
% these are used at multiple places, therefore we determine them only once
if isfield(sens, 'coilpos')
ismeg = true;
iseeg = true;
isnirs = false;
elseif isfield(sens, 'elecpos')
ismeg = false;
iseeg = true;
isnirs = false;
elseif isfield(sens, 'optopos')
ismeg = false;
iseeg = false;
isnirs = true;
else
% doing it this way takes a lot more CPU time
ismeg = ft_senstype(sens, 'meg');
iseeg = ft_senstype(sens, 'eeg');
isnirs = ft_senstype(sens, 'nirs');
end

switch version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
12 changes: 12 additions & 0 deletions fileio/private/ft_senstype.m
Expand Up @@ -151,6 +151,18 @@
return
end

% in some cases these are easy to determine, no need to continue with the elaborate checks
if strcmp(desired, 'meg') && isfield(input, 'coilpos')
type = true;
return
elseif strcmp(desired, 'eeg') && isfield(input, 'elecpos')
type = true;
return
elseif strcmp(desired, 'nirs') && isfield(input, 'optopos')
type = true;
return
end

isdata = isa(input, 'struct') && (isfield(input, 'hdr') || isfield(input, 'time') || isfield(input, 'freq') || isfield(input, 'grad') || isfield(input, 'elec') || isfield(input, 'opto'));
isheader = isa(input, 'struct') && isfield(input, 'label') && isfield(input, 'Fs');
isgrad = isa(input, 'struct') && isfield(input, 'label') && isfield(input, 'pnt') && isfield(input, 'ori'); % old style
Expand Down
23 changes: 19 additions & 4 deletions forward/private/ft_datatype_sens.m
Expand Up @@ -152,10 +152,25 @@
% this is needed further down
nchan = length(sens.label);

% there are many cases which are MEG, EEG or NIRS specific
ismeg = ft_senstype(sens, 'meg');
iseeg = ft_senstype(sens, 'eeg');
isnirs = ft_senstype(sens, 'nirs');
% these are used at multiple places, therefore we determine them only once
if isfield(sens, 'coilpos')
ismeg = true;
iseeg = true;
isnirs = false;
elseif isfield(sens, 'elecpos')
ismeg = false;
iseeg = true;
isnirs = false;
elseif isfield(sens, 'optopos')
ismeg = false;
iseeg = false;
isnirs = true;
else
% doing it this way takes a lot more CPU time
ismeg = ft_senstype(sens, 'meg');
iseeg = ft_senstype(sens, 'eeg');
isnirs = ft_senstype(sens, 'nirs');
end

switch version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
12 changes: 12 additions & 0 deletions inverse/private/ft_senstype.m
Expand Up @@ -151,6 +151,18 @@
return
end

% in some cases these are easy to determine, no need to continue with the elaborate checks
if strcmp(desired, 'meg') && isfield(input, 'coilpos')
type = true;
return
elseif strcmp(desired, 'eeg') && isfield(input, 'elecpos')
type = true;
return
elseif strcmp(desired, 'nirs') && isfield(input, 'optopos')
type = true;
return
end

isdata = isa(input, 'struct') && (isfield(input, 'hdr') || isfield(input, 'time') || isfield(input, 'freq') || isfield(input, 'grad') || isfield(input, 'elec') || isfield(input, 'opto'));
isheader = isa(input, 'struct') && isfield(input, 'label') && isfield(input, 'Fs');
isgrad = isa(input, 'struct') && isfield(input, 'label') && isfield(input, 'pnt') && isfield(input, 'ori'); % old style
Expand Down
23 changes: 19 additions & 4 deletions plotting/private/ft_datatype_sens.m
Expand Up @@ -152,10 +152,25 @@
% this is needed further down
nchan = length(sens.label);

% there are many cases which are MEG, EEG or NIRS specific
ismeg = ft_senstype(sens, 'meg');
iseeg = ft_senstype(sens, 'eeg');
isnirs = ft_senstype(sens, 'nirs');
% these are used at multiple places, therefore we determine them only once
if isfield(sens, 'coilpos')
ismeg = true;
iseeg = true;
isnirs = false;
elseif isfield(sens, 'elecpos')
ismeg = false;
iseeg = true;
isnirs = false;
elseif isfield(sens, 'optopos')
ismeg = false;
iseeg = false;
isnirs = true;
else
% doing it this way takes a lot more CPU time
ismeg = ft_senstype(sens, 'meg');
iseeg = ft_senstype(sens, 'eeg');
isnirs = ft_senstype(sens, 'nirs');
end

switch version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
12 changes: 12 additions & 0 deletions plotting/private/ft_senstype.m
Expand Up @@ -151,6 +151,18 @@
return
end

% in some cases these are easy to determine, no need to continue with the elaborate checks
if strcmp(desired, 'meg') && isfield(input, 'coilpos')
type = true;
return
elseif strcmp(desired, 'eeg') && isfield(input, 'elecpos')
type = true;
return
elseif strcmp(desired, 'nirs') && isfield(input, 'optopos')
type = true;
return
end

isdata = isa(input, 'struct') && (isfield(input, 'hdr') || isfield(input, 'time') || isfield(input, 'freq') || isfield(input, 'grad') || isfield(input, 'elec') || isfield(input, 'opto'));
isheader = isa(input, 'struct') && isfield(input, 'label') && isfield(input, 'Fs');
isgrad = isa(input, 'struct') && isfield(input, 'label') && isfield(input, 'pnt') && isfield(input, 'ori'); % old style
Expand Down
12 changes: 11 additions & 1 deletion private/ctf2grad.m
Expand Up @@ -6,7 +6,7 @@
% for CTF data. Each of these implementations is dealt with here.
%
% Use as
% grad = ctf2grad(hdr, dewar, coilaccuracy)
% [grad, elec] = ctf2grad(hdr, dewar, coilaccuracy)
% where
% dewar = boolean, whether to return it in dewar or head coordinates (default is head coordinates)
% coilaccuracy = empty or a number (default is empty)
Expand Down Expand Up @@ -482,3 +482,13 @@
else
ft_error('unknown header to contruct gradiometer definition');
end

% chantype and chanunit are required as of 2016, see FT_DATATYPE_SENS
if ~isempty(grad)
grad.chantype = ft_chantype(grad);
grad.chanunit = ft_chanunit(grad);
end
if ~isempty(elec)
elec.chantype = ft_chantype(elec);
elec.chanunit = ft_chanunit(elec);
end

0 comments on commit c54f7ac

Please sign in to comment.