0001 function out = prt_run_fs(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 job = varargin{1};
0021 fname = char(job.infile);
0022 if exist('PRT','var')
0023 clear PRT
0024 end
0025 load(fname);
0026 fs_name = job.k_file;
0027
0028
0029 if isfield(job, 'flag_mm')
0030 flag_mm = job.flag_mm;
0031 else
0032 flag_mm = 0;
0033 end
0034
0035 mod = struct();
0036 allmod = {PRT.masks(:).mod_name};
0037 modchos = {job.modality(:).mod_name};
0038
0039 maskchos = {job.modality(:).mod_name};
0040
0041 if ~isempty(setdiff(modchos,allmod))
0042 error(['Couldn''t find modality "',cell2mat(modchos),'" in PRT.mat']);
0043 end
0044
0045 for i=1:length(PRT.masks)
0046 if any(strcmpi(modchos,allmod{i}))
0047 mod(i).mod_name=allmod{i};
0048 ind=find(strcmpi(modchos,allmod{i}));
0049
0050
0051
0052 if isfield(job.modality(ind).detrend,'linear_dt')
0053 mod(i).detrend=1;
0054 mod(i).param_dt=job.modality(ind).detrend.linear_dt.paramPoly_dt;
0055 elseif isfield(job.modality(ind).detrend,'no_dt')
0056 mod(i).detrend=0;
0057 mod(i).param_dt=[];
0058 else
0059 mod(i).detrend=2;
0060 mod(i).param_dt=job.modality(ind).detrend.dct_dt.param_dt;
0061 end
0062
0063 if isfield(job.modality(ind).normalise,'no_gms')
0064 mod(i).normalise = 0;
0065 mod(i).matnorm = [];
0066 elseif isfield(job.modality(ind).normalise,'mat_gms')
0067 mod(i).normalise=2;
0068 mod(i).matnorm = char(job.modality(ind).normalise.mat_gms);
0069 end
0070
0071 if isfield(job.modality(ind).conditions,'all_cond')
0072 mod(i).mode='all_cond';
0073 elseif isfield(job.modality(ind).conditions,'all_scans')
0074 mod(i).mode='all_scans';
0075 else
0076 error('Wrong mode selected: choose either all scans or all conditions')
0077 end
0078 indm=find(strcmpi(maskchos,allmod{i}));
0079
0080
0081
0082
0083
0084 if isfield(job.modality(indm).voxels,'fmask')
0085 mod(i).mask = char(job.modality(indm).voxels.fmask);
0086 else
0087 mod(i).mask = [];
0088 end
0089
0090 if isfield(job.modality(ind),'atlasroi')
0091 mod(i).atlasroi = job.modality(ind).atlasroi{1};
0092 if ~isempty(mod(i).atlasroi)
0093 mod(i).multroi = 1;
0094 else
0095 mod(i).multroi = 0;
0096 end
0097 else
0098 mod(i).multroi = 0;
0099 end
0100
0101 else
0102 mod(i).mod_name=[];
0103 mod(i).detrend=nan;
0104 mod(i).mode=nan;
0105 mod(i).mask=[];
0106 end
0107 end
0108
0109 input = struct( ...
0110 'fname',fname, ...
0111 'fs_name',fs_name, ...
0112 'mod',mod, ...
0113 'flag_mm', flag_mm);
0114
0115 prt_fs(PRT,input);
0116
0117 out.fname{1} = fname;
0118 out.fs_name = fs_name;
0119 disp('Done.')
0120 end
0121
0122
0123
0124
0125