NIRS data analysis (time series)

1 min read

[last updated: 2009/06/15]

Also check out NIRS data analysis (GLM and visualization)

Environment requirement

  1. MatLab
  2. SPM
  3. xTopo under xjView
    xjview is located in /fs/fmrihome/fMRItools/Xjview
    Add xjview to path by addpath(genpath('/fs/fmrihome/fMRItools/Xjview'))
    xTopo is based on topo program provided by Hitachi. It is modified by me. You can download xTopo at https://www.alivelearn.net/nirs/xtopo.zip

Preparation

  1. convert NIRS data file to csv format using ETG4000 program.
  2. copy the 3D positioning data (00X.pos).
  3. If you don’t have 3D positioning data, you may use the template channel positions located in xjview/nirs_data_sample/?x??.pos

Procedure

  1. In MatLab command window, run topo
  2. Click button “Data Load” and select the data csv file. You only need to select the 1st (or left) file if you use 4×4 or 3×5 bilateral configurations. After a pause you will find the data information (such as subject name and marker timing etc)
  3. To view the overall time series, click button “Continuous Hb”. You will see the HbO, HbR and total traces for each channel. Colorful vertical lines indicates marker timing. To see more detailedly the trace of a certain channel, enter the channel number in CH box and click button “Zoom”.

  4. To see activation in a topographic view, click on any channel. You can also see the animation by click button “Play”.
  5. To see activation in 3D topo, in xTopo main window click “3D Topography”. You need to select the ???.pos file. You can rotate the brain.
  6. To average time series across trials, you need to select the markers (event) you are interested in (by clicking button “Select Mark”) and input proper parameters for Pre time, relax time and post time, then click either button “Integral Hb” or “cuixu Integral Hb” (I will explain the difference later).
  7. You can also zoom, plot topo, 3D topo like what you do for continuous time series.

Explanations

  1. The difference between “Integral Hb” (IH) and “cuixu Integral Hb” (cH):
    IH: cut and collect the time series for each occurence of the event. Then do detrending based on pre time and post time for each individual time series. Finally average across occurences. Both pre and post time parameters are important.
    cH: Do detrending/smoothing with filter pass for the entire time series first, then cut and collect the time series for each occurence, then average. Pre time, relax time and post time is used when cutting the time series. The data used is from (Pre time) seconds before event onset, to (Relax + Post time) seconds after onset.  Relax and Post time are not that important. As long as the sum is the same, the result won’t change.
  2. Obtaining the data used in plot: You will find a variable called hb_data in the workspace. It contains the data used to plot. It’s an array. The 1st one is for probe set 1, 2nd for set 2. raw means raw data and fil means filtered data. The first dimension is hb species (oxy, dxy and total), second is time, 3rd is channel.

>> hb_data(1)

ana_mode: 2
calc_flg: 2
raw: [3x251x24 double]
fil: [3x251x24 double]



写作助手,把中式英语变成专业英文


Want to receive new post notification? 有新文章通知我

第五十四期fNIRS Journal Club通知2024/07/27, 10am 黄鑫

电子烟作为一种新型的尼古丁输送装置,常以安全健康、有助于戒烟的形象出现在公众视野中,使得大批消费者转而投入到此类产品的怀抱中。然而,相关研究却仍存较大短板,深入了解电子烟对行为与脑功能活动的影响将更好
Wanling Zhu
10 sec read

第五十三期fNIRS Journal Club视频 李洪

Youtube: https://youtu.be/czyJTrXhees优酷:https://v.youku.com/v_show/id_XNjQwNjc5OTk0OA==.html 个体在处理不同
Wanling Zhu
12 sec read

第五十三期fNIRS Journal Club通知2024/06/22, 10am 李洪

个体在处理不同记忆负荷信息时会表现出一定的行为差异。作为一项新兴指标,瞬时脑信号变异性能够揭示个体内部因任务需求不断变化而进行的神经资源分配,从而为了解大脑如何适应和处理不同复杂程度的信息提供了新的见
Wanling Zhu
8 sec read

13 Replies to “NIRS data analysis (time series)”

  1. I’m struggling to get your code running an Matlab 2010a. SPM is installed and in the path, as is xjview.m. yet I see this error:
    ??? Undefined function or method ‘passfilter’ for input arguments of type ‘double’.

    Error in ==> cuixu_calc_int at 175
    dsignal = passfilter(continuous_data(p_cnt).raw(1,:,hb_ch), [0.3 0.01],
    10);

    ??? Error while evaluating uicontrol Callback

    where does passfilter come from? Do I need any other packages installed? Any hints?

  2. passfilter function is not included in the public version of xjview. Here is the function:

    function y = passfilter(x, threshold, samplingFrequency)
    % function y = passfilter(x, threshold, samplingFrequency)
    % low or/and high pass filter
    %
    % x: orginal signal
    % threshold: the frequency thresholds. It should be an array of length 2.
    % The first component corresponds to the low pass filter threshold and the
    % 2nd one corresponds to the high pass threshold. If you don’t want to
    % set the threshold, put nan.
    % samplingFrequency: the sampling frequency of the original signal x.
    % Default 10 Hz
    %
    % y: the result signal
    %
    % Note: this script needs signal toolbox
    %
    % Example:
    % y=humps([0:.01:1])+randn(1,101)*10;
    % figure;plot(y)
    % hold on; plot(passfilter(y, [0.5, nan], 10), ‘r’)
    %
    % Xu Cui
    % 2007-10-02

    if nargin < 2 error('At least two arguments are required.'); end if nargin < 3 samplingFrequency = 10; end if ~isfinite(threshold(1)) && ~isfinite(threshold(2)) y = x; return end if isfinite(threshold(1)) && isfinite(threshold(2)) [b,a]=ellip(4,0.1,40,[threshold(2) threshold(1)]*2/samplingFrequency); elseif isfinite(threshold(1)) [b,a]=ellip(4,0.1,40,[threshold(1)]*2/samplingFrequency); elseif isfinite(threshold(2)) [b,a]=ellip(4,0.1,40,[threshold(2)]*2/samplingFrequency, 'high'); end y = filtfilt(b,a,x); return

  3. thanks for the passfilter function. it seems though there are some more functions missing (now choking on ellip and Maximize).
    Also there is a little glitch when running on a Unix system (case-sensitive filesystem) – in input_para.m you try to fopen a file ‘ALL_E_coef.txt’ but after unziping xtopo.zip it is called All_E_coef.txt (lower case Ls).
    Do you plan on releasing an xjview version that has the needed functions?
    Thanks again for your help!

  4. I am trying to load my data sampled from fNIRS machine which has .csv

    However each time I try it, I get this error :

    Error in load_ad_etg7000 (line 25)
    load_flg = 0;

    Output argument “ad_data” (and maybe others) not assigned during call to
    “C:\Users\AhmetCakir\Desktop\MRes\SPM8\cuixuTSP\load_ad_etg7000.m>load_ad_etg7000”.

    Error in load_ad (line 81)
    [info, ad_data, mark,para,para_p] =
    load_ad_etg7000(fname,MainFigure,para,para_p,para_h,dis_no);

    Error in OnDataLoad (line 64)
    [info,ad_data,mark,para,para_p] =
    load_ad(strcat(pname,fname),MainFigure,para,para_p,para_h,dis_no);

    Error while evaluating uicontrol Callback

    I cannot understand why I have this error.

    I have cross checked it with the sample data that you have provided and could not see any differences. Could you please let me know why I am getting this kind of error ?

    Thanks

  5. I created the csv file from the Hitachi’s own program. I remembered that once I tried to change the csv file and then it failed. So I guess you have to create the csv in Hitachi’s way.

  6. I have problems with fileOut, it doesn’t save measurements data into the file. Only the information about subjects.
    any ideas?
    thanks

  7. Hi Dr. Xu Cui,

    I wonder if you have a paper reference for your “cuixu Integral Hb”?

    Thanks,
    Guoqing

  8. Excuse me,
    May I ask how do you create the .pos file in your sampling data?
    Which instrument(Ex: ISOTRAK II) and software(Ex: Brainstorm) did you use to create the .pos file?
    Thanks for replying

Leave a Reply

Your email address will not be published. Required fields are marked *