NIRS manufactures locations

May 4th, 2016

Where are the major NIRS device manufactures? You can see from the map below.

There are NIRS manufactures in US, Japan, Europe and Korea.

If you are a NIRS manufacture and would like to add to this list, please let me know (leave a comment in this post).
If you are interested in creating a map like this, please let me know (leave a comment in this post).

Related: NIRS manufactures products

Author: Xu Cui Categories: brain, nirs Tags:

Stork is my best research assistant (2): Grant alert

April 15th, 2016
  1. Does my boss have money?
  2. I am looking for a postdoc position; does my future boss have enough funding to support me?
  3. How much money was awarded to my field (e.g. NIRS)? And who got the money? What are they going to do with the money?

Have you ever wondered these questions? In the early years as a graduate students, I rarely asked “money” questions. It does not sound what a “true” scientist should care.  I was even puzzled when I realized my boss spent more than half of his time writing grant applications - shouldn’t he spend most of his time doing experiments and write papers?

As a postdoc I found myself spend a lot of time writing grant applications; and realized my career is critically depending on the success of securing enough funding. I also see a few colleagues had to leave academia due to lack of funding.  It would be nice if there is a tool which can notify me of the funding situation in a timely manner.

Stork is such a tool.

I entered some keywords into Stork, including “pearl chiu” (my former colleague) and “nirs brain” (my research field). Below is a letter I got from Stork:

Stork notifies me of awarded grants

Stork notifies me of awarded grants

With the information Stork provides, I know who in our field got grants and what they proposed. In fact the 3rd one is my colleague Manish who is interested in using NIRS in resting-state brain network study. I also got to know Pearl got a big gran, so I sent her a congratulation note.

Compared to journal papers alert, grants alert helps me to know the trend of my field much earlier. This is because publications are usually a few years delayed from grants.

If you also want to be the first one to know new grants in your field, why don’t you give Stork a try? I’m sure you’ll be delighted!

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

Projection of a NIRS channel on a brain surface

April 11th, 2016

When analyzing the data in our concurrent NIRS-fMRI study, we are particularly interested in how the NIRS signals were correlated to the fMRI signal. To answer the question we need to create an ROI (region of interest) in brain which is directly underneath the NIRS channel (which is on the skull). So a projection of the NIRS channel on the brain surface is necessary.

It might be easy if the brain were a perfect sphere, or at least doable if it is smooth. But brain surface is anything but smooth. What we did is:

  1. Create a brain surface mask. This is easy using BET (
  2. Loop over all voxels on the surface, calculate the distance between the NIRS channel (point A) and the voxel
  3. Find the voxel which is closest to the NIRS channel (It is point B in the figure below)

Projection of NIRS channel on brain surface

Projection of NIRS channel on brain surface

Author: Xu Cui Categories: brain, matlab, nirs, programming Tags:

Is measuring both oxy and deoxy-Hb useful?

March 28th, 2016

One of the advantages of NIRS is that it measure two values at a time - both oxy- and deoxy-Hb concentration, while fMRI measure only one value, called BOLD. (See a comparison between NIRS and fMRI.) However, what is the use of measuring two values if they are highly correlated (actually anti-correlated)?

This is a valid question. In our 2010 paper titled “Functional Near Infrared Spectroscopy (NIRS) signal improvement based on negative correlation between oxygenated and deoxygenated hemoglobin dynamics“, we have shown that (1) theoretically (using Balloon model) oxy and deoxy Hb should be highly correlated, close to -1; (2) with real data, they are highly correlated. See the figure below with real data (I was the subject).

oxy and deoxy-Hb are highly (anti)correlated

oxy and deoxy-Hb are highly (anti)correlated

Now go back to our question: if they are highly correlated, maybe measuring both does not bring additional advantage. If we look at NIRS publications, we see most publications only use either oxy-Hb or deoxy-Hb in their analysis, or at least use them separately. It is not very clear why we should use both.

However, it turns out it is an advantage to measure both. In a study we have tried to “predict” if the subject is doing finger tapping or not by looking at the NIRS signal only (see the paper). This is useful for brain-computer-interface purpose. In the figure below, you will see that if we use only oxy-Hb (blue) or deoxy-Hb (green), the prediction accuracy is lower than if we combine them (red).

Combined oxy- and deoxy-Hb predict better

Combined oxy- and deoxy-Hb predict better

This means while oxy- and deoxy-Hb are highly correlated, we still get more if we measure both. I think part of the reason is that there are always noise in real data. With two measurement the signals are more robust again the corruption of noise.

Author: Xu Cui Categories: brain, nirs Tags:

T value of a single subject

March 14th, 2016

I usually report a group-level T-test image in the final publications or presentations. But in the early stage of a project when only one or a few subjects have been scanned, I often need to report an activation map for an individual subject after general linear model analysis (GLM). I could show a beta image or activation image, but a T-image is sometimes desired. The question is how do I calculate the T-value of a contrast for a single subject.

I will use the following example to show how it is calculated. Assume we have two conditions, beep and flash, and the brain signal is saved in y. Based on the timing of beep and flash, we have an independent variable called x with two columns. The 1st column is for beep, the 2nd for flash.

y=x(:,1)*2 + x(:,2)*3 + 0.2 + rand(size(x(:,1)))/5;
[a,b,c] = glmfit(x,y);

Now you can easily find the beta value, the T value, and the p-value of each individual condition:

beta = a(2:end)'
T = c.t(2:end)'
p = c.p(2:end)'

What about the contrast between beep and flash? Well, it’s a bit more complicated. First, we need to find the covariance matrix of the betas.

covb = c.covb(2:end, 2:end);

Then we define our contrast vector, in this case it is simply contrast = [1 -1]. The variance of contrast (beep-flash) is

V = contrast  * covb * contrast';

The T-value of the contrast is

T = (beta * contrast') / sqrt(V) * sqrt(length(x));

Note: you might be tempted to use the two-sample T formula to calculate the T-value (i.e. finding the variance of beta1, variance of beta2, and then calculate). It is not the correct way. We have to consider the case where the two conditions are correlated. Using the covariance matrix above is the right way.

Author: Xu Cui Categories: brain, matlab, nirs Tags:

FDR correction matlab script

March 14th, 2016

The following script is to determine is a channel (or voxel) survives the FDR corrected threshold. Assume you have 48 channels and you already calculated the (uncorrected) p-value of each channel. You put it into an array called p. Now you want to know which channel will survive if you do a FDR correction at q=0.05. You may simply use

fdr0(p, 0.05)

The output is an array of 48 numbers, with 1s in the channel where it survives the FDR threshold.

function y = fdr0(p, q)
% y = fdr0(p, q)
% to calculate whether a pvalue survive FDR corrected q
% p: an array of p values. (e.g. p values for each channel)
% q: desired FDR threshold (typically 0.05)
% y: an array of the same size with p with only two possible values. 0
% means this position (channel) does not survive the threshold, 1 mean it
% survives
% Ref:
% Genovese et al. (2002). Thresholding statistical maps in functional
% neuroimaging using the false discovery rate. Neuroimage, 15:722-786.
% Example:
%   y = fdr0(rand(10,1),0.5);
% Xu Cui
% 2016/3/14

pvalue = p;
y = 0 * p;

[sortedpvalue, sortedposition] = sort(pvalue);
v = length(sortedposition);
for ii=1:v
    if q*ii/v >= sortedpvalue(ii)
        y(sortedposition(ii)) = 1;

Author: Xu Cui Categories: brain, nirs Tags:

Finger tapping task MatLab script

February 29th, 2016

finger tapping

finger tapping

Finger tapping is probably the most used task in brain imaging studies (fMRI and NIRS). The task is simple and elicits robust brain signal in the motor cortex. We always use it to test new devices or develop a new method.

If you want to control your NIRS device (say Hitachi ETG 4000) to start/end, please refer

If you want to see how blood flow increases in brain motor cortex during finger tapping, check out

To download, please fill the form below:

Author: Xu Cui Categories: brain, matlab, nirs, programming Tags:

Hyperscanning data

February 11th, 2016

Below is sample hyperscanning data from one subject (myself). For detailed information please refer to

Author: Xu Cui Categories: brain, nirs Tags:

今天看到好视频:老树画画 《做一个梦》

February 10th, 2016




Author: Xu Cui Categories: life, opinion Tags:

Light experiment comparing NIRSport and Octamon

January 12th, 2016

This is a guest post by Andrew Gundran and Paul Mazaika, both working with NIRS in Stanford University. They did an interesting experiment comparing the light power between NIRSport and Octamon.

Paul Mazaika

Paul Mazaika

Andrew Gundran

Andrew Gundran

We ran experiments to compare the emission signal strengths of the NIRsport and Octomon. Since these systems run in the Near IR, we experimented with some non-standard test equipment.

It was a fun experiment.

The NIRsport uses LED wavelengths of 760 nm and 850 nm. A typical spectral spread shows that only a few percent of total power is emitted more than 50 nm away from the spectral peak (Fig. 1). Since the upper end of visible light to the eye is 700 nm, the eye can see some of the light from the 760 nm LED, thus the system looks red when it is turned on. By far, most of the power is in the infrared and invisible to the eye.

A camera has red, green, and blue sensors. Usually the red sensor will also detect IR, unless there is a good-quality IR filter in front of the lens. So poor quality cameras may be better to detect near IR, and then IR sources may show up brighter in the camera image. Using an iPhone camera, the Octamon lights are much brighter than a red object (Figure 2), although the lights and camera look similarly colored red to the human eye. Thus, a phone camera detects some infrared.

Using the camera phone, the NIRsport emitter looks much brighter than the Octamon emitters, suggesting NIRsport puts out more IR power than the Octamon (Fig. 3).

More light power (the power is mostly in IR) may provoke more heating at the LED emitter, since there is some energy absorption when crossing the boundary from fiber to air. A thermal image (8000-14000 nm) shows that the NIRsport emitter generates more heat than the Octomon emitters (Fig. 4), suggesting that NIRsport is emitting more IR power.

Hmmm, makes you wonder if the Hitachi emitters start getting hot after 10 minutes?

Cross-checking with the actual NIRS equipment is better since they use real IR detectors. To check signal strength: put a finger in front of the Octamon detector, point a NIRsport or Octamon emitter through the finger to see which generates a higher response on the same detector. Possibly will find out that quality of contact is the most important factor.

NIRS light experiment

NIRS light experiment

Author: Xu Cui Categories: brain, nirs Tags: