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:

=IF(ISERROR(MATCH(B1,A:A,0)),B1,"")

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.

http://www.youtube.com/watch?v=xvhI-IGiWN8

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.
pause(5);
robot.mouseMove(640, 640);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
% fill in the code to start ETG 4000 here

% 5s later, press key SHIFT and W at the same time
%pause(5);
robot.keyPress(java.awt.event.KeyEvent.VK_SHIFT)
robot.keyPress(java.awt.event.KeyEvent.VK_W)
robot.keyRelease(java.awt.event.KeyEvent.VK_W)
robot.keyRelease(java.awt.event.KeyEvent.VK_SHIFT)

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.

Refer: http://www.mathworks.com/matlabcentral/answers/100545

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:

VMWare Player: guest OS not full screen?

October 3rd, 2013

VMWare Player is a great free tool if you want to run multiple operating systems on one computer. For example, you may have a Mac but need to run a few programs on Windows. Instead of purchasing a new Windows computer, you can simply use VMWare Player and install a Windows there.

I installed VMWare Player on my Windows 7 computer then installed Windows 8 inside VMWare Player. But for some reason the screen resolution of the guest OS is small. See below.

The solution is actually simple. Simply install VMWare tools. Click the “Player” menu, select Manage, then install VMWare Tools. You need to restart your guest OS.

Author: Xu Cui Categories: fun, life Tags:

Raspberry Pi for research labs (1)

September 30th, 2013

Raspberry Pi is a mini and incredibly cheap PC. The size is like a credit card, and the price is $35. See how small it is compared to my hand.

If you connect Pi with a TV (or monitor), a keyboard, a mouse, an internet cable, a SD card, then it becomes a full fledged PC. Pi is ideal for students to learn computer languages and other educational purposes. But many people are very creative in using Pi as a digital photo frame, a media center, a internet radio station etc. Pi’s performance is like a a 300MHz Pentium 2.

Can Pi be used in human behavior and brain imaging research labs?  Our specific goal is to see if we can integrate Pi in our Near Infrared Spectroscopy (NIRS) research. In this first part of experiment, we will see if we can get Pi running at all as a regular computer.

Joe in our lab and I rush into Fry’s to purchase some items needed to run Pi:

  1. Power adapter. Yes, Pi needs power. The adapter is actually identical to my smartphone (android) charger.
  2. SD card and reader. It is like the hard disc of a regular computer and is where data (including OS) is saved.
  3. HDMI to VGA adapter (to connect to a monitor)
  4. We already have a monitor, a USB mouse, and a USB keyboard.
1. let’s format the SD card and put OS in.
I am using a Windows computer so I follow the following instructions.
  1. Download the SD Association’s Formatting Tool from
    https://www.sdcard.org/downloads/formatter_4/eula_windows/
  2. Install and run the Formatting Tool on your machine
  3. Set “FORMAT SIZE ADJUSTMENT” option to “ON” in the “Options” menu
  4. Check that the SD card you inserted matches the one selected by the Tool
  5. Click the “Format” button
Then download NOOBS software from http://downloads.raspberrypi.org/noobs. It is a zip file, extract it and put the contents to the formatted SD card. Note, put the contents inside NOOBS_v1_3 folder to the SD card, but not the NOOBS_v1_3 folder itself.
2. Connect hardware to Pi.
Plug in the SD card to Pi, connect keyboard and mouse, HDMI to VGA adapter (then to monitor), Ethernet cable, and power adapter. As soon as you connect the power adapter, Pi will start to run. We have an option to select which OS to run, and we selected Raspbian, a version of Linux.
A close view of the hardware connected to Pi.
A far view of Pi and the keyboard/mouse, monitor etc. You can see the big juicy raspberry on the screen.
3. Surfing internet
Looks like it’s ready. Now let’s do something real - surfing internet. I opened Midori (a web browser) and can successfully go to any website I like.
Conclusions:
We successfully set up Raspberry Pi as a computer running Linux. The next step is to see if we can use it for research purpose.
Author: Xu Cui Categories: brain, linux, programming, web Tags:

xjView full package download

September 23rd, 2013

If you are interested in the full package of xjview, including nirs related scripts, please fill the following form:

If you are only interested in the display function of xjview, please go to http://www.alivelearn.net/xjview8/ to download.

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

Download “Cross Wavelet and Wavelet Coherence Toolbox”

September 16th, 2013

The ”Cross Wavelet and Wavelet Coherence Toolbox” download link by Grinsted et al (http://www.pol.ac.uk/home/research/waveletcoherence/) is dead. We will send you an active download link upon your request (an email with the download link will be sent to you automatically after you fill the form below):






To learn more about wavelet coherence analysis, see http://www.alivelearn.net/?s=wavelet

Author: Xu Cui Categories: Uncategorized Tags:

Brain surface template

August 19th, 2013

Sometimes we need to work on the surface of a brain. Here I create a surface mask based on the standard avg152T1 image (MNI space) for you to download.

Visualized in xjview, you can see the mask in the yellow curved lines. It’s actually a surface. The background image is the standard avg152T1 image.

Brain Surface Mask Template (MNI)

Brain Surface Mask Template (MNI)

To download the surface mask image, please submit the following form. You will receive an email with the download link. If you do not receive the email, please let me know.

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