Home > eeg > egis > egis_file_utils > artifact_edit.m

artifact_edit

PURPOSE ^

ses_mask=artifact_edit(fname, fhdr, chdr)

SYNOPSIS ^

function [ses_mask] = artifact_edit(fname, fhdr, chdr, edit_file_type)

DESCRIPTION ^

  ses_mask=artifact_edit(fname, fhdr, chdr)
  
  Performs artifact editting of choice, according to the
  proper edit_file_type.  Current options are:
          0)  Edit codes files as written by MacAverager
        1)    Ramesh's MYSTERY format
        n)     YOUR format

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ses_mask] = artifact_edit(fname, fhdr, chdr, edit_file_type)
0002 %  ses_mask=artifact_edit(fname, fhdr, chdr)
0003 %
0004 %  Performs artifact editting of choice, according to the
0005 %  proper edit_file_type.  Current options are:
0006 %          0)  Edit codes files as written by MacAverager
0007 %        1)    Ramesh's MYSTERY format
0008 %        n)     YOUR format
0009 
0010 %  Modification history
0011 %        Started July 7, 1995 by Ramesh Srinivasan and Petr Janata
0012 %
0013 %  MYSTERIES:see bad_channels_and_bad_trials in matlab directory
0014 
0015 disp(['Starting edit code reading']);
0016 ses_hdr_offsets_v; ave_hdr_offsets_v;
0017 
0018 % Edit Code File Types
0019 EDC = 0; MYSTERY = 1;
0020 if nargin < 4
0021 disp('Possible edit code file types are: ');
0022 disp('  0) Edit codes files as written by MacAverager')
0023 disp('  1) MYSTERY format')
0024 edit_file_type = input('Select one: ')
0025 end % if nargin < 4
0026 
0027 if edit_file_type == EDC
0028  ses_mask = read_edc([fname '.edc'], fhdr, chdr);
0029 
0030 elseif edit_file_type == MYSTERY
0031 
0032 mys_fname = [fname '.mys'];
0033 mys_fid = fopen(mys_fname, 'r');
0034 ses_mask = zeros(sum(chdr(:,NTrials)), fhdr(NChan));
0035 ses_mask = fread(mys_fid, [sum(chdr(:,NTrials)), fhdr(NChan)], 'int8');
0036 
0037 
0038 
0039 
0040 
0041 end
0042 
0043 
0044 ses_mask(:, fhdr(NChan) + 1) = ones(sum(chdr(:, NObs)), 1);
0045 
0046 %replace average reference column in those rows that contain all
0047 %zeros except for the avg. ref. column with zeros
0048 %
0049 replace_indices = find(sum(ses_mask') == 1)';
0050 ses_mask(replace_indices, fhdr(NChan) + 1) = zeros(length(replace_indices),1);
0051

Generated on Sun 25-Aug-2019 04:00:39 by m2html © 2003