InterpolateData - Meg Wiki

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment
WHat wOrd is made by the captiaL lettErs?

Revision 5 as of 2009-03-16 19:57:27

location: InterpolateData

Interpolate MEG data to standard sensor array

This Matlab script will interpolate data to a standard sensor array

Maxfilter options:

maxfilter -f %s -o %s -trans %s -v -frame head -origin 0 0 45 -force -ctc /neuro/databases/ctc/ct_sparse.fif -cal /neuro/databases/sss/sss_cal.dat


% For files specified in cell array "files{}", apply maxfilter with -trans
% option in order to interpolate data to sensor array specified in "trans_file"
% originall file names will be appended by "_t", or by whatever is specified in "t_ext"
% for each transed file, a log-file with maxfilter output will be created ("*.log")
% OH, March 2009

addpath /opt/mne/matlab/toolbox/;   % fiff read/write tools

if exist('files')~=1,   % you can pre-specify a list of files here
    files = {'/fullpath/file4subj1.fif', ...
             '/fullpath/file4subj2.fif', ...
             '/fullpath/file4subj3.fif'};
end;

if exist('t_ext')~=1,   % suffix for filenames of transed files
    t_ext = '_t';
end;

if ~exist(trans_file, 'file'),
    fprintf(1, 'Cannot proceed without trans_file %s\n', trans_file);
    return;
end;
trans_data = fiff_read_evoked( trans_file );     % read fiff-file with standard sensor geometry

nr_files = length(files);

for ff = 1:nr_files,     % for each input file, apply maxfilter -trans, then reinsert digitiser points
    in_file = files{ff};
    [thispath, thisfile,thisext,thisversn] = fileparts(in_file);
    out_file = fullfile(thispath, [thisfile t_ext thisext]);
    log_file = fullfile(thispath, [thisfile t_ext '.log']);

    % maxfilter -trans...
    eval(sprintf('!/neuro/bin/util/maxfilter -f %s -o %s -trans %s -v -frame head -origin 0 0 45 -force -ctc /neuro/databases/ctc/ct_sparse.fif -cal /neuro/databases/sss/sss_cal.dat | tee %s', in_file, out_file, trans_file, log_file));
    
    % reinsert digitiser points...
    data = fiff_read_evoked( out_file );        % read invidual data file with data interpolated to standard sensor geometry
    data.info.dig = trans_data.info.dig;        % insert digitised points from standard geometry to interpolated data set
    fiff_write_evoked( out_file, data );    % write interpolated data back to fiff-file
end;