Home > batch > prt_run_fs.m

prt_run_fs

PURPOSE ^

PRONTO job execution function

SYNOPSIS ^

function out = prt_run_fs(varargin)

DESCRIPTION ^

 PRONTO job execution function
 takes a harvested job data structure and rearrange data into "proper"
 data structure, then save do what it has to do...
 Here simply the harvested job structure in a mat file.

 INPUT
   job    - harvested job data structure (see matlabbatch help)

 OUTPUT
   out    - filename of saved data structure.
__________________________________________________________________________
 Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function out = prt_run_fs(varargin)
0002 % PRONTO job execution function
0003 % takes a harvested job data structure and rearrange data into "proper"
0004 % data structure, then save do what it has to do...
0005 % Here simply the harvested job structure in a mat file.
0006 %
0007 % INPUT
0008 %   job    - harvested job data structure (see matlabbatch help)
0009 %
0010 % OUTPUT
0011 %   out    - filename of saved data structure.
0012 %__________________________________________________________________________
0013 % Copyright (C) 2011 Machine Learning & Neuroimaging Laboratory
0014 
0015 % Written by A Marquand and J Schrouff
0016 % $Id: prt_run_fs.m 558 2012-06-19 08:09:08Z amarquan $
0017 
0018 % Job variable
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 mod=struct();
0029 allmod={PRT.masks(:).mod_name};
0030 modchos={job.modality(:).mod_name};
0031 %maskchos={job.mask(:).mod_name};
0032 maskchos={job.modality(:).mod_name};
0033 
0034 if ~isempty(setdiff(modchos,allmod))
0035     error(['Couldn''t find modality "',cell2mat(modchos),'" in PRT.mat']);
0036 end
0037 
0038 for i=1:length(PRT.masks)
0039     if any(strcmpi(modchos,allmod{i}))
0040         mod(i).mod_name=allmod{i};
0041         ind=find(strcmpi(modchos,allmod{i}));
0042         
0043         %mod(i).detrend=job.modality(ind).detrend;
0044         %mod(i).param_dt=job.modality(ind).param_dt;
0045         if isfield(job.modality(ind).detrend,'linear_dt')
0046             mod(i).detrend=1;
0047             mod(i).param_dt=job.modality(ind).detrend.linear_dt.paramPoly_dt;
0048         elseif isfield(job.modality(ind).detrend,'no_dt')
0049             mod(i).detrend=0;
0050             mod(i).param_dt=[];
0051         else
0052             mod(i).detrend=2;
0053             mod(i).param_dt=job.modality(ind).detrend.dct_dt.param_dt;
0054         end        
0055         
0056         if isfield(job.modality(ind).normalise,'no_gms')
0057             mod(i).normalise = 0;
0058             mod(i).matnorm = [];
0059         elseif isfield(job.modality(ind).normalise,'mat_gms')
0060             mod(i).normalise=2;
0061             mod(i).matnorm = char(job.modality(ind).normalise.mat_gms);
0062         end
0063         
0064         if isfield(job.modality(ind).conditions,'all_cond')
0065             mod(i).mode='all_cond';
0066         elseif isfield(job.modality(ind).conditions,'all_scans')
0067             mod(i).mode='all_scans';
0068         else
0069             error('Wrong mode selected: choose either all scans or all conditions')
0070         end            
0071         indm=find(strcmpi(maskchos,allmod{i}));
0072 %         if isempty(indm)
0073 %             error(['No mask selected for ',allmod{i}])
0074 %         else
0075 %             mod(i).mask=char(job.modality(indm).fmask);
0076 %         end
0077         if isfield(job.modality(indm).voxels,'fmask')
0078             mod(i).mask = char(job.modality(indm).voxels.fmask);
0079         else
0080             mod(i).mask = [];
0081         end
0082             
0083     else
0084         mod(i).mod_name=[];%allmod{i};
0085         mod(i).detrend=nan;
0086         mod(i).mode=nan;
0087         mod(i).mask=[];
0088     end
0089 end
0090 
0091 input=struct();
0092 input.fname=fname;
0093 input.fs_name=fs_name;
0094 input.mod=mod;
0095     
0096 prt_fs(PRT,input);
0097 
0098 out.fname{1} = fname;
0099 disp('Done.')
0100 end
0101 
0102 
0103 
0104 
0105

Generated on Mon 03-Sep-2012 18:07:18 by m2html © 2005