<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Xu Cui</title>
	<atom:link href="http://www.alivelearn.net/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.alivelearn.net</link>
	<description>while(alive){learn;}</description>
	<pubDate>Fri, 03 Sep 2010 00:06:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Convert images to matrix</title>
		<link>http://www.alivelearn.net/?p=1176</link>
		<comments>http://www.alivelearn.net/?p=1176#comments</comments>
		<pubDate>Fri, 03 Sep 2010 00:06:19 +0000</pubDate>
		<dc:creator>Xu Cui</dc:creator>
		
		<category><![CDATA[brain]]></category>

		<category><![CDATA[matlab]]></category>

		<guid isPermaLink="false">http://www.alivelearn.net/?p=1176</guid>
		<description><![CDATA[Quite often you need to convert an image (or multiple images) to a MatLab matrix for further analysis and visualization (e.g. extracting time series, multivariate pattern analysis, etc). SPM provides handy functions for this:

P = spm_select; % select 1 or more images
V = spm_vol(P);
M = spm_read_vols(V);

The dimension of M is 3D or 4D depending on [...]]]></description>
			<content:encoded><![CDATA[<p>Quite often you need to convert an image (or multiple images) to a MatLab matrix for further analysis and visualization (e.g. extracting time series, multivariate pattern analysis, etc). SPM provides handy functions for this:</p>
<pre>
P = spm_select; % select 1 or more images
V = spm_vol(P);
M = spm_read_vols(V);
</pre>
<p>The dimension of M is 3D or 4D depending on how many images you selected. The 1st 3 dimensions are spatial and the last one is temporal.</p>
<p>If you want to save a matrix to a image file, use</p>
<pre>
V.fname = 'b.img';%
spm_write_vol(V, M);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.alivelearn.net/?feed=rss2&amp;p=1176</wfw:commentRss>
		</item>
		<item>
		<title>Wavelet Coherence</title>
		<link>http://www.alivelearn.net/?p=1169</link>
		<comments>http://www.alivelearn.net/?p=1169#comments</comments>
		<pubDate>Tue, 31 Aug 2010 18:05:47 +0000</pubDate>
		<dc:creator>Xu Cui</dc:creator>
		
		<category><![CDATA[brain]]></category>

		<category><![CDATA[matlab]]></category>

		<guid isPermaLink="false">http://www.alivelearn.net/?p=1169</guid>
		<description><![CDATA[Wavelet transform coherence (WTC) is a method for analyzing the coherence and phase lag between two time series as a function of both time and frequency (Chang and Glover 2010). Here I played with it using the MatLab toolbox provided by Grinsted et al.
In the following examples, I created two time series, x (blue) and [...]]]></description>
			<content:encoded><![CDATA[<p>Wavelet transform coherence (WTC) is a method for analyzing the coherence and phase lag between two time series as a function of both time and frequency (<a href="http://www.peaya.com/paper/showPaper.php?id=88080&amp;displayKey=QboSA1WIoJ">Chang and Glover 2010</a>). Here I played with it using the MatLab toolbox provided by Grinsted et al.</p>
<p>In the following examples, I created two time series, x (blue) and y (red) with different properties (phase shift, frequency and amplitude) and run wtc(x,y,&#8217;mcc&#8217;,0) command. Small white noise was added to the time series.</p>
<p>1. Phase shift and angle. A rightward arrow indicates 0 lag; a bottom-right arrow indicates a small lead of x; a leftward arrow indicates x and y is anti-correlated.</p>
<div id="attachment_1170" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.alivelearn.net/wp-content/uploads/2010/08/wtc_phase.jpg"><img class="size-medium wp-image-1170" title="wtc_phase" src="http://www.alivelearn.net/wp-content/uploads/2010/08/wtc_phase-300x219.jpg" alt="Phase" width="300" height="219" /></a><p class="wp-caption-text">Phase</p></div>
<p>2. Frequency. At what frequency (or period) are x and y correlated?</p>
<div id="attachment_1171" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.alivelearn.net/wp-content/uploads/2010/08/wtc_frequency.jpg"><img class="size-medium wp-image-1171" title="wtc_frequency" src="http://www.alivelearn.net/wp-content/uploads/2010/08/wtc_frequency-300x217.jpg" alt="frequency" width="300" height="217" /></a><p class="wp-caption-text">frequency</p></div>
<p>3. Amplitude. It seems amplitude doesn&#8217;t matter much.</p>
<div id="attachment_1172" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.alivelearn.net/wp-content/uploads/2010/08/wtc_amplitude.jpg"><img class="size-medium wp-image-1172" title="wtc_amplitude" src="http://www.alivelearn.net/wp-content/uploads/2010/08/wtc_amplitude-300x216.jpg" alt="amplitude" width="300" height="216" /></a><p class="wp-caption-text">amplitude</p></div>
<p>Toolbox can be found:<br />
<a href="http://www.pol.ac.uk/home/research/waveletcoherence/">http://www.pol.ac.uk/home/research/waveletcoherence/</a></p>
<p>Source code:</p>
<pre>t =[1:1000]/10;

%% effect of phase
x = sin(t) + randn(size(t))/5;
y = [sin(t(1:250)) sin(t(251:500)-pi/4) sin(t(501:750)-pi/2) sin(t(751:end)-pi)] + randn(size(t))/5;

figure('color','w');
subplot(2,1,1);
wtc(x,y,'mcc',0)
subplot(2,1,2);
plot(x);
hold on;
plot(y,'r')

%% effect of frequency
x = [sin(2*t(1:250)) sin(2*t(251:500)) sin(4*t(501:750)) sin(8*t(751:end))] + randn(size(t))/5;
y = [sin(2*t(1:250)) sin(2*t(251:500)) sin(4*t(501:750)) sin(8*t(751:end))] + randn(size(t))/5;

figure('color','w');
subplot(2,1,1);
wtc(x,y,'mcc',0)
subplot(2,1,2);
plot(x);
hold on;
plot(y,'r')

%% effect of amplitude
x = [sin(2*t(1:250)) sin(2*t(251:500)) sin(4*t(501:750)) sin(8*t(751:end))] + randn(size(t))/5;
y = [sin(2*t(1:250)) sin(2*t(251:500))/2 sin(4*t(501:750))/3 sin(8*t(751:end))/4] + randn(size(t))/5;

figure('color','w');
subplot(2,1,1);
wtc(x,y,'mcc',0)
subplot(2,1,2);
plot(x);
hold on;
plot(y,'r')</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.alivelearn.net/?feed=rss2&amp;p=1169</wfw:commentRss>
		</item>
		<item>
		<title>【转】静静的小河</title>
		<link>http://www.alivelearn.net/?p=1165</link>
		<comments>http://www.alivelearn.net/?p=1165#comments</comments>
		<pubDate>Tue, 24 Aug 2010 17:56:59 +0000</pubDate>
		<dc:creator>Xu Cui</dc:creator>
		
		<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://www.alivelearn.net/?p=1165</guid>
		<description><![CDATA[离家不远处有一条静静的小河
闲暇时我和孩子总有一段时光在那儿度过
清清的河水静静地流淌
只偶有几头到河边吃草的老牛慢慢走过
柔顺飘逸的苔丝和水草为小河装点了绿意
一群群小鱼在上面散步跳舞唱歌
思绪像随风的浮云那样闲适随意
心儿像逐流的鱼儿那样悠然自乐
我们用诱饵和器具将小鱼捕获
又在河滩上为放生的鱼儿拦坝做窝
孩子捧起小鱼和它们喃喃私语
鱼儿听懂后摇着身子点头致意
又用一根小棍和小鱼逗乐
也为不慎误伤小鱼而伤心难过
清清的河水静静地流着
在大自然母亲的怀抱中孩子的童趣永远没有个够
再三催促后才恋恋不舍地准备往家走
我们和小河鱼儿约定了下次见面的日期
婀娜多姿的苔丝和我们挥手告别
小鱼跳跃着提醒我们别把约会的时间记错
出处：百草岭  作者：陆平
]]></description>
			<content:encoded><![CDATA[<p>离家不远处有一条静静的小河<br />
闲暇时我和孩子总有一段时光在那儿度过<br />
清清的河水静静地流淌<br />
只偶有几头到河边吃草的老牛慢慢走过<br />
柔顺飘逸的苔丝和水草为小河装点了绿意<br />
一群群小鱼在上面散步跳舞唱歌</p>
<p>思绪像随风的浮云那样闲适随意<br />
心儿像逐流的鱼儿那样悠然自乐<br />
我们用诱饵和器具将小鱼捕获<br />
又在河滩上为放生的鱼儿拦坝做窝<br />
孩子捧起小鱼和它们喃喃私语<br />
鱼儿听懂后摇着身子点头致意<br />
又用一根小棍和小鱼逗乐<br />
也为不慎误伤小鱼而伤心难过</p>
<p>清清的河水静静地流着<br />
在大自然母亲的怀抱中孩子的童趣永远没有个够<br />
再三催促后才恋恋不舍地准备往家走<br />
我们和小河鱼儿约定了下次见面的日期<br />
婀娜多姿的苔丝和我们挥手告别<br />
小鱼跳跃着提醒我们别把约会的时间记错</p>
<p>出处：百草岭  作者：陆平</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alivelearn.net/?feed=rss2&amp;p=1165</wfw:commentRss>
		</item>
		<item>
		<title>Standard deviation and standard error</title>
		<link>http://www.alivelearn.net/?p=1156</link>
		<comments>http://www.alivelearn.net/?p=1156#comments</comments>
		<pubDate>Wed, 18 Aug 2010 16:47:19 +0000</pubDate>
		<dc:creator>Xu Cui</dc:creator>
		
		<category><![CDATA[brain]]></category>

		<guid isPermaLink="false">http://www.alivelearn.net/?p=1156</guid>
		<description><![CDATA[Standard deviation (std): standard deviation of the sample
Standard error, or standard error of the mean (sem), is the standard deviation of the mean. \(sem=std/\sqrt{N}\)
Most errorbars in scientific publications refer to standard error. Quite often a T-test is accompanied to show the effect is significant. This makes sense if they try to compare if the mean [...]]]></description>
			<content:encoded><![CDATA[<p>Standard deviation (std): standard deviation of the sample<br />
Standard error, or standard error of the mean (sem), is the standard deviation of <strong>the mean</strong>. \(sem=std/\sqrt{N}\)</p>
<p>Most errorbars in scientific publications refer to standard error. Quite often a T-test is accompanied to show the effect is significant. This makes sense if they try to compare if <strong>the mean</strong> is different. Sometimes - quite often in neuroimage - while the mean is significantly different, it is almost impossible to tell the difference on the individual level (or classify individual observation). If the authors used standard deviation, the errorbars would have been huge and figures got ugly.</p>
<p><a href="http://www.peaya.com/peaya.php?comicsid=1005"><img src="http://www.peaya.com/showComics.php?comicsid=1005" border=0 /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alivelearn.net/?feed=rss2&amp;p=1156</wfw:commentRss>
		</item>
		<item>
		<title>Interview with David Shelly</title>
		<link>http://www.alivelearn.net/?p=1135</link>
		<comments>http://www.alivelearn.net/?p=1135#comments</comments>
		<pubDate>Wed, 28 Jul 2010 07:18:07 +0000</pubDate>
		<dc:creator>Xu Cui</dc:creator>
		
		<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://www.alivelearn.net/?p=1135</guid>
		<description><![CDATA[David is an amazing person: he has published 5 papers in Nature and 1 in Science, two of which were published this year. Check out what he says in Peaya interview (click the photo below).
]]></description>
			<content:encoded><![CDATA[<p>David is an amazing person: he has published 5 papers in Nature and 1 in Science, two of which were published this year. Check out what he says in Peaya interview (click the photo below).</p>
<div class="wp-caption aligncenter" style="width: 265px"><a href="http://www.peaya.com/paper/showInterview.php?id=1006"><img title="David Shelly" src="http://profile.usgs.gov/myscience/upload_folder/gen55690DSCN0805.jpg" alt="David Shelly" width="255" height="270" /></a><p class="wp-caption-text">David Shelly</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.alivelearn.net/?feed=rss2&amp;p=1135</wfw:commentRss>
		</item>
		<item>
		<title>gmail is getting smarter</title>
		<link>http://www.alivelearn.net/?p=1124</link>
		<comments>http://www.alivelearn.net/?p=1124#comments</comments>
		<pubDate>Wed, 21 Jul 2010 17:29:15 +0000</pubDate>
		<dc:creator>Xu Cui</dc:creator>
		
		<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://www.alivelearn.net/?p=1124</guid>
		<description><![CDATA[I noticed that gmail will remind you if you have something like &#8220;&#8230; is attached&#8221; in the email body but actually you don&#8217;t attach any files. This is very considerate.
]]></description>
			<content:encoded><![CDATA[<p>I noticed that gmail will remind you if you have something like &#8220;&#8230; is attached&#8221; in the email body but actually you don&#8217;t attach any files. This is very considerate.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alivelearn.net/?feed=rss2&amp;p=1124</wfw:commentRss>
		</item>
		<item>
		<title>Meaning of correlation coefficient</title>
		<link>http://www.alivelearn.net/?p=1109</link>
		<comments>http://www.alivelearn.net/?p=1109#comments</comments>
		<pubDate>Tue, 13 Jul 2010 17:47:57 +0000</pubDate>
		<dc:creator>Xu Cui</dc:creator>
		
		<category><![CDATA[brain]]></category>

		<guid isPermaLink="false">http://www.alivelearn.net/?p=1109</guid>
		<description><![CDATA[If variable X and Y has correlation 0.1, how much does it help to predict Y based on X? In the simplest binary case, the probability (p) to correctly predict Y based on X is a linear function of correlation (c), i.e.
$$p=\frac{c+1}{2}$$
That means, a 0.1 correlation will increase the prediction probability from 0.5 to 0.55, [...]]]></description>
			<content:encoded><![CDATA[<p>If variable X and Y has correlation 0.1, how much does it help to predict Y based on X? In the simplest binary case, the probability (p) to correctly predict Y based on X is a linear function of correlation (c), i.e.<br />
$$p=\frac{c+1}{2}$$</p>
<p>That means, a 0.1 correlation will increase the prediction probability from 0.5 to 0.55, a 5% increase. This could be significant if you are betting a lot of money :)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alivelearn.net/?feed=rss2&amp;p=1109</wfw:commentRss>
		</item>
		<item>
		<title>Octopus Paul, hypothesis, p-Value and significance</title>
		<link>http://www.alivelearn.net/?p=1107</link>
		<comments>http://www.alivelearn.net/?p=1107#comments</comments>
		<pubDate>Mon, 12 Jul 2010 16:59:04 +0000</pubDate>
		<dc:creator>Xu Cui</dc:creator>
		
		<category><![CDATA[fun]]></category>

		<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://www.alivelearn.net/?p=1107</guid>
		<description><![CDATA[Null hypothesis (H0): Octopus Paul doesn&#8217;t have the ability to predict. Or, the probability that he predicts correctly on each event is 1/2.
Data: In 2010 World Cup, Octopus Paul correctly predicted the outcomes of 8 games out of 8 games.
p-Value: (the probability to obtain the data assuming the null hypothesis is true): 1/2^8 = 0.0039
Statistical [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Null hypothesis (H0):</strong> Octopus Paul doesn&#8217;t have the ability to predict. Or, the probability that he predicts correctly on each event is 1/2.<br />
<strong>Data: </strong>In 2010 World Cup, Octopus Paul correctly predicted the outcomes of 8 games out of 8 games.<br />
<strong>p-Value: </strong>(the probability to obtain the data assuming the null hypothesis is true): 1/2^8 = 0.0039<br />
<strong>Statistical significance threshold: </strong>alpha = 0.05<br />
<strong>Conclusion: </strong>as pvalue &lt; alpha, we conclude that the null hypothesis should be rejected. Loosely speaking, octopus Paul does have prediction power.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alivelearn.net/?feed=rss2&amp;p=1107</wfw:commentRss>
		</item>
		<item>
		<title>Peaya officially launches</title>
		<link>http://www.alivelearn.net/?p=1104</link>
		<comments>http://www.alivelearn.net/?p=1104#comments</comments>
		<pubDate>Wed, 07 Jul 2010 18:12:32 +0000</pubDate>
		<dc:creator>Xu Cui</dc:creator>
		
		<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://www.alivelearn.net/?p=1104</guid>
		<description><![CDATA[The goal of Peaya  is to make your academic life more fun and more  productive.
Peaya Comics
Comic strips about our academia life – the excitement, joy, depression,  and pain.  We hope the strips will make you smile. Below is the latest  comics:



Peaya Paper
A software tool that allows you to manage papers and PDFs [...]]]></description>
			<content:encoded><![CDATA[<h4>The goal of Peaya  is to make your academic life more fun and more  productive.</h4>
<h4><a href="http://www.peaya.com/peaya.php">Peaya Comics</a></h4>
<p>Comic strips about our academia life – the excitement, joy, depression,  and pain.  We hope the strips will make you smile. Below is the latest  comics:</p>
<p style="text-align: center;"><a href="http://www.peaya.com/peaya.php"><img src="http://www.peaya.com/showComics.php" border="0" alt="Comics" width="500" /></a></p>
<p><a href="http://www.peaya.com/peayapaper"><br />
</a></p>
<h4><a href="http://www.peaya.com/peayapaper">Peaya Paper</a></h4>
<p>A software tool that allows you to manage papers and PDFs and access  them anywhere (Windows, Mac, and Linux). It also makes it easy to share  with friends and collaborators. We hope Peaya Paper will make your work  more productive. See how happy Iris (below) is after using Peaya Paper!</p>
<p style="text-align: center;"><a href="http://www.peaya.com/peayapaper"><img src="http://www.peaya.com/peayapaper/wp-content/themes/BVD/images/header_images.png" border="0" alt="Peaya Paper" width="400" /></a></p>
<p><a href="http://www.peaya.com/peaya.php#3"><br />
</a></p>
<h4><a href="http://www.peaya.com/peaya.php#3">Peaya Cite</a></h4>
<p>A MS Word add-in that offers a completely new way to insert citations —  Cite Seamlessly with real-time context-dependent reference hinting. We  hope Peaya Cite will allow you to concentrate on writing itself rather  than on trivial citation insertion or formatting.</p>
<p style="text-align: center;"><a href="http://www.peaya.com/peaya.php#3"><img src="http://www.peaya.com/peayapaper/wp-content/themes/BVD/images/featured_3.jpg" border="0" alt="Peaya Cite" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alivelearn.net/?feed=rss2&amp;p=1104</wfw:commentRss>
		</item>
		<item>
		<title>How to determine the voxel size in an image</title>
		<link>http://www.alivelearn.net/?p=1101</link>
		<comments>http://www.alivelearn.net/?p=1101#comments</comments>
		<pubDate>Thu, 17 Jun 2010 17:44:35 +0000</pubDate>
		<dc:creator>Xu Cui</dc:creator>
		
		<category><![CDATA[brain]]></category>

		<guid isPermaLink="false">http://www.alivelearn.net/?p=1101</guid>
		<description><![CDATA[Tools: SPM, cor2mni
Assume the image is &#8220;a.img&#8221;, do
v = spm_vol('a.img');
v.mat
If v.mat is a diagonal matrix, you can simply read the number and they are the voxel size in mm.
If not, a trick is to calculate the distance between adjacent voxels. For example, if v.mat = 

   -3.4337   -0.0518   -0.1776 [...]]]></description>
			<content:encoded><![CDATA[<p>Tools: SPM, cor2mni</p>
<p>Assume the image is &#8220;a.img&#8221;, do</p>
<pre>v = spm_vol('a.img');
v.mat</pre>
<p>If v.mat is a diagonal matrix, you can simply read the number and they are the voxel size in mm.</p>
<p>If not, a trick is to calculate the distance between adjacent voxels. For example, if v.mat = </p>
<pre>
   -3.4337   -0.0518   -0.1776  110.2825
   -0.0919    3.3036    1.1004  -97.8366
   -0.1324   -0.9487    3.8416   19.7459
         0         0         0    1.0000
</pre>
<p>Use cor2mni.m to calculate the voxel coordinate in MNI space.</p>
<pre>
point1 = cor2mni([1 1 1], v.mat);
point2 = cor2mni([1 1 2], v.mat);
</pre>
<p>Then calculate the distance between point1 and point2 you will get the voxel size in z direction. Repeat for x and y direction.</p>
<pre>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% cor2mni
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function mni = cor2mni(cor, T)
% function mni = cor2mni(cor, T)
% convert matrix coordinate to mni coordinate
%
% cor: an Nx3 matrix
% T: (optional) rotation matrix
% mni is the returned coordinate in mni space
%
% caution: if T is not given, the default T is
% T = ...
%     [-4     0     0    84;...
%      0     4     0  -116;...
%      0     0     4   -56;...
%      0     0     0     1];
%
% xu cui
% 2004-8-18
% last revised: 2005-04-30

if nargin == 1
    T = ...
        [-4     0     0    84;...
         0     4     0  -116;...
         0     0     4   -56;...
         0     0     0     1];
end

cor = round(cor);
mni = T*[cor(:,1) cor(:,2) cor(:,3) ones(size(cor,1),1)]';
mni = mni';
mni(:,4) = [];
return;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.alivelearn.net/?feed=rss2&amp;p=1101</wfw:commentRss>
		</item>
	</channel>
</rss>
