### Archive

Archive for the ‘nirs’ Category

## 3 ways to check NIRS data quality

August 31st, 2017

Before performing any data analysis, we should check the data quality first. Below are 3 ways to do so.

1. Visual check of the time series

The best pattern detector is our eyes and brains! In many cases, if we visually see the data, we know what is wrong. You may use the method and program in this post to plot the time courses of all channels (not just one).

Visual data quality check of NIRS time courses

In the plot above, all 48 channels are plotted together (the y-axis). We can clearly see two types of noise:

1. The spikes which occur in most channels after time point 7000. These spikes are caused by head motion.
2. The high noise level in the “red” channels (channels 39, 34, 31). This is more evident if we plot the variance of each channel (figure below). As we can easily see, the variance of channels 39, 34 and 31 is much higher than other channels.

Variance vs Channel

2. Existence of the “heart-beat” band

If the NIRS signal was acquired well, then the heart beating signal should be captured, leaving a bright brand in the frequency ~1Hz in the wavelet transform plot, just like the left plot in the figure below (the band close to period 8). If there is no such band, it does not necessarily mean the signal is trash, but you need to be cautious. To use the wavelet transform toolbox, please download here: http://www.alivelearn.net/?p=1561

NIRS wavelet

```Example:
figure;wt(hbo(:,1))```

3. Correlation between hbo and hbr

The third way is to check the correlation between hbo and hbr. They are supposed to have negative correlation, at least in young healthy subjects. If not, or if they have perfect negative correlation (-1), then they might contain too much noise. We have a separate article on this method. Please check out http://www.alivelearn.net/?p=1767

Correlation between oxy and deoxy-Hb

Below is the scripts used for the 3 methods.

```[hbo,hbr,mark]=readHitachData('SA06_MES_Probe1.csv');

figure;plotTraces(hbr,1:52,mark)

figure;wt(hbo(:,1))

for ii=1:52; wt(hbo(:,ii)); pause; end

Do you have other ways to check data quality? Please let me know!

Xu Cui Categories: Tags:

## [培训信息] 第一届近红外脑功能数据处理培训班 NIRS training course in China

August 23rd, 2017

1、培训简介

fNIRS信号的数据处理与fMRI和EEG/ERP等相比既有很多相同点也有很多其独有的方法。准确掌握fNIRS相关数据处理技能对于我们设计fNIRS实验、分析fNIRS数据至关重要。由于fNIRS技术专业性较强，需要系统的培训才能掌握，因此，我们拟举办fNIRS信号数据处理分析培训班，本培训班将在实验设计、数据分析方法原理以及常用开源软件操作等方面对学员展开系统培训，旨在帮助刚刚接触fNIRS技术的人员，如心理、运动科学、生物医学工程等专业研究生,精神、神经内外科、康复科、儿科等医生或临床科研人员及快速了解本领域及掌握fNIRS实验设计及编程、数据处理及分析的相关方法。

2、培训对象

 时间 课程名 主要内容 第一天 胡志善 10月16日 上午 fNIRS基本原理及实验设计 -fNRIS成像原理简介 -Block与Event实验设计及其变式 -fNIRS原始数据结构简介 -fNIRS设备信号调试技巧（根据授课进度穿插） 下午 SPM 操作及批处理流程 -NIRS SPM GUI界面介绍 -数据转换(data conversion) -通过GUI界面逐步处理过程（含数据转换conversion、选择GLM所需参数、滤波filter、去漂移detrending等） -通过脚本文件编写批处理程序 -数据结果的解释 第二天 张明明 10月17号 上午 多人脑间功能连接 数据分析原理 -傅里叶变换及小波分析原理 -小波相干分析原理 -格兰杰因果分析原理 下午 多人脑间功能连接 数据分析操作 -小波相干分析个体操作 -小波相干分析批处理操作 -格兰杰因果分析操作 第三天 王乾东 10月18日 上午 Homer软件数据处理基础 -NIRS一般数据处理步骤介绍 -Homer软件介绍 -通过Homer软件的GUI界面处理数据 下午 Homer软件数据处理进阶 -Matlab编程快速入门 -了解Homer处理的数据的结构与含义 -编写Matlab脚本更加自由地处理NIRS数据

4、培训人数

5、培训地点

6、培训费用

7、报名方式

8、缴费方式

9、联系方式

10、备注

 单位名称 （发票抬头） 姓名 性别 QQ 电话号码 科室/专业 缴费方式 □转帐  □支付宝 （请选择在□打√） 银行信息 户名：重庆思影科技有限公司 账号：123909127710102 开户银行：招商银行重庆分行渝中支行 汇款备注 第一届近红外脑功能数据处理培训班

11、在线支持服务

12、培训人员简介：

Xu Cui Categories: nirs Tags:

## A few recent NIH grants awarded related to NIRS (2017-07-05)

July 5th, 2017
The following email was sent from Stork to me. Stork is an easy-to-use app to alert me of new scientific publications and NIH grants based on my own keywords. Below are a few grants awarded in the NIRS field.
David Boas
Awarded Grants
Enabling
widespread use of high resolution imaging of oxygen in the brain
by
David A Boas (2017) NIH Grants Awarded (Amount: \$288,619) Duration: 2017-07-01 to
2018-06-30

fmri nirs

Awarded Grants
Mechanisms
of Interpersonal Social Communication: Dual-Brain fNIRS Investigation

by Joy Hirsch (2017) NIH Grants Awarded (Amount: \$416,250) Duration: 2017-06-01 to
2018-05-31

Multimodal
Neuroimaging of Cigarette Smoking
by Yunjie Tong (2017) NIH Grants
Awarded (Amount:
\$137,928)
Duration: 2017-06-19 to 2017-11-30

nirs brain

Awarded Grants
Neural
Mechanisms for Social Interactions and Eye Contact in ASD
by Joy
Hirsch (2017) NIH Grants Awarded (Amount: \$640,560) Duration: 2017-07-01 to 2018-06-30

Free
Surfer Development, Maintenance, and Hardening
by Bruce Fischl (2017)
NIH Grants Awarded (Amount: \$523,203) Duration: 2017-07-01 to 2018-06-30

Coherent
hemodynamics spectroscopy for cerebral autoregulation and blood flow
by
Sergio Fantini (2017) NIH Grants Awarded (Amount: \$517,756) Duration: 2017-05-01 to
2018-04-30

Training
in Drug Abuse and Brain Imaging
by Scott E Lukas (2017) NIH
Grants Awarded (Amount:
\$256,451)
Duration: 2017-07-01 to 2018-06-30

Xu Cui Categories: Tags:

## Hyperscanning experiment file (matlab)

June 8th, 2017

Below is the experiment script (in MatLab) for our hyperscanning project (”NIRS-based hyperscanning reveals increased interpersonal coherence in superior frontal cortex during cooperation.”). For detailed information please refer to http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3254802

Psychtoolbox-3 is required.

Xu Cui Categories: Tags:

May 12th, 2017

Facebook just announced that they are experimenting with mind-reading technology using optical neuro-imaging systems. This technology will allow people to type words by thoughts at 100 words per minute. Check out the news here.

Wow! This is unbelievable! The “optical neuro-imaging” technology is probably NIRS (Near Infrared Spectroscopy). As a NIRS researcher myself, I have done some mind-reading experiments and found NIRS signal (blood flow) is too slow for rapid mind-reading. With machine learning technology such as SVM, we can decode a signal at most ~2s after a behavior event (see our paper). This is still too far from a real life application.

But some researchers have suggested that there might be some subtle “fast signal” embedded in NIRS signal. In a 2004 (!) paper, Morren et al published a paper tilted “Detection of fast neuronal signals in the motor cortex from functional near infrared spectroscopy measurements using independent component analysis“. In this paper, they claimed that fast signal, in the range of milliseconds rather than seconds, can be detected.

Maybe this is what Facebook is using?

Xu Cui Categories: Tags:

## A few recent NIH grants awarded related to NIRS

April 25th, 2017

The following email was sent from Stork to me. Stork is an easy-to-use app to alert me of new scientific publications and NIH grants based on my own keywords. Below are a few grants awarded in the NIRS field.

Dear Xu,

Stork has brought you 15 new publications.

David Boas

Awarded Grants
Multifunctional, GBM-activatable nanocarriers for image-guided photochemotherapy by Huang-chiao Huang (2017) NIH Grants Awarded (Amount: \$179,035) Duration: 2017-04-01 to 2018-03-31

fmri nirs

Awarded Grants
Quantifying the Fluctuations of Intrinsic Brain Activity in Healthy and Patient Populations by Manish Saggar (2017) NIH Grants Awarded (Amount: \$249,000) Duration: 2017-03-20 to 2018-02-28

fmri resting state parent child

Awarded Grants
NEUROIMAGING IN EARLY ONSET DEPRESSION: LONGITUDINAL ASSESSMENT OF BRAIN CHANGES by Deanna M Barch (2017) NIH Grants Awarded (Amount: \$768,901) Duration: 2017-04-01 to 2018-03-31

hyperscanning

Awarded Grants
Brain-to-brain dynamical Coupling: A New framework for the communication of social knowledge by Uri Hasson (2017) NIH Grants Awarded (Amount: \$524,425) Duration: 2017-04-01 to 2018-03-31

nirs brain

Awarded Grants
The Neurodevelopmental MRI Database by John E Richards (2017) NIH Grants Awarded (Amount: \$61,625) Duration: 2017-04-01 to 2018-03-31

nirs breast

Awarded Grants
Longitudinal Assessment of Tumor Hypoxia in vivo Using Near-Infrared Spectroscopy by Bing Yu (2017) NIH Grants Awarded (Amount: \$399,062) Duration: 2017-01-01 to 2019-01-31

Russell Poldrack, stanford

Awarded Grants
Elucidate the Mechanisms Underlying Inhibition Induced Devaluation by Patrick Graham Bissett (2017) NIH Grants Awarded (Amount: \$59,466) Duration: 2017-04-01 to 2018-03-31

Xu Cui Categories: nirs Tags:

March 16th, 2017

Some labs have been using our script readHitachiData.m to load NIRS data from Hitachi ETG machines. We recently found that some output MES data contains abnormal timestamp. For example, the timestamp should be like

16:49:25.406

But for some rows (although rarely), the time is like (note the ending character)

16:49:25.406E

This will cause our script to choke. We just fixed this issue, and you need to replace loadHitachiText.m. The new version can be found here.

Xu Cui Categories: Tags:

## Chin rest (head holder) device for NIRS

January 30th, 2017

When we set up our NIRS lab back in 2008, we needed a device to prevent participants’ head movement during the experiment and during the digitizer measurement. Even though NIRS is tolerant to head motion, we still want to minimize it. During the digitizer measurement phase, the probe will poke the participants’ heads, resulting inaccurate probe position. We definitely need something to minimize it.

In addition, we feared that metal might interfere the magnetic positioning system (digitizer), so we wanted the device to be all-plastic.

We contacted Ben Krasnow , who has been very helpful in creating MRI compatible devices (e.g. keyboard) for Lucas Center @ Stanford in the past. He suggested us use University of Houston’s “headspot”.

Ben then replaced the metal part with plastics.

we have been using it for almost 10 years! It works great, as expected. The height is also adjustable. I recently checked the price and it is \$500, which is slightly higher than in 2008 (\$415), but not much different. Ben charged \$325 to replace the metal. The total (with tax) was \$774.

Xu Cui Categories: Tags:

## We contributed to MatLab (wavelet toolbox)

January 25th, 2017

We use MatLab a lot! It’s the major program for brain imaging data analysis in our lab. However, I never thought we could actually contribute to MatLab’s development.

In MatLab 2016, there is a toolbox called Wavelet Toolbox. If you read the document on wavelet coherence (link below), you will find that they used our NIRS data as an example:

https://www.mathworks.com/help/wavelet/examples/compare-time-frequency-content-in-signals-with-wavelet-coherence.html

Back in 2015/4/9, Wayne King from MathWorks contacted us, saying that they are developing the wavelet toolbox and asking if we can share some data as an example. We did. I’m glad that it’s part of the package now.

The following section are from the page above:

### Find Coherent Oscillations in Brain Activity

In the previous examples, it was natural to view one time series as influencing the other. In these cases, examining the lead-lag relationship between the data is informative. In other cases, it is more natural to examine the coherence alone.

For an example, consider near-infrared spectroscopy (NIRS) data obtained in two human subjects. NIRS measures brain activity by exploiting the different absorption characteristics of oxygenated and deoxygenated hemoglobin. The data is taken from Cui, Bryant, & Reiss (2012) and was kindly provided by the authors for this example. The recording site was the superior frontal cortex for both subjects. The data is sampled at 10 Hz. In the experiment, the subjects alternatively cooperated and competed on a task. The period of the task was approximately 7.5 seconds.

``` load NIRSData; figure plot(tm,NIRSData(:,1)) hold on plot(tm,NIRSData(:,2),'r') legend('Subject 1','Subject 2','Location','NorthWest') xlabel('Seconds') title('NIRS Data') grid on; hold off; ```

Obtain the wavelet coherence as a function of time and frequency. You can use `wcoherence` to output the wavelet coherence, cross-spectrum, scale-to-frequency, or scale-to-period conversions, as well as the cone of influence. In this example, the helper function `helperPlotCoherence` packages some useful commands for plotting the outputs of `wcoherence`.

``` [wcoh,~,F,coi] = wcoherence(NIRSData(:,1),NIRSData(:,2),10,'numscales',16); helperPlotCoherence(wcoh,tm,F,coi,'Seconds','Hz'); ```

In the plot, you see a region of strong coherence throughout the data collection period around 1 Hz. This results from the cardiac rhythms of the two subjects. Additionally, you see regions of strong coherence around 0.13 Hz. This represents coherent oscillations in the subjects’ brains induced by the task. If it is more natural to view the wavelet coherence in terms of periods rather than frequencies, you can use the ‘dt’ option and input the sampling interval. With the ‘dt’ option, `wcoherence` provides scale-to-period conversions.

``` [wcoh,~,P,coi] = wcoherence(NIRSData(:,1),NIRSData(:,2),seconds(0.1),... 'numscales',16); helperPlotCoherence(wcoh,tm,seconds(P),seconds(coi),... 'Time (secs)','Periods (Seconds)'); ```

Again, note the coherent oscillations corresponding to the subjects’ cardiac activity occurring throughout the recordings with a period of approximately one second. The task-related activity is also apparent with a period of approximately 8 seconds. Consult Cui, Bryant, & Reiss (2012) for a more detailed wavelet analysis of this data.

### Conclusions

In this example you learned how to use wavelet coherence to look for time-localized coherent oscillatory behavior in two time series. For nonstationary signals, it is often more informative if you have a measure of coherence that provides simultaneous time and frequency (period) information. The relative phase information obtained from the wavelet cross-spectrum can be informative when one time series directly affects oscillations in the other.

### References

Cui, X., Bryant, D.M., and Reiss. A.L. “NIRS-Based hyperscanning reveals increased interpersonal coherence in superior frontal cortex during cooperation”, Neuroimage, 59(3), pp. 2430-2437, 2012.

Grinsted, A., Moore, J.C., and Jevrejeva, S. “Application of the cross wavelet transform and wavelet coherence to geophysical time series”, Nonlin. Processes Geophys., 11, pp. 561-566, 2004.

Maraun, D., Kurths, J. and Holschneider, M. “Nonstationary Gaussian processes in wavelet domain: Synthesis, estimation and significance testing”, Phys. Rev. E 75, pp. 016707(1)-016707(14), 2007.

Torrence, C. and Webster, P. “Interdecadal changes in the ESNO-Monsoon System,” J.Clim., 12, pp. 2679-2690, 1999.

Xu Cui Categories: Tags:

## Communications between two MatLabs (1) over file

October 3rd, 2016

It’s common that two MatLab programs needs to communicate. For instance, one program is collecting the brain imaging data but not display them, and the other program is to display the data. (Another case is at http://www.alivelearn.net/?p=1265) Sometimes it is not practical to merge the two program together (e.g. to keep the code clean). In this case we can run two MatLabs simultaneously. One keeps saving the data to a file, and the other keep reading the file.

Here I played with such a setup, and find they communicate well with small delay (small enough for hemodynamic responses). Check out the video below:

```writeSomething.m

for ii=1:100
save('data','ii');
disp(['write ' num2str(ii)])
pause(1)
end```
```readSomething.m

last_ii = 0;
while(1)
try
if(ii ~= last_ii)
disp(['get data. i=' num2str(ii)])
end
last_ii = ii;
end
pause(0.1)
end```

Caveat: writing/reading to/from disc is slow. So if your experiment requires real time communication without any delay (say <1ms), this method may not work. Also, the amount of data to write/read each time should be very small, and the frequency of write should be small too. The file needs to locate in your local hard drive instead of a network drive.

Paul Mazaika from Stanford:
Cool piece of code! There may be a way to do this with one umbrella Matlab program that calls both components as subroutines. The potential advantage is that one program will keep memory in cache, not at disk, which can support rapidly updating information. For high speeds, it may be better to only occasionally update the graphical display, which otherwise may be a processing bottleneck.
-Paul

Aaron Piccirilli from Stanford:
There is, sort’ve! I think Xu’s little nugget is probably best choice for many applications, but if speed is an especially big concern then there are a couple of options that I’ve come across that will maintain some sort of shared memory.

Perhaps the easiest is to use sockets to communicate data, via UDP or TCP/IP, just like you use over the internet, but locally. You write some data to a socket in one program, and read it from that same socket in another program. This keeps all of your data in memory as opposed to writing it to disk, but there is definitely some overhead for housekeeping and to move the data from one program’s memory into the operating system’s memory then back into the other program’s memory. An added bonus here: you can communicate between different languages. If you have a logging function written in Python and a visualization program in MATLAB, they can pretty easily communicate with each other via sockets.

MATLAB doesn’t have explicit parallel computing built-in like many other languages, sadly, but we all have access here to the Parallel Computing Toolbox, which is another option for some more heavy-duty parallel processing where you have a problem you can easily distribute to multiple workers.

Finally, true shared memory might be more trouble than it’s worth for most applications, as you then have to deal with potential race conditions of accessing the same resource at the same time.

Aaron

More on this topic: Please continue to read Communications between two MatLabs (2): over socket

Xu Cui Categories: Tags: