% Tim Tierney's original code modified by Gareth Barnes
R = cfg_files;
R.tag = 'R';
R.name = 'OPM to ADC file (specific to OPM connections to hardware)';
R.filter = 'txt';
R.num = [1 1];
R.help = {'Select the recording set up file- this file contains a list of OPM channel names and which binary data (eg labview) channels they were linked to'};
C = cfg_files;
C.tag = 'C';
C.name = 'Scanner-cast file (specific to specific subject and scanner-cast)';
C.filter = 'txt';
C.num = [1 1];
C.help = {'Select the scanner cast defining file- this file contains positions and orientations of OPMs in native MRI coords, along with a list of names for the slots'};
RC = cfg_files;
RC.tag = 'RC';
RC.name = 'OPM to cast file';
RC.filter = 'txt';
RC.num = [1 1];
RC.help = {'Select the file which shows which OPM channels were in which scanner-cast slots'};
M = cfg_files;
M.tag = 'M';
M.name = 'Native space MRI of subject';
M.filter = {'nii','img'};
M.num = [1 1];
M.help = {'The native space MRI for this subject'};
fid = cfg_entry;
fid.tag = 'fid';
fid.name = 'Fiducial points in MRI [nas;lpa;rpa] in mm';
fid.strtype = 'r';
fid.num = [3 3];
fid.help = {'Enter approx fiducial points from native space mri in format [nas;lpa;rpa] (mm) (these will be saved in a BIDs format file for later)'};
L = cfg_files;
L.tag = 'lbv';
L.name = 'Binary file containing raw OPM data';
L.filter = {'lvm','dat'};
L.num = [1 1];
L.help = {'Select the labview or binary data file containing the raw data. '};
binind = cfg_entry;
binind.tag = 'binind';
binind.name = 'Binary data channel indices';
binind.strtype = 'r';
binind.num = [1 Inf];
binind.help = {'Data channel indices in binary file'};
% Trigger channels
convert = cfg_entry;
convert.tag = 'convert';
convert.name = 'Conversion from ADC units to Tesla';
convert.strtype = 'r';
convert.num = [1 1];
convert.help = {'Conversion from ADC units to T (typically 1e6/2.7)'};
convert.val= {1e6/2.7};
% Trigger channels
trigs = cfg_entry;
trigs.tag = 'trigind';
trigs.name = 'Trigger channel indices';
trigs.strtype = 'r';
trigs.num = [1 Inf];
trigs.help = {'Trigger channel indices in binary file'};
prefix = cfg_entry;
prefix.tag = 'prefix';
prefix.name = 'Output prefix';
prefix.strtype = 's';
prefix.help = {'prefix for SPM object'};
prefix.val= {'OPM'};
band = cfg_entry;
band.tag = 'band';
band.name = 'Filter unepoched data to';
band.strtype = 'r';
band.num = [2 1];
band.help = {'Frequency band in Hz (2nd order butterworth, 2 way)'};
epwin = cfg_entry;
epwin.tag = 'epwin';
epwin.name = 'Time window around triggers (ms)';
epwin.strtype = 'r';
epwin.num = [2 1];
epwin.help = {'Epoch window relative to triggers'};
ncan = cfg_entry;
ncan.tag = 'ncan';
ncan.name = 'reference noise cancellation';
ncan.strtype = 'r';
ncan.num = [2 1];
ncan.val = { [ 1 1] };
ncan.help = {'Flags (0 or 1) for reference noise cancellation. [1 0] use reference derivatives; [ 0 1] use global signal; [1 1] use both'};