0001 function V = full_vol(D, imgs)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 if nargin < 2
0019 error('Need image information');
0020 end
0021
0022 Swd = swd(D);
0023 if isempty(Swd)
0024 error('Need directory of design; it is missing');
0025 end
0026
0027 def_struct = mars_vol_utils('def_vol');
0028
0029 if isempty(imgs)
0030 V = def_struct;
0031 return
0032 end
0033
0034 if iscell(imgs)
0035 imgs = char(imgs);
0036 end
0037 if isstruct(imgs)
0038 V = imgs;
0039 nimgs = prod(size(imgs));
0040 for i = 1:nimgs
0041 fname = V(i).fname;
0042 if ~mars_utils('isabspath', fname);
0043 fname = fullfile(Swd, fname);
0044 end
0045 V(i).fname = fname;
0046 end
0047 elseif ischar(imgs)
0048 for i = 1:size(imgs, 1)
0049 fname = deblank(imgs(i,:));
0050 if ~mars_utils('isabspath', fname)
0051 fname = fullfile(Swd, fname);
0052 end
0053 if exist(fname, 'file')
0054 V(i) = spm_vol(fname);
0055 else
0056 V(i).fname = fname;
0057 end
0058 end
0059 else
0060 error('Odd input format for images');
0061 end
0062