Archive

Archive for June, 2009

Amf3Broker error and fix

June 27th, 2009

I encounter this error in an AIR application which uses amfphp for remoting:

The class {Amf3Broker} could not be found under the class path {/var/htdocs/amfphp/services/amfphp/Amf3Broker.php}

I googled and found several links, but their suggestions doesn’t work. I finally find the cause in the error log files of apache:

PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 2502231 bytes) in /var/www/html/…/amfphp2/core/amf/io/AMFBaseSerializer.php on line 98

So the cause is not amfphp, but instead my setting in php. So I edited /etc/php.ini, set memory_limit to a larger value. The problem solved.

If this doesn’t solve your problem, you may try the following links:
http://www.sephiroth.it/weblog/archives/2007/10/amfphp_and_mbstring.php
http://www.gotoandlearnforum.com/viewtopic.php?f=17&t=23708&p=109112

Author: Xu Cui Categories: adobe air, linux, php, web Tags:

IE doesn’t connect but firefox can. How to fix?

June 25th, 2009

Go to Control Panel, Internet Options, click on the Connections tab; click the LAN Settings button and check ‘Automatically detect settings’.

Author: Xu Cui Categories: web Tags:

Michael Jackson - Heal The World

June 25th, 2009

Author: Xu Cui Categories: life Tags:

NIRS data analysis (time series)

June 15th, 2009

[last updated: 2009/06/15]

Also check out NIRS data analysis (GLM and visualization)

Environment requirement

  1. MatLab
  2. SPM
  3. xTopo under xjView
    xjview is located in /fs/fmrihome/fMRItools/Xjview
    Add xjview to path by addpath(genpath('/fs/fmrihome/fMRItools/Xjview'))
    xTopo is based on topo program provided by Hitachi. It is modified by me. You can download xTopo at http://www.alivelearn.net/nirs/xtopo.zip

Preparation

  1. convert NIRS data file to csv format using ETG4000 program.
  2. copy the 3D positioning data (00X.pos).
  3. If you don’t have 3D positioning data, you may use the template channel positions located in xjview/nirs_data_sample/?x??.pos

Procedure

  1. In MatLab command window, run topo
  2. Click button “Data Load” and select the data csv file. You only need to select the 1st (or left) file if you use 4×4 or 3×5 bilateral configurations. After a pause you will find the data information (such as subject name and marker timing etc)
  3. To view the overall time series, click button “Continuous Hb”. You will see the HbO, HbR and total traces for each channel. Colorful vertical lines indicates marker timing. To see more detailedly the trace of a certain channel, enter the channel number in CH box and click button “Zoom”.

  4. To see activation in a topographic view, click on any channel. You can also see the animation by click button “Play”.
  5. To see activation in 3D topo, in xTopo main window click “3D Topography”. You need to select the ???.pos file. You can rotate the brain.
  6. To average time series across trials, you need to select the markers (event) you are interested in (by clicking button “Select Mark”) and input proper parameters for Pre time, relax time and post time, then click either button “Integral Hb” or “cuixu Integral Hb” (I will explain the difference later).
  7. You can also zoom, plot topo, 3D topo like what you do for continuous time series.

Explanations

  1. The difference between “Integral Hb” (IH) and “cuixu Integral Hb” (cH):
    IH: cut and collect the time series for each occurence of the event. Then do detrending based on pre time and post time for each individual time series. Finally average across occurences. Both pre and post time parameters are important.
    cH: Do detrending/smoothing with filter pass for the entire time series first, then cut and collect the time series for each occurence, then average. Pre time, relax time and post time is used when cutting the time series. The data used is from (Pre time) seconds before event onset, to (Relax + Post time) seconds after onset.  Relax and Post time are not that important. As long as the sum is the same, the result won’t change.
  2. Obtaining the data used in plot: You will find a variable called hb_data in the workspace. It contains the data used to plot. It’s an array. The 1st one is for probe set 1, 2nd for set 2. raw means raw data and fil means filtered data. The first dimension is hb species (oxy, dxy and total), second is time, 3rd is channel.

>> hb_data(1)

ana_mode: 2
calc_flg: 2
raw: [3x251x24 double]
fil: [3x251x24 double]

Author: Xu Cui Categories: matlab, nirs Tags:

NIRS data analysis (GLM and visualization)

June 12th, 2009

[last updated: 2009/06/15]

Also check out NIRS data analysis (time series)

Environment requirement

  1. MatLab
  2. SPM 5 or 8
  3. xjView 8
    xjview can be downloaded for free from http://www.alivelearn.net/xjview/
    (If you are inside CIBSR, xjview  is located in /fs/fmrihome/fMRItools/Xjview)
    Add xjview to path by addpath(genpath('/fs/fmrihome/fMRItools/Xjview'))
  4. NFRI toolbox (for standard brain registration)
    Download from http://brain.job.affrc.go.jp/tools/ and save it in a directory whose name contains no space (e.g. not in something like c:\program files\…).

Preparation

  1. convert NIRS data file to csv format using ETG4000 program.
  2. copy the 3D positioning data (00X.pos). If you didn’t measure 3D positioning data, jump to step 5
  3. use NFRI toolbox (Pepe Dan, Japan. http://brain.job.affrc.go.jp/tools/) to get the MNI coordinates of each probe.  Detailed information on how to use this toolbox can be found in its manual.
    1. Convert 00?.pos file to csv file using
      pos2csv
    2. Convert the 3D positioning data into MNI space coordinate using
      nfri_mni_estimation
    3. You will get a xls file containing the positions. There are several sheets in that file and you should use the sheet called “WShatC”, which contains the positions of cortical surface.
  4. Find channel positions based on probe positions using probe2channel.m
    probe2channel(probe, config)
  5. If you don’t have 3D positioning data, you may use the template channel positions located in
    load xjview/nirs_data_sample/templateMNI.mat
    .
    You will find 6 variables in MatLab workspace. They are channelMNI3x11  channelMNI3x5   channelMNI4x4   probeMNI3x11    probeMNI3x5     probeMNI4x4. They are all Nx3 matrix.

Read data and do GLM

  1. use readHitachData.m to read the data file (csv format). Type help readHitachData to see how to use it. Note if your input is two files (for 4×4 and 3×5 configurations), this script will automatically concatenate the data.
    [hbo,hbr,mark] = readHitachData({’XC_tap_MES_Probe1.csv’,'XC_tap_MES_Probe2.csv’});
  2. Prepare event onset timing, duration etc from the mark data, or external data you have, for later GLM analysis (step 3). The format is:
    • onset: onset timing of every event. a cell array. Each element is a numeric vector for one event type. Unit: second
    • duration: duration of every event. same with onset, except the meaning of numbers are duration. If the event is punctuated event, use 0 as duration. Unit: second
    • modulation (optional): modulation of event. For the same type of event you may have different intensities. For example, your event is flash of 5 levels of intensities. You can use modulation to modulate the intensity.  Format is exactly same with onset.
  3. GLM analysis using glm. Type help glm for more info.
    [beta, T, pvalue] = glm(hbdata, onset, duration, modulation);
  4. You may want to save the data for future use.
  5. (if you want to view the result in a standard brain) Convert the values (T or beta or contrasts) to an image file by nirs2img. Try help nirs2img to get more information.
    nirs2img(imgFileName, mni, value, doInterp, doXjview)

Visualization

  1. plotTopoMap will plot data on a plane. The data can be T or beta or other values. Type help plotTopoMap for more info. Here is an example (note the data is smoothed by spline):
    plotTopoMap(randn(24,1), '4x4');
  2. nirs2img will convert your data to an image file which can be visuzlied by many fMRI functional image programs (such as xjview). Here is an example of visualizing the image by xjview. Note, after xjview window launches, you need to check “render view”, and then you may choose between new or old style.
    nirs2img('nirs_test.img', mni, value, 1, 1);
  3. You can also visualize the result with NFRI’s nfri_mni_plot (in NFRI toolbox). You need to prepare the the plot data in excel format beforehand. More information can be found in Readme.doc in NFRI toolbox.

Group analysis

  1. For each individual subject, perform GLM and save the beta values for each condition and subject.
  2. Do contrast  on each subject. Contrasts are simply difference of beta values. For example, contrast between 1st condition and 2nd condition is simply c = beta(:,1) - beta(:,2); Then save the contrast in an image file using nirs2img for each subject. You get a bunch of contrast images (one for each subject)
  3. Perform T test on the contrast images using onesampleT.m, or you can use SPM to do one sample T test if you prefer. You will get a T test image file.
  4. Visualize the T test image with xjview (or SPM)
Author: Xu Cui Categories: matlab, nirs Tags:

Why is temporal lobe called “temporal”

June 11th, 2009

The name of “temporal lobe” follows “temporal bone”. But why “temporal”? The reason is that when people get old, the first region in the head which grows white hair is this region (see picture below). Thus this region is kind of a “time” region. That’s where “temporal” comes from. (I get this from some textbook but I forget which one.)

Author: Xu Cui Categories: brain, fun Tags:

Steve Jobs’ 2005 Stanford Commencement Address

June 7th, 2009

You can find the text here.

Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma — which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.

You are already naked. There is no reason not to follow your heart.

Stay Hungry. Stay Foolish.

Author: Xu Cui Categories: life Tags:

Paper accepted by PLoS Biol.

June 4th, 2009

Just got to know last night that our ready-go paper is accepted by PLoS Biology. Even better, they also commissioned a Primer article to highlight the paper.

This is such a relief after 2.5 years of submission-review-rejection cycle.

Author: Xu Cui Categories: life Tags:

Visual Illusion: identical parallelogram, different perception

June 4th, 2009

Author: Xu Cui Categories: brain, fun Tags: