对于fmri的hrf血液动力学响应函数的一个很直观的解释-by 西南大学xulei教授
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all;clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% haemodynamic response function: BOLD signal has stereotyped shape every
% time a stimulus hits it. We usually use the spm_hrf.m in SPM toolbox to
% produce HRF. Here, we use the 29 vector to represent HRF from 0 s to
% 28 s. In this simulation, we suppose TR=1 s. HRF = [0 0.004 0.043 0.121 0.188 0.211 0.193 0.153 0.108 0.069 0.038 0.016 0.001 -0.009 -0.015 -0.018 -0.019 -0.018 -0.015 -0.013 -0.010 -0.008 -0.006 -0.004 -0.003 -0.002 -0.001 -0.001 -0.001];
% We will plot its shape with figure 1:
figure(1)
% here is the x-coordinates
t = [0:28];
plot(t,HRF,'d-');
grid on;
xlabel('Time (s)');
ylabel('fMRI respond');
title('haemodynamic response function (HRF)');
结果:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Suppose that our scan for 120 s, we will have 120 point (because TR = 1
% s). If a stimulus onset at t=20 s, we can use a vector to represent this
% stimulation.
onset_1 = [zeros(1,19) 1 zeros(1,100)];
% i.e. the whole vector is maked with 19 zeros, a single 1, and then 100
% zeros. As we have the stimulus onset vector and HRF we can convolve them.
% In Matlab, the command to convolve two vectors is "conv":
conv_1 = conv(HRF,onset_1);
% Let's plot the result in figure 2
figure(2);
% This figure will have 2 rows of subplots.
subplot(2,1,1);
% "Stem" is a good function for showing discrete events:
stem(onset_1);
grid on;
xlabel('Time (s)');
ylabel('Stimulus onset');
subplot(2,1,2);
plot(conv_1,'rx-');
grid on;
xlabel('Time (s)');
ylabel('fMRI signal');
结果:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Usually, we have repeat a task many times in a run. If three stimulus
% onsets at t=20, 50, 80 s, we also can use a vector to represent this
% stimulation.
onset_2 = [zeros(1,19) 1 zeros(1,29) 1 zeros(1,29) 1 zeros(1,20)];
% Here we use the conv again:
conv_2 = conv(HRF,onset_2);
% Let's plot the result in figure 3
figure(3);
% This figure will have 2 rows of subplots.
subplot(2,1,1);
% "Stem" is a good function for showing discrete events:
stem(onset_2);
grid on;
xlabel('Time (s)');
ylabel('Stimulus onset');
subplot(2,1,2);
plot(conv_2,'rx-');
grid on;
xlabel('Time (s)');
ylabel('fMRI signal');
结果:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Now let's think about the fast event design. In this condition, we will
% have many task during a short time. If three stimulus onsets at t=20, 25,
% 30 s:
onset_3 = [zeros(1,19) 1 zeros(1,4) 1 zeros(1,4) 1 zeros(1,70)];
conv_3 = conv(HRF,onset_3);
figure(4);
subplot(2,1,1);
stem(onset_3);
grid on;
xlabel('Time (s)');
ylabel('Stimulus onset');
subplot(2,1,2);
plot(conv_3,'rx-');
grid on;
xlabel('Time (s)');
ylabel('fMRI signal');
结果:

% The three events are so closed, the result signal is like a blocked
% design. Such as:
onset_4 = [zeros(1,19) ones(1,11) zeros(1,70)]*(3/11);
conv_4 = conv(HRF,onset_4);
figure(5);
subplot(2,1,1);
stem(onset_4);
grid on;
xlabel('Time (s)');
ylabel('Stimulus onset');
subplot(2,1,2);
plot(conv_4,'rx-');
% We will compare the result
hold on; % plot more than one time on a figure
plot(conv_3,'bx-');
grid on;
xlabel('Time (s)');
ylabel('fMRI signal');
结果:

对于fmri的hrf血液动力学响应函数的一个很直观的解释-by 西南大学xulei教授的更多相关文章
- 对于fmri的设计矩阵构造的一个很直观的解释-by 西南大学xulei教授
本程序意在解释这样几个问题:完整版代码在本文的最后. 1.实验的设计如何转换成设计矩阵? 2.设计矩阵的每列表示一个刺激条件,如何确定它们? 3.如何根据设计矩阵和每个体素的信号求得该体素对刺激的敏感 ...
- fmri的图像数据在matlab中显示,利用imagesc工具进行显示,自带数据集-by 西南大学xulei教授
这里包含了这样一个数据集:slice_data.mat. 这个数据集中包含的mri数据是:64*64*25.共有25个slice.每个slice的分辨率是64*64. 程序非常简短: load sli ...
- [.NET] 打造一个很简单的文档转换器 - 使用组件 Spire.Office
打造一个很简单的文档转换器 - 使用组件 Spire.Office [博主]反骨仔 [原文]http://www.cnblogs.com/liqingwen/p/6024827.html 序 之前,& ...
- [转载]config文件的一个很好的实现
以下是转载于网上的一个很好的config文件的实现,留存以备案 //Config.h #pragma once #include <string> #include <map> ...
- route 一个很奇怪的现象:我的主机能ping通同一网段的其它主机,并也能xshell 远程其它的主机,而其它的主机不能ping通我的ip,也不能远程我和主机
一个很奇怪的现象:我的主机能ping通同一网段的其它主机,并也能xshell 远程其它的主机,而其它的主机不能ping通我的ip,也不能远程我和主机. [root@NB Desktop]# route ...
- C语言 在VS环境下一个很有意思的报错:stack around the variable was corrupted
今天做一个很简单的oj来温习下c 语言 题目如下 输入 3位正整数 输出 逆置后的正整数 代码如下: #include"stdio.h"int main(){ float h,su ...
- [C语言]一个很实用的服务端和客户端进行TCP通信的实例
本文给出一个很实用的服务端和客户端进行TCP通信的小例子.具体实现上非常简单,只是平时编写类似程序,具体步骤经常忘记,还要总是查,暂且将其记下来,方便以后参考. (1)客户端程序,编写一个文件clie ...
- 一个很好的Delphi博客
一个很好的Delphi博客,主人叫万一 http://www.cnblogs.com/del/archive/2011/09/21/2183007.html
- 一个很不错的bash脚本编写教程
转自 http://blog.chinaunix.net/uid-20328094-id-95121.html 一个很不错的bash脚本编写教程,至少没接触过BASH的也能看懂! 建立一个脚本 Lin ...
随机推荐
- POJ 3233 Matrix Power Series (矩阵快速幂+二分求解)
题意:求S=(A+A^2+A^3+...+A^k)%m的和 方法一:二分求解S=A+A^2+...+A^k若k为奇数:S=(A+A^2+...+A^(k/2))+A^(k/2)*(A+A^2+...+ ...
- hdu 2389(最大匹配bfs版)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2389 思路:纯裸的一个最大匹配题,不过悲摧的是以前一直用的dfs版一直过不了,TLE无数次啊,然后改成 ...
- amcharts简单封装
只是简单是封装了一下,目前只能输出线图(折现,圆滑线等),柱状图. 代码如下: ;!function(win,$,AC,undefined){ var DDcharts = function(o){ ...
- 【pku2115-C Looooops】拓展欧几里得-不定方程
http://poj.org/problem?id=2115 题解:一个变量从A开始加到B,每次加C并mod2^k,问加多少次.转化为不定方程:C*x+2^K*Y=B-A //poj2115 #inc ...
- 544B. Sea and Islands
题目链接 题意: n*n的里面全是S的方格中,填充L,若填充的L上下左右都没有相邻的L则是一个快,问题是能否形成k个块 n可以去奇数也可以去偶数 只要我们输出满足条件的一个结果就好了 对于从0 - n ...
- ios--集成支付宝钱包支付iOS SDK的方法与经验
文/胖花花(简书作者)原文链接:http://www.jianshu.com/p/fe56e122663e著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”. 没想到,支付宝的SDK是我目前 ...
- [iOS]利用系统NSRegularExpression使用正则表达式
// Created by 李东旭 on 16/1/22. // Copyright © 2016年 李东旭. All rights reserved. // #import <UIKit/UI ...
- openstack配置注意事项(主要是网络相关)
vlan协议应该配置为802.1q,另一个容易混淆的为ISL,配置命令为 switchport trunk encapsulation dot1q /islswitchport mode trunk ...
- C# 数组、一维数组、二维数组、多维数组、锯齿数组
C# 数组.一维数组.二维数组.多维数组.锯齿数组 一.数组: 如果需要使用同一类型的对象,就可以使用数组,数组是一种数据结构,它可以包含同一类型的多个元素.它的长度是固定的,如长度未知的情况下,请 ...
- SQL Server 联表字段合并查询
经常遇到统计报表中,子表记录合并为一个字段的情况.例如:省表中各省经济水平前五的城市统计. 有如下两表:dbo.省 和 dbo.市 (好吧,你可能会吐槽为什么用中文表名,其实我是为了方便查找替换) 这 ...