Archive

Archive for the ‘fmri’ Category

Fix narginchk Error using SPM

May 7th, 2019

Today I downloaded SPM 12 latest version, and when I tried to start it complained:

Error using narginchk (line 10)
too many input arguments

This error is caused by the conflict of multiple narginchk functions. To find out where they are, type

>> which -all narginchk
C:\Users\Xu Cui\Dropbox\spm12\external\fieldtrip\compat\matlablt2011b\narginchk.m
built-in (C:\MATLAB\R2015b\toolbox\matlab\lang\narginchk)

Then I simply renamed the first narginchk.m to a different name (e.g. _narginchk.m), and now it works.

Author: Xu Cui Categories: brain, fmri Tags:

Stanford psychologist’s brain scanned in MRI for 18 months, twice a week

December 14th, 2015

When I was a graduate student in Baylor College of Medicine I participated in an “exercise and brain” study in our lab as a subject, and got my brain scanned every week for about 10 weeks. I thought it was crazy; but apparently it’s not nearly as crazy as Russell Poldrack, a Stanford psychologist, who scanned his brain for 18 months, twice a week. Wow!

The result was published in Nature Communications in December, 2015.

I find what is amazing is that they shared their data publicly online. You can download the data at http://myconnectome.org/wp/.

Russell Poldrack’s Lab link: https://poldracklab.stanford.edu/

Author: Xu Cui Categories: brain, fmri Tags:

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:

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:

Secrete usage of xjview: Creating a mask based on anatomy

September 12th, 2012

Many users have created masks from a T-test image; xjView also allows you to create a mask based anatomy. Say, if you want to create a mask of Amygdala, how to do that?

(You need to use xjview 8.10. 1 min video demo at http://youtu.be/31q_6jumhhM)

1. launch xjview without any argument
2. don’t open any images
3. select an anatomical region (say Amygdala) in the box right to “Overlay” button
4. xjview will relaunch, and amygdala is shown
5. click menu “File -> Save current image as mask” to save a mask file

Author: Xu Cui Categories: brain, fmri Tags:

An fMRI ROI analysis program (beta)

September 10th, 2012

Previously I said I was developing a ROI analysis program (http://www.alivelearn.net/?p=1421). Here it is:

fMRI ROI Analysis

fMRI ROI Analysis

Download main program (beta version) at
http://www.alivelearn.net/xjview/xjviewpro/xjviewpro.p

Download sample input excel file:
http://www.alivelearn.net/xjview/xjviewpro/ROI_input.xlsx

Download sample output excel file:
http://www.alivelearn.net/xjview/xjviewpro/ROI_Result_ROI_input.xlsx

Download sample mask file at:
http://www.alivelearn.net/xjview/xjviewpro/myMask_Amygdala.img
http://www.alivelearn.net/xjview/xjviewpro/myMask_Amygdala.hdr

Any questions? Please leave a comment.

Author: Xu Cui Categories: brain, fmri Tags:

Convert coordinates in MNI space to matrix space

September 1st, 2012

Quite often you need to convert the coordinates of some voxels in MNI space to regular matrix coordinates. Below is a script to do so:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% mni2cor
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function coordinate = mni2cor(mni, T)
% function coordinate = mni2cor(mni, T)
% convert mni coordinate to matrix coordinate
%
% mni: a Nx3 matrix of mni coordinate
% T: (optional) transform matrix
% coordinate is the returned coordinate in matrix
%
% caution: if T is not specified, we use:
% T = ...
%     [-4     0     0    84;...
%      0     4     0  -116;...
%      0     0     4   -56;...
%      0     0     0     1];
%
% xu cui
% 2004-8-18
%

if isempty(mni)
    coordinate = [];
    return;
end

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

coordinate = [mni(:,1) mni(:,2) mni(:,3) ones(size(mni,1),1)]*(inv(T))';
coordinate(:,4) = [];
coordinate = round(coordinate);
return;

If you need to convert from matrix coordinates to MNI space, then here is the code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% 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;
Author: Xu Cui Categories: brain, fmri, matlab Tags: