% Batch script to process Subject Example Data using FieldMap Toolbox
% Data is available from http://www.fil.ion.ucl.ac.uk/spm/data/fieldmap/
%--------------------------------------------------------------------------
% Copyright (C) 2012 Wellcome Trust Centre for Neuroimaging

% Chloe Hutton
% $Id: SubjectExample_fieldmap_batch.m $

% Initialise SPM defaults
%--------------------------------------------------------------------------
spm('Defaults','fMRI');
spm_jobman('initcfg');
clear matlabbatch

% Set up FieldMap job
%--------------------------------------------------------------------------
matlabbatch{1}.spm.tools.fieldmap.presubphasemag.subj.phase = {'SubjectData/fieldmap/sMT0160-0013-00001-000001-02.nii,1'};
matlabbatch{1}.spm.tools.fieldmap.presubphasemag.subj.magnitude = {'SubjectData/fieldmap/sMT0160-0012-00001-000001-01.nii,1'};
matlabbatch{1}.spm.tools.fieldmap.presubphasemag.subj.defaults.defaultsfile = {'pm_defaults_SubjectExample.m'};
matlabbatch{1}.spm.tools.fieldmap.presubphasemag.subj.session(1).epi = {'SubjectData/epi_run1/fMT0160-0014-00002-000002-01.nii,1'};
matlabbatch{1}.spm.tools.fieldmap.presubphasemag.subj.session(2).epi = {'SubjectData/epi_run2/fMT0160-0015-00002-000002-01.nii,1'};
matlabbatch{1}.spm.tools.fieldmap.presubphasemag.subj.matchvdm = 1;
matlabbatch{1}.spm.tools.fieldmap.presubphasemag.subj.sessname = 'session';
matlabbatch{1}.spm.tools.fieldmap.presubphasemag.subj.writeunwarped = 1;
matlabbatch{1}.spm.tools.fieldmap.presubphasemag.subj.anat = {'SubjectData/anatomy/stripped_sMT0160-0005-00001-000176-01.nii,1'};
matlabbatch{1}.spm.tools.fieldmap.presubphasemag.subj.matchanat = 1;

% Run job
%--------------------------------------------------------------------------
spm_jobman('run',matlabbatch);
