Skip to content

Commit

Permalink
SPM12 r7219
Browse files Browse the repository at this point in the history
  • Loading branch information
SPMcentral committed Nov 16, 2017
1 parent 015b151 commit 0f9eada
Show file tree
Hide file tree
Showing 1,775 changed files with 57,726 additions and 28,932 deletions.
8 changes: 3 additions & 5 deletions @file_array/Contents.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@
% size(fa4)
% size(fa2)
% length(fa0)
% _________________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging

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


% $Id: Contents.m 7147 2017-08-03 14:07:01Z spm $
20 changes: 10 additions & 10 deletions @file_array/cat.m
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
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
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging

%
% $Id: cat.m 4136 2010-12-09 22:22:28Z guillaume $
% $Id: cat.m 7147 2017-08-03 14:07:01Z spm $


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
6 changes: 3 additions & 3 deletions @file_array/ctranspose.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
function varargout = ctranspose(varargin)
% Transposing not allowed
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging

%
% $Id: ctranspose.m 1143 2008-02-07 19:33:33Z spm $
% $Id: ctranspose.m 7147 2017-08-03 14:07:01Z spm $

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

%
% $Id: disp.m 4136 2010-12-09 22:22:28Z guillaume $
% $Id: disp.m 7147 2017-08-03 14:07:01Z spm $


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: 3 additions & 3 deletions @file_array/display.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
function display(obj)
% Display a file_array object
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging

%
% $Id: display.m 1143 2008-02-07 19:33:33Z spm $
% $Id: display.m 7147 2017-08-03 14:07:01Z spm $


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

%
% $Id: double.m 1143 2008-02-07 19:33:33Z spm $
% $Id: double.m 7147 2017-08-03 14:07:01Z spm $

out = double(numeric(fa));

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

%
% $Id: end.m 1143 2008-02-07 19:33:33Z spm $
% $Id: end.m 7147 2017-08-03 14:07:01Z 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: 4 additions & 3 deletions @file_array/fieldnames.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
function t = fieldnames(obj)
% Fieldnames of a file-array object
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging

%
% $Id: fieldnames.m 1143 2008-02-07 19:33:33Z spm $
% $Id: fieldnames.m 7147 2017-08-03 14:07:01Z spm $


t = {...
'fname'
Expand Down
29 changes: 14 additions & 15 deletions @file_array/file_array.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,33 @@
% 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
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging

%
% $Id: file_array.m 4136 2010-12-09 22:22:28Z guillaume $
% $Id: file_array.m 7147 2017-08-03 14:07:01Z spm $


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: 4 additions & 5 deletions @file_array/horzcat.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
function o = horzcat(varargin)
% Horizontal concatenation of file_array objects
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging

%
% $Id: horzcat.m 1143 2008-02-07 19:33:33Z spm $
% $Id: horzcat.m 7147 2017-08-03 14:07:01Z spm $

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

o = cat(2,varargin{:});
4 changes: 2 additions & 2 deletions @file_array/initialise.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ 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
% Copyright (C) 2013-2017 Wellcome Trust Centre for Neuroimaging

%
% $Id: initialise.m 5458 2013-05-01 14:32:23Z guillaume $
% $Id: initialise.m 7147 2017-08-03 14:07:01Z spm $


% first approach
Expand Down
10 changes: 5 additions & 5 deletions @file_array/isnan.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
% Convert to numeric form
% FORMAT isnan(fa)
% fa - a file_array
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging

%
% $Id: isnan.m 1301 2008-04-03 13:21:44Z john $
% $Id: isnan.m 7147 2017-08-03 14:07:01Z spm $


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: 3 additions & 4 deletions @file_array/length.m
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
function l = length(x)
% Overloaded length function for file_array objects
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%__________________________________________________________________________
% Copyright (C) 2005-2017 Wellcome Trust Centre for Neuroimaging

%
% $Id: length.m 1143 2008-02-07 19:33:33Z spm $
% $Id: length.m 7147 2017-08-03 14:07:01Z spm $


l = max(size(x));

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

%
% $Id: loadobj.m 1544 2008-05-06 10:34:36Z guillaume $
% $Id: loadobj.m 7147 2017-08-03 14:07:01Z spm $


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

%
% $Id: ndims.m 1143 2008-02-07 19:33:33Z spm $
% $Id: ndims.m 7147 2017-08-03 14:07:01Z spm $


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

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

%
% $Id: numel.m 1143 2008-02-07 19:33:33Z spm $
% $Id: numel.m 7147 2017-08-03 14:07:01Z spm $


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

%
% $Id: numeric.m 1143 2008-02-07 19:33:33Z spm $
% $Id: numeric.m 7147 2017-08-03 14:07:01Z spm $


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

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

%
% $Id: permute.m 1143 2008-02-07 19:33:33Z spm $
% $Id: permute.m 7147 2017-08-03 14:07:01Z spm $


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

0 comments on commit 0f9eada

Please sign in to comment.