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$
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 % Check for multimodal MKL flag
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 % maskchos = {job.mask(:).mod_name};
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         %mod(i).detrend=job.modality(ind).detrend;
0051         %mod(i).param_dt=job.modality(ind).param_dt;
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 %         if isempty(indm)
0080 %             error(['No mask selected for ',allmod{i}])
0081 %         else
0082 %             mod(i).mask=char(job.modality(indm).fmask);
0083 %         end
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=[];%allmod{i};
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

Generated on Tue 10-Feb-2015 18:16:33 by m2html © 2005