Skip to content

Commit

Permalink
ENH - added missing mex files (fieldtrip#2419)
Browse files Browse the repository at this point in the history
* ENH - added missing mex files

* ENH - updated spm_platform

* ENH - updated large part of spm code to dev-version on github

* ENH - also updated code from lower level folders

* added to-be-ignored word
  • Loading branch information
schoffelen authored Jun 5, 2024
1 parent 90f0d93 commit e1f7d03
Show file tree
Hide file tree
Showing 245 changed files with 3,820 additions and 3,220 deletions.
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[codespell]
skip = .git,*.pdf,*.svg,external,src
ignore-words-list = ans,cfg,siz,pnt,pos,ori,ext,dum,siz,toi,homogenous,whos,nas,ini,lpa,rpa,als,ali,ars,ari,pls,pli,prs,pri,las,lai,ras,rai,lps,lpi,rps,rpi,asl,ail,asr,air,psl,pil,psr,pir,sal,ial,sar,iar,spl,ipl,spr,ipr,sla,ila,sra,ira,slp,ilp,srp,irp,lsa,lia,rsa,ria,lsp,lip,rsp,rip
ignore-words-list = assignin,ans,cfg,siz,pnt,pos,ori,ext,dum,siz,toi,homogenous,whos,nas,ini,lpa,rpa,als,ali,ars,ari,pls,pli,prs,pri,las,lai,ras,rai,lps,lpi,rps,rpi,asl,ail,asr,air,psl,pil,psr,pir,sal,ial,sar,iar,spl,ipl,spr,ipr,sla,ila,sra,ira,slp,ilp,srp,irp,lsa,lia,rsa,ria,lsp,lip,rsp,rip
exclude-file = .codespellignorelines

# case sensitive etc as regex
Expand Down
8 changes: 2 additions & 6 deletions external/spm12/@file_array/Contents.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
% size(fa4)
% size(fa2)
% length(fa0)
% _________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging

%
% $Id: Contents.m 2696 2009-02-05 20:29:48Z guillaume $

%__________________________________________________________________________

% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging
20 changes: 9 additions & 11 deletions external/spm12/@file_array/cat.m
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
function o = cat(dr,varargin)
% Concatenate file_array objects. The result is a non-simple object
% that can no longer be reshaped.
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

%
% $Id: cat.m 4136 2010-12-09 22:22:28Z guillaume $
% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging


if dr>32 || dr<0, error('Unknown command option.'); end;
if dr>32 || dr<0, error('Unknown command option.'); end
dr = max(round(dr),1);
d = ones(nargin-1,16);
tmp = {};
dpos = 0;
for i=1:nargin-1,
for i=1:nargin-1
vi = varargin{i};
if strcmp(class(vi),'file_array')
sz = size(vi);
d(i,1:length(sz)) = sz;
svi = struct(vi);
svi = svi(:);
for j=1:length(svi(:)),
for j=1:length(svi(:))
if length(svi(j).pos)<dr
svi(j).pos((length(svi(j).pos)+1):dr) = 1;
end
svi(j).pos(dr)= svi(j).pos(dr) + dpos;
end;
end
dpos = dpos + d(i,dr);
tmp{i} = svi;
else
error(['Conversion to file_array from ' class(vi) ' is not possible.']);
end;
end;
end
end
if any(diff(d(:,[1:(dr-1) (dr+1):end]),1,1))
error('All matrices on a row in the bracketed expression must have the same number of rows.');
else
o = vertcat(tmp{:});
o = file_array(o);
end;
end
7 changes: 3 additions & 4 deletions external/spm12/@file_array/ctranspose.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
function varargout = ctranspose(varargin)
% Transposing not allowed
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging

%
% $Id: ctranspose.m 1143 2008-02-07 19:33:33Z spm $

error('file_array objects can not be transposed.');
29 changes: 13 additions & 16 deletions external/spm12/@file_array/disp.m
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
function disp(obj)
% Display a file_array object
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

%
% $Id: disp.m 4136 2010-12-09 22:22:28Z guillaume $
% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging


if numel(struct(obj))>1,
if numel(struct(obj))>1
fprintf(' %s object: ', class(obj));
sz = size(obj);
if length(sz)>4,
if length(sz)>4
fprintf('%d-D\n',length(sz));
else
for i=1:(length(sz)-1),
for i=1:(length(sz)-1)
fprintf('%d-by-',sz(i));
end;
end
fprintf('%d\n',sz(end));
end;
end
else
disp(mystruct(obj))
end;
return;
%=======================================================================
end

%=======================================================================

%==========================================================================
% function t = mystruct(obj)
%==========================================================================
function t = mystruct(obj)
fn = fieldnames(obj);
for i=1:length(fn)
t.(fn{i}) = subsref(obj,struct('type','.','subs',fn{i}));
end;
return;
%=======================================================================
end
6 changes: 2 additions & 4 deletions external/spm12/@file_array/display.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
function display(obj)
% Display a file_array object
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

%
% $Id: display.m 1143 2008-02-07 19:33:33Z spm $
% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging


disp(' ');
Expand Down
8 changes: 3 additions & 5 deletions external/spm12/@file_array/double.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
% Convert to double precision
% FORMAT double(fa)
% fa - a file_array
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

%
% $Id: double.m 1143 2008-02-07 19:33:33Z spm $
% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging

out = double(numeric(fa));

out = double(full(fa));
13 changes: 6 additions & 7 deletions external/spm12/@file_array/end.m
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
function en = end(a,k,n)
% Overloaded end function for file_array objects.
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging

%
% $Id: end.m 1143 2008-02-07 19:33:33Z spm $

dim = size(a);
if k>length(dim)
en = 1;
else
if n<length(dim),
if n<length(dim)
dim = [dim(1:(n-1)) prod(dim(n:end))];
end;
end
en = dim(k);
end;
end
7 changes: 3 additions & 4 deletions external/spm12/@file_array/fieldnames.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
function t = fieldnames(obj)
% Fieldnames of a file-array object
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging

%
% $Id: fieldnames.m 1143 2008-02-07 19:33:33Z spm $

t = {...
'fname'
Expand Down
29 changes: 13 additions & 16 deletions external/spm12/@file_array/file_array.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,31 @@
% scl_slope - scalefactor (default = 1)
% scl_inter - DC offset, such that dat = raw*scale + inter (default = 0)
% permission - Write permission, either 'rw' or 'ro' (default = 'rw')
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

%
% $Id: file_array.m 4136 2010-12-09 22:22:28Z guillaume $
% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging


if nargin==1
if isstruct(varargin{1}),
if isstruct(varargin{1})
a = class(varargin{1},'file_array');
return;
elseif isa(varargin{1},'file_array'),
elseif isa(varargin{1},'file_array')
a = varargin{1};
return;
end;
end;
end
end
a = struct('fname','','dim',[0 0],'dtype',2,...
'be',0,'offset',0,'pos',[],'scl_slope',[],'scl_inter',[], 'permission','rw');
%a = class(a,'file_array');

if nargin>=1, a = fname(a,varargin{1}); end;
if nargin>=2, a = dim(a,varargin{2}); end;
if nargin>=3, a = dtype(a,varargin{3}); end;
if nargin>=4, a = offset(a,varargin{4}); end;
if nargin>=5, a = scl_slope(a,varargin{5}); end;
if nargin>=6, a = scl_inter(a,varargin{6}); end;
if nargin>=7, a = permission(a,varargin{7}); end;
if nargin>=1, a = fname(a,varargin{1}); end
if nargin>=2, a = dim(a,varargin{2}); end
if nargin>=3, a = dtype(a,varargin{3}); end
if nargin>=4, a = offset(a,varargin{4}); end
if nargin>=5, a = scl_slope(a,varargin{5}); end
if nargin>=6, a = scl_inter(a,varargin{6}); end
if nargin>=7, a = permission(a,varargin{7}); end

a.pos = ones(size(a.dim));
a = file_array(a);

9 changes: 3 additions & 6 deletions external/spm12/@file_array/horzcat.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
function o = horzcat(varargin)
% Horizontal concatenation of file_array objects
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

%
% $Id: horzcat.m 1143 2008-02-07 19:33:33Z spm $
% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging

o = cat(2,varargin{:});
return;

o = cat(2,varargin{:});
4 changes: 1 addition & 3 deletions external/spm12/@file_array/initialise.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ function initialise(fa)
% This creates a file on disk with the appropriate size by explicitly
% writing data to prevent a sparse file.
%__________________________________________________________________________
% Copyright (C) 2013 Wellcome Trust Centre for Neuroimaging

%
% $Id: initialise.m 5458 2013-05-01 14:32:23Z guillaume $
% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging


% first approach
Expand Down
12 changes: 5 additions & 7 deletions external/spm12/@file_array/isnan.m
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
function out = isnan(fa)
% Convert to numeric form
% Logical array containing true where the elements of file_array are NaN's
% FORMAT isnan(fa)
% fa - a file_array
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging

%
% $Id: isnan.m 1301 2008-04-03 13:21:44Z john $

bs = 10240;
m = size(fa);
fa = reshape(fa,prod(m),1);
n = prod(m);
out = false(m);
for i=1:ceil(n/bs),
for i=1:ceil(n/bs)
ii = ((((i-1)*bs)+1):min((i*bs),n))';
tmp = subsref(fa,struct('type','()','subs',{{ii}}));
out(ii) = isnan(tmp);
end

7 changes: 2 additions & 5 deletions external/spm12/@file_array/length.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
function l = length(x)
% Overloaded length function for file_array objects
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

%
% $Id: length.m 1143 2008-02-07 19:33:33Z spm $
% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging


l = max(size(x));

9 changes: 4 additions & 5 deletions external/spm12/@file_array/loadobj.m
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
function b = loadobj(a)
% loadobj for file_array class
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging

%
% $Id: loadobj.m 1544 2008-05-06 10:34:36Z guillaume $

if isa(a,'file_array')
b = a;
else
a = permission(a, 'rw');
b = file_array(a);
end
end
7 changes: 2 additions & 5 deletions external/spm12/@file_array/ndims.m
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
function out = ndims(fa)
% Number of dimensions
%_______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

%
% $Id: ndims.m 1143 2008-02-07 19:33:33Z spm $
% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging


out = size(fa);
out = length(out);

6 changes: 2 additions & 4 deletions external/spm12/@file_array/numel.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
function t = numel(obj)
% Number of simple file arrays involved.
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

%
% $Id: numel.m 1143 2008-02-07 19:33:33Z spm $
% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging


% Should be this, but it causes problems when accessing
Expand Down
10 changes: 3 additions & 7 deletions external/spm12/@file_array/numeric.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
% Convert to numeric form
% FORMAT numeric(fa)
% fa - a file_array
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________

%
% $Id: numeric.m 1143 2008-02-07 19:33:33Z spm $
% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging


[vo{1:ndims(fa)}] = deal(':');
out = subsref(fa,struct('type','()','subs',{vo}));

out = full(fa);
8 changes: 3 additions & 5 deletions external/spm12/@file_array/permute.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
function varargout = permute(varargin)
% Can not be permuted.
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
% file_array objects can not be permuted
%__________________________________________________________________________

%
% $Id: permute.m 1143 2008-02-07 19:33:33Z spm $
% Copyright (C) 2005-2022 Wellcome Centre for Human Neuroimaging


error('file_array objects can not be permuted.');
Loading

0 comments on commit e1f7d03

Please sign in to comment.