How long is fMRI or NIRS signal delayed?

December 8th, 2014

We know the hemodynamic signal measured by fMRI (or NIRS) is delayed respective to the onset of stimuli. But how long is the delay? Many people think it takes about 2s for the signal to arise. Actually the delay varies from region to region. As shown in this figure, signal in motor cortex (including SMA) arises very quickly (no delay); but the signal in visual cortex arises slow (2s delay).

fmri or nirs signal onset delay

The figure above is adapted from Cui et al, PLoS Biology (2009) Ready…Go: Amplitude of the fMRI Signal Encodes Expectation of Cue Arrival Time

Author: Xu Cui Categories: fmri, nirs Tags:

Driver Detective

August 25th, 2014

I had been using a Lenovo Edge laptop, and one day it died. The operation system (windows 7) was corrupted. After installing a new Windows 7, I found the computer is impossible to use - it does not find the wireless adapter and the screen resolution is low. I did a lot of google but Lenovo apparently has a lot of special hardware and it’s hard to find the correct drivers. I almost gave up.

I then tried an external USB wireless adapter from another computer and it works. So I was going to purchase an external USB wireless adapter. Then I did another search to fix the screen resolution and at this time I found Driver Detective, a program which claimed to be able to fix all driver issues. I hesitated for a few minutes when I found out the program is not free (about 30 dollars). But eventually I convinced myself to pay. To my joy, it fixed all problems, including the wireless adapter driver. So I do not need to buy an USB wireless driver anymore.

Author: Xu Cui Categories: life Tags:

Apply a Formula to an Entire Column in Excel

June 9th, 2014

Two Ways to Apply a Formula to an Entire Column in Excel

This small trick can be handy if you have a lot of rows. The most commonly used method - dragging down - will be too time consuming in this case.

Author: Xu Cui Categories: life Tags:

Sample NIRS finger tapping data

May 24th, 2014


The subject is myself. I did a simple finger tapping task. I continuously tapped my right hand on the table for 10s, then rest for 20s. Then repeat this tapping-rest cycle for 20 times.

NIRS signals were recorded by Hitachi ETG-4000.

The data is very good: you can see the changes of HbO and HbR in the individual trials in motor cortex (channel 13 this case). See figure below:

(click to zoom)

The data is available for download (fill the form below). Here is the description:

1. This data file can be loaded in MatLab (using the load command).

2. After loading the data, there are 3 variables, hbo,hbr,marker. hbo is oxy-Hb data, hbr is deoxy-Hb data, and marker indicates the timing of the finger tapping event.

3. hbo and hbr are 7562×24 matrices. Each column is for a channel (and we totally have 24 channels), each row is for one time point. The sampling frequency is 10Hz.

4. mark is a 40×2 matrix. The first column can be ignored. The 2nd column is the timing of the onset and offset of finger tapping alternatingly.

To download the data, fill the following form and click Submit button. You will receive a download link shortly.

Author: Xu Cui Categories: nirs Tags:

Format a date the way you want in Excel

April 29th, 2014

In one column of your excel your date is formatted as “03/06/2001″. How do you format it to “2001 Mar 6″?



Author: Xu Cui Categories: Uncategorized Tags:

Say No to SCA 5

February 24th, 2014

Universities should not accept students based on race.

Say No to SCA 5

Author: Xu Cui Categories: life Tags:

Find unique values in Excel

February 11th, 2014

Assume you have two columns in an Excel sheet. Column A contains some names, Column B also contains some names, some of which are duplicates from A. You want to know which ones are unique, and you want to create a column C where only unique names are listed.

The trick is to use the following line in column C:


As you can see, only the unique names are shown in Column C. You can then copy the values of column C to D, and sort D, then you get all unique names.

Author: Xu Cui Categories: life Tags:

Use MatLab to move and click mouse, to press keyboard

January 27th, 2014

We have an interesting challenge in one of our projects. In our neuroimaging experiment, we need the participant to play a computer game while his brain is scanned (using a NIRS device ETG 4000 in this case). As you can imagine, we need to start the computer game and brain data collection at the same time to make sure the behavior data and neuroimaging data are synchronized. What we usually do is to write some code to start ETG 4000 programmaticly inside the game program; but we can not do it this time because this computer game is developed by others and we can’t inject code into it.

What we want to achieve, simply put, is to click the “Go” button of the game at the same time when we start ETG 4000.

Fortunately there is a solution. We can write a MatLab program to simulate mouse movement and click. Below is the matlab code which will automatically move the mouse to point (640,640) and click it after 5s. If your computer game program requires keyboard input, the code below also contains a snippet for that.

import java.awt.Robot;
import java.awt.event.*;
robot = Robot;

% 5s later, move the mouse to point (640,640) where the 'go' button is,
% then click it.
robot.mouseMove(640, 640);
% fill in the code to start ETG 4000 here

% 5s later, press key SHIFT and W at the same time

As you can see in the following short screen shot, after we run the matlab program (called testmouse), 5s later the mouse moves to (640,640) and clicks, then key SHIFT+W is pressed.


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

NIH awards 4500 grants each month, peaks in summer

January 25th, 2014

A recent analysis on NIH grants. On average there are 4,500 grants awarded each month. July-September is the grant season. For more detail, check out “NIH awards 4500 grants each month, peaks in summer

NIH Awards 4500 Grants per MonthNIH Awards 4500 Grants per Month
Author: Xu Cui Categories: Uncategorized Tags:

How to retrieve text from a picture

December 21st, 2013

I get a picture and would like to copy the text in the picture. But since there are a lot of text, I do not want to type. So I wish there is a tool which can recognize text in a picture. Fortunately Microsoft’s OneNote makes it easy.

To do so, copy the picture into OneNote, then right click the picture, and click “Edit Alt Text”. You will see OneNote automatically recognize the text.

Author: Xu Cui Categories: Uncategorized Tags: