Author Archive

6 experiments you should do with NIRS (vs fMRI)

February 19th, 2019

[last update: 2019-02-20]

Let’s be frank. Compared to fMRI, NIRS has a number of intrinsic weaknesses. The signal to noise ratio is lower, the spatial resolution is (10x) lower, it can’t measure the deep brain, and it only covers a portion of the brain surface. As a result, fMRI, when possible, is still the preferred method to elucidate brain mechanisms. So if we do use NIRS, we’d better do experiments fMRI can’t, or at least very difficult to, do.

Below are 6 experiments NIRS can do, but fMRI can’t (or difficult to do):

  1. Study of the mechanism of BOLD signal
    1. Study of the relationship between oxygenated and deoxygenated hemoglobin concentration
      For a given voxel, fMRI only gives you a single number at a time. The number (BOLD signal) depends on many factors. On the other hand, NIRS can give you two numbers, the concentrations of both oxygenated and deoxygenated hemoglobin. So if you ever want to study the relationship between them, we should use NIRS. For an example, please check out
    2. Study of the fine temporal change of BOLD signal
      In most fMRI settings the temporal resolution of BOLD signal is low (about 2 seconds, or 0.5Hz). That means we only get a number every two seconds. If we want to know the rise and fall of the BOLD signal in much higher temporal resolution, e.g. 10Hz, then NIRS would be a good choice.
  2. Study in naturalistic settings
    If you ever participate in a fMRI study, you will feel the room far from friendly. The scanner is loud, and it looks scary. During the entire experiment, you are lonely inside the confined space. You can’t move, can’t talk (for most experiments), and feel guilty when you swallow saliva as the experimenter probably told you in advance that any motion might distort the signal. What you often see is much simple visuals (such as blocks and circles) on a computer screen. Do we live such a life in reality? On the contrary, NIRS is small, even portable, and can be used in a naturalistic environment.

    1. Sports and exercise
      As long as the optodes are attached to the head nicely to ensure proper signal collection, the participants can move freely. NIRS has been used in a number of sports or exercises studies such as running, squatting, biking, ping-pong, piano playing, and stretching etc. Be sure to check out the videos in

    2. Face to face communication
      You might see other people’s face on a screen in fMRI, but with NIRS, you can see a real face. We humans are fundamentally social, and to study social behavior in a naturalistic environment is important. NIRS allows you to study face-to-face gaming (video or board), talking, brain storming, cooperation or competition, etc. For example, in one of our studies ( participants played a video game together. my colleague Ning Liu et al has an experiment when two people play Jenga games (
    3. Study in a moving environment
      Many NIRS devices are small enough so you can carry it in a car or even a backpack. That means you can study the driver’s brain when he is actually driving! An example would be
  3. Hyperscanning
    fMRI can be used in hyperscanning studies, and in fact the first hyperscanning is done with fMRI by my former advisor Dr Montague ( However, seeing it with first hand, I know hyperscanning with fMRI is technically challenging. You need two fMRI scanners, each costs a few million dollars; and you also need to synchronize them. On the other hand, many NIRS devices are able to do hyperscanning natually. For example, when we used ETG 4000, we simply use one patch on one participant and the other on another participant. It does not add complexity on the hardware part.
    To date there are a number of hyperscanning studies with NIRS. For a list, please refer to If you are patient enough to scroll to the last page, you will find our paper!
  4. Real time (feedback), brain computer interface
    Let’s say you want your participants to move a bar in a computer game mentally (brain computer interface), or you provide a real time neural feedback to your participants to improve cognitive function, in both cases you need the brain signal in real time.  fMRI can do this too, but first you will need to get the data in real time, and second, due to poorer time resolution (2s), there will be some lag. Many NIRS devices allows you to get the measured signal out without delay, and of course the temporal resolution of NIRS is typically much higher (e.g. 10Hz). An recent example can be found at
    Some may argue that higher temporal resolution is not that useful because the BOLD signal is already slow (usually 4-6s from onset to peak). However, with finer temporal resolution, we can use algorithms (e.g. machine learning) to detect signal with much smaller delay. For example, in one of our studies the delay can be reduced by 50% (
  5. Field studies, large scale studies
    You can’t carry an fMRI scanner around for sure, but with NIRS’ portability, you can collect neural data in the field. My colleague Dr Baker took a NIRS device to the rural places in Costa Rica, and scanned the local farmers. Check out his paper.

    In addition, since you may carry NIRS devices around, you can scan a lot of participants, e.g. a few hundred or even thousand. Imagine you are to study the brain and cognitive development of children in rural areas in China in a large scale (say 10,000 participants), then NIRS will become your top choice.
  6. Study on special participants
    Due to safety reason, the following people should not do fMRI experiments (source):

    1. with shrapnel or other metal or electronic implants in their bodies (such as pacemakers, aneurysm clips, surgical devices, metallic tattoos on the head, etc.)
    2. pregnant
    3. with a history of head trauma or fainting
    4. currently using sleeping aids, painkillers (including aspirin), or other agents known to affect brain function (for instance, antihistamines, decongestants, etc.)
    5. with major medical, neurological, or psychological disorders (including depression, generalized anxiety, panic attacks, AD(H)D, strokes, tumors, heart conditions, claustrophobia, etc.)

    In addition to this list, fMRI is also not friendly to infants (but still can be done in fMRI). In contrast, NIRS does not have issues with the participants in the list. Imagine you can do an experiment on claustrophobia with NIRS, but probably not with fMRI.

So, what is the ideal experiment with NIRS? Based on the above list, if one is to use hyperscanning to study the face-to-face communication when two claustrophobia participants are running together along a mountain trail, I would say it’s pretty hard for fMRI to catch on.
Author: Xu Cui Categories: brain, nirs Tags:

New Mac OSX Mojave on old Mac

January 31st, 2019

Back in 2009, When I got my first MacBook Pro I was excited. It had the best configuration at that time (8G memory and 250G storage - SSD!). I still use it today.

As I am developing Stork’s mobile app, I need to use the latest xcode. But Apple does not allow me to upgrade to its latest OSX, apparently my computer is too old.

So I found this webpage with detailed instructions on how to install new OSX to old Mac. The guy is a genius. It worked perfectly. What you need is a USB drive (16G or bigger). Then just follow the steps. The link is:

(click the image below to enlarge)

Author: Xu Cui Categories: technology, web Tags:

Mac on Windows?

January 30th, 2019

If you need to play with Mac OSX but do not own a Mac computer, you might wish you could install Mac OSX on your Windows 10 computer as a virtual machine. Luckily I found this useful webpage with detailed instructions on how to do it. The link also provides a download link of the macOS Mojave image file.

The webpage is at

With the instruction I was able to run Mac OSX Mojave successfully on my Windows 10 via VirtualBox. In the beginning the mouse/keyboard does not work, so I followed another link: which solved the problem.

During Mac OSX setup I also encountered the apple ID login issue. In the end I did not sign in my apple ID during the setup phase - I created a local account instead.

Currently the resolution seems to be low, resulting in a rather small window for Mac OSX. I do not know how to fix it yet. update 2019-02-01 Found a way to fix. In command line window, run the following command:

cd "C:\Program Files\Oracle\Virtualbox"
VBoxManage setextradata "Mac OSX Mojave" VBoxInternal2/EfiGraphicsResolution 1920x1080

Click the image below to zoom in:

Author: Xu Cui Categories: technology, web Tags:

fNIRS中基线的做法和注意事项 (Baseline in fNIRS)

November 5th, 2018

This article is a guest post by Rui Chen. An English version can be downloaded here









现在使用近红外光来对大脑的研究,利用了近红外光在大脑组织中血红蛋白对光的特性,近红外光进入大脑组织大部分的吸收是由血红蛋白引起的,这就是为什么我们可以利用NIRS进行测量的原因。然而,光也会被其他组织(例如脂肪组织,毛发,皮肤、颅骨、脑积液等无关组织)吸收,但这是无法避免的。所以,我们假设在测量期间这种吸收是恒定的,并且接收光的任何变化都是由血红蛋白吸收的变化引起的。既然血红蛋白发生了变化,那么就会存在“起始状态”,对于CW-NIRS使用探测器接收到近红外光的变化,根据Mod Beer-Lambert定律来计算血红蛋白浓度的变化,那么,对于这个变化来说总是相对于“起始状态”或基线的。

CW-NIRS只能测量浓度的变化,因此无法提供起始浓度(通常设置为任意零点)。但是,它可以提供由任何任务或研究的状态引起的基线变化(例如收缩肌肉或增加大脑某部分的活动)。这种变化以毫摩尔每升(mmol/liter or mM)定量。有可能是正值,意味着来自任务或研究状态的激活;也有可能是负值,意味着自任务或研究状态的相对浓度降低或抑制。








This article is a guest post by Rui Chen. An English version can be downloaded here

Author: Xu Cui Categories: nirs Tags:

mergefile.m - a MatLab script to merge CSV files

October 10th, 2018

My wife asked me to write a script to merge some csv files she has. Usually this can be accomplished by a simple command in Mac or Linux:

cat *.csv >all0.csv

In Windows, it is:

copy *.csv all0.csv

But my wife needs more. She wanted the merged file have a column indicating the name of the source file. So I have to write a MatLab script, called mergefile.m. Here is the description.

mergefile merge csv files in a directory to all0.csv
mergefile merges the content of all the csv files in a directory into a
single file all0.csv. It also adds a column indicating the original
file name.

It assumes the files to be merged have the same header, and only the
header of the first file will be kept (i.e. the first row of the files
- except for the 1st file, will be ignored).

Author: Xu Cui (

Download mergefile.m

Author: Xu Cui Categories: matlab Tags:


September 12th, 2018


  1. 高亮标记了高影响因子的文献,并且文献按影响因子排列
  2. 显示中科院期刊分区信息,并用不同的颜色标识不同分区






Author: Xu Cui Categories: stork, web, writing Tags:

BOLD5000, A public fMRI dataset of 5000 images

September 11th, 2018

Official website and download
Full text paper link

Good news for brain imaging researchers. There is a new dataset available for you to play with.

BOLD5000 is a large-scale, slow event-related fMRI dataset collected on 4 subjects, each observing 5,254 images over 15 scanning sessions. The images are selected from three computer vision datasets.

  1. 1,000 images from Scene Images (with scene categories based on SUN categories)
  2. 2,000 images from the COCO dataset
  3. 1,916 images from the ImageNet dataset

BOLD5000 image data

BOLD5000 image data

Author: Xu Cui Categories: brain, web Tags:

Stork API, a single line becomes a list of new publications

September 8th, 2018

I want to show a list of my own publications on my webpage, is there an easy way to do so? Yes, Stork API, a single line of code, allows you to show a list of publications given a keyword. You only need to put the code to your webpage once, and then even if there are new publications, the list will update itself.

Let’s look at this list:

The above list was generated by the following single line of code:

<iframe style="border: 0;" src=";format=html&amp;num=20&amp;k=cui+xu+(stanford+psychiatry+OR+houston)" width="100%" height="600" frameborder="0"></iframe>

What about a list of publications in fNIRS field? It’s easy too. As you can see, all you need to change the the “k” parameter (which stands for keyword).

<iframe style="border: 0;" src=";format=html&amp;num=4&amp;k=(nirs OR fnirs) brain" width="100%" height="600" frameborder="0"></iframe>

The line of code above becomes

Author: Xu Cui Categories: programming, web, writing Tags:

Google Dataset search, a great tool for fNIRS and fMRI?

September 6th, 2018

Google just launched a new search engine: Google Dataset search. With this app, scientists can search public datasets published in scientific journals (and possibly other sources). According to Google, “Dataset Search enables users to find datasets stored across thousands of repositories on the Web, making these datasets universally accessible and useful.”

I searched ‘fNIRS’ and it returned 30+ results. See figure below. I clicked the first one, fNIRS/EEG/EOG classification, and it shows some meta information (e.g. the source and authors). Then I clicked the ‘’ website and did see the download link of the MAT file.

google dataset search

google dataset search

I also tried to search ‘fMRI’. The number of datasets for fMRI is much larger than that for fNIRS.

Currently the number of datasets indexed by Google is still limited, but I expect it will grow rapidly and become a very useful tool for scientists and anybody who want to play with data.

Link: Google Dataset search

Author: Xu Cui Categories: nirs, web Tags:

fNIRS 2018

August 29th, 2018

fNIRS 2010 conference will be held during October 5-8, 2018 in Tokyo, Japan. You may find more information at

The early registration deadline is 2018-09-05.

Author: Xu Cui Categories: nirs Tags: