Saturday, September 10, 2011

Helped Hisako (a former colleague) with MEG data analysis problem

 yw_ft_test('01061792_EPI-SHORT-4KHz_20080317_47_60_03.ds',48,58,30,70,'MLT22');

processing channel { 'MLC11' 'MLC12' 'MLC13' 'MLC14' 'MLC15' 'MLC16' 'MLC17' 'MLC21' 'MLC22' 'MLC23' 'MLC24' 'MLC25' 'MLC31' 'MLC32' 'MLC41' 'MLC42' 'MLC51' 'MLC52' 'MLC53' 'MLC54' 'MLC55' 'MLC61' 'MLC62' 'MLC63' 'MLF11' 'MLF12' 'MLF13' 'MLF14' 'MLF21' 'MLF22' 'MLF23' 'MLF24' 'MLF25' 'MLF31' 'MLF32' 'MLF33' 'MLF34' 'MLF35' 'MLF41' 'MLF42' 'MLF43' 'MLF44' 'MLF45' 'MLF46' 'MLF51' 'MLF52' 'MLF53' 'MLF54' 'MLF55' 'MLF56' 'MLF61' 'MLF62' 'MLF63' 'MLF64' 'MLF65' 'MLF66' 'MLF67' 'MLO11' 'MLO12' 'MLO13' 'MLO14' 'MLO21' 'MLO22' 'MLO23' 'MLO24' 'MLO31' 'MLO32' 'MLO33' 'MLO34' 'MLO41' 'MLO42' 'MLO43' 'MLO44' 'MLO51' 'MLO52' 'MLO53' 'MLP11' 'MLP12' 'MLP21' 'MLP22' 'MLP23' 'MLP31' 'MLP32' 'MLP33' 'MLP34' 'MLP35' 'MLP41' 'MLP42' 'MLP43' 'MLP44' 'MLP45' 'MLP51' 'MLP52' 'MLP53' 'MLP54' 'MLP55' 'MLP56' 'MLP57' 'MLT11' 'MLT12' 'MLT13' 'MLT14' 'MLT15' 'MLT16' 'MLT22' 'MLT23' 'MLT24' 'MLT25' 'MLT26' 'MLT27' 'MLT31' 'MLT32' 'MLT33' 'MLT34' 'MLT35' 'MLT36' 'MLT37' 'MLT41' 'MLT42' 'MLT43' 'MLT44' 'MLT45' 'MLT46' 'MLT47' 'MLT51' 'MLT52' 'MLT53' 'MLT54' 'MLT55' 'MLT56' 'MLT57' 'MRC11' 'MRC12' 'MRC13' 'MRC14' 'MRC15' 'MRC16' 'MRC17' 'MRC21' 'MRC22' 'MRC23' 'MRC24' 'MRC25' 'MRC31' 'MRC32' 'MRC41' 'MRC42' 'MRC52' 'MRC53' 'MRC54' 'MRC55' 'MRC61' 'MRC62' 'MRC63' 'MRF11' 'MRF12' 'MRF13' 'MRF14' 'MRF21' 'MRF22' 'MRF23' 'MRF24' 'MRF25' 'MRF31' 'MRF32' 'MRF33' 'MRF34' 'MRF35' 'MRF41' 'MRF42' 'MRF43' 'MRF44' 'MRF45' 'MRF46' 'MRF51' 'MRF52' 'MRF53' 'MRF54' 'MRF55' 'MRF56' 'MRF61' 'MRF62' 'MRF63' 'MRF64' 'MRF65' 'MRF66' 'MRF67' 'MRO11' 'MRO12' 'MRO13' 'MRO14' 'MRO21' 'MRO22' 'MRO23' 'MRO24' 'MRO31' 'MRO32' 'MRO33' 'MRO34' 'MRO41' 'MRO42' 'MRO43' 'MRO44' 'MRO51' 'MRO52' 'MRO53' 'MRP11' 'MRP12' 'MRP21' 'MRP22' 'MRP23' 'MRP31' 'MRP32' 'MRP33' 'MRP34' 'MRP35' 'MRP41' 'MRP42' 'MRP43' 'MRP44' 'MRP45' 'MRP51' 'MRP52' 'MRP53' 'MRP54' 'MRP55' 'MRP56' 'MRP57' 'MRT11' 'MRT12' 'MRT13' 'MRT14' 'MRT15' 'MRT16' 'MRT21' 'MRT22' 'MRT23' 'MRT24' 'MRT25' 'MRT26' 'MRT27' 'MRT31' 'MRT32' 'MRT33' 'MRT34' 'MRT35' 'MRT36' 'MRT37' 'MRT41' 'MRT42' 'MRT43' 'MRT44' 'MRT45' 'MRT46' 'MRT47' 'MRT52' 'MRT53' 'MRT54' 'MRT55' 'MRT56' 'MRT57' 'MZC01' 'MZC02' 'MZC03' 'MZC04' 'MZF01' 'MZF02' 'MZF03' 'MZO01' 'MZO02' 'MZO03' 'MZP01' }
reading and preprocessing
reading and preprocessing trial 1 from 1
the input is raw data with 272 channels and 1 trials
processing trials
trial 1, frequency 1 (30.00 Hz), 1 tapers
trial 1, frequency 2 (35.00 Hz), 1 tapers
trial 1, frequency 3 (40.00 Hz), 1 tapers
trial 1, frequency 4 (45.00 Hz), 1 tapers
trial 1, frequency 5 (50.00 Hz), 1 tapers
trial 1, frequency 6 (55.00 Hz), 1 tapers
trial 1, frequency 7 (60.00 Hz), 1 tapers
trial 1, frequency 8 (65.00 Hz), 1 tapers
trial 1, frequency 9 (70.00 Hz), 1 tapers
reading layout from file CTF275.lay



function yw_ft_test(ds,begt,endt,lowfq,highfq,chanindx)
% Frequency analysis script sample for Hiskao
%---------------------------------------------------------------
% Copyright (C) 2011 Pediatric Neuroimage Research Center (PNRC)
% Last Modified by Yingying Wang 09-Sep-2011 14:30:00
% Contact information: yingying.wang@cchmc.org
% Phone: 513-636-3495
% Any comments and bug reports are very welcome
% Advisor: Dr. Scott K. Holland
%----------------------------------------------------------------
% How to use it
% For example, your data folder is c:\data\patient01.ds
% put this yw_ft_test.m file in the same folder with patient01.ds
% under c:\data\
% make sure that you change current work path to the c:\data\
% then run yw_ft_test with required variables
% ds: data folder ds name
% begt: start time in second
% endt: end time in second
% lowfq: low frequency limit
% highfq: high frequency limit
% chanindx: single channel you want to plot

% Reference: http://fieldtrip.fcdonders.nl/tutorial/timefrequencyanalysis
% http://fieldtrip.fcdonders.nl/reference/freqanalysis

% check input parameters, none or too many, pop out Error messages
if nargin ~= 6
  fprintf(['Oops, you forgot someting! \n',...
    'function illustration: yw_ft_test(ds,lowfreq,hifreq,startt,endt) \n',...
    'ds: Name of the dataset folder. e.g. patient01.ds \n',...
    'begt: start time in second \n',...
    'endt: end time in second \n',...
    'lowfq: low frequency limit \n',...
    'highfq: high frequency limit \n',...
    'chanindx: single channel you want to plot \n',...
    'This function generate the frequency plot for you. \n\n']);
  return
end

% get MEG data
% find the interesting segments of data
cfg = [];               % empty configuration
cfg.dataset = ds;
cfg.channel = 'MEG';    % defaults: read all MEG channels
% you can change this line to cfg.channel = 'gui'
% then a window will pop up and you can choose your channel
% graphic interface for channel selections
cfg.continuous  = 'yes';
dataFIC = ft_preprocessing(cfg);

% frequency analysis
cfg              = [];
cfg.output       = 'pow';
cfg.method       = 'mtmconvol';
cfg.taper        = 'hanning';
cfg.foi          = lowfq:5:highfq;
cfg.t_ftimwin    = 7./cfg.foi;  % 7 cycles per time window
cfg.toi          = begt:0.2:endt;
TFRhann7 = ft_freqanalysis(cfg, dataFIC);


% display the whole sensor space
cfg              = [];
cfg.xlim         = [begt endt];
cfg.ylim         = [lowfq highfq];
cfg.layout       = 'CTF275.lay';
figure(1);
ft_multiplotTFR(cfg, TFRhann7);

% display one channel
cfg              = [];
cfg.xlim         = [begt endt];
cfg.ylim         = [lowfq highfq];
cfg.channel      = chanindx;
figure(2);
ft_singleplotTFR(cfg, TFRhann7);

end

1 comment: