April 2009

REST codes analysis

Thanks to Guillaume Flandin's m2html, the whole up-to-date REST codes is analyzed in html web format at:
 http://restfmri.net/pub/rest_20090422/doc/ .

ReHo: quickly get the ranks for matrix

Hi, Xiao-Wei

I just write these here and suggest you use methods below to get the ranks more quickly:
(here I suppose symbol V means a 4D fMRI matrix)
R should be the ranks 4D matrix, which can be used for ReHo computation. These two lines code make computation faster in MATLAB (around 10s for one 4D fMRI data).

Say hi to your guys

RE: long mixed session of rest and task

A long session, 22 minutes: Resting state 9 minutes, and then a blocked design (2 minutes task + 30s rest) 13 minutes. The questions are:
(1) Is the head motion a concern?
(2) Can the 9-minutes rest be used as a baseline for the data analysis of the blocked design?

My answer:
(1) Yes. There may be more head motion for such a long session. But occasionally, a long rest is necessary (e.g., epilepsy and sleep study).

Some Useful Programs



if ACovariablesDef.polort>=0,
thePolOrt =(1:sampleLength)';
thePolOrt =repmat(thePolOrt, [1, (1+ACovariablesDef.polort)]);
for x=1:(ACovariablesDef.polort+1),
thePolOrt(:, x) =thePolOrt(:, x).^(x-1) ;
% switch ACovariablesDef.polort,
% case 0,
% thePolOrt =ones(sampleLength, 1);
% case 1,

Out of memory--Error message for running ReHo and FC tools

Dear REST experters:

      I am new to run REST toolbox. When running ReHO and FC, get the following error messages. I don't know what wrong I did. BTW, do you have some stand along program or easy tools for extracting the time course data. Thanks in advance.


error messages:

ReSample Mask in REST

I public a mail concerning about how to resample a mask when defining a ROI.

The script is attached at the end of this topic and should save as "rest_reSample3D.m".

It is just used to do with mask, and no warranty I could give, although Bui verified the script and it worked.

The way of using this resample script is to put it in REST's directory and

Result Mask=rest_reSample3D(Original Mask, You Desired Dimension);

Examples could be reviewed in the following mail.

Just a Quick Suggestion at Midnight!

Hi My Friends,

I am saying hi to you guys all. Long time no visiting the forum, sorry, recent life is really filled with all things. Just go through all posted messages and push a possible step for REST:

Perhaps it is a pretty good idea for adding task-data-based functional connectivity into REST, i mean functional cnnectivity and ReHo, ALFF/fALFF all these stuff can also be made bu such a way. Look the requests from users from their posts.

All In Advances


REST software manual in PDF format

Hi, there,

   Do you have the application of REST software in PDF format? If any, pls let me know where I can download since I have downloaded the document of data process using REST in videotype and REST-software in SPM extension. Thanks in advance.


Resting-state fMRI data analysis toolkit V1.3 (静息态功能磁共振数据处理工具包 V1.3)

Resting-State fMRI Data Analysis Toolkit (REST) is a convenient toolkit to calculate Functional Connectivity (FC), Regional Homogeneity (ReHo), Amplitude of Low-Frequency Fluctuation (ALFF), Fractional ALFF (fALFF). You also can use REST to view your data, perform Monte Carlo simulation similar to AlphaSim in AFNI, calculate your images, regress out covariates, extract ROI time courses, reslice images and sort DICOM files. Download a MULTIMEDIA COURSE would be helpful for knowing more about how to use this software. Add REST's directory to MATLAB's path and enter "REST" in the command window of MATLAB to enjoy it.

The latest release is REST2007V1.3_100201.


Multimedia Course: Data Processing of Resting-State fMRI

New features of REST V1.3 release 100201:
1. Modules added:
  (1) REST GCA 1.0 Beta: perform Granger Causality Analysis. Contributed by ZANG Zhen-Xiang, please see more details by clicking here
  (2) False Discovery Rate (FDR) Correction: under REST Slice Viewer / Misc Menu
2. Functions revised:
  (1) Make the outputname as 00001.img other than 1.img in REST Image Calculator.
3. Bugs Fixed:
  (1) Fixed a bug in ROI-wise functional connectivity calculation.

New features of REST V1.3 release 091215 (This release is updated by YAN Chao-Gan and DONG Zhang-Ye):
1. Modules added:
  (1) REST DICOM Sorter: sort and anonymize (optional) DICOM files.
2. Functions revised:
  (1) Adding more explanation of the correspondence between  x coordinates and Left/Right hemisphere when setting sphere ROI.
3. Bugs Fixed:
  (1) Fixed a bug in REST AlphaSim when rmm=6.
  (2) Fixed a bug in REST Image Calculator when creating output directory.
  (3) Fixed a bug that can not close the Utilities when quit REST.
  (4) Fixed a bug of displaying fALFF GUI in some Matlab versions (Missed a F, as Mr. SONG Xiao-Wei reported).

New features of REST V1.3 release 091201 (This release is updated by YAN Chao-Gan, DONG Zhang-Ye and ZHU Wei-Xuan):
1. Modules added:
  (1) REST AlphaSim: perform Monte Carlo simulation similar to AlphaSim in AFNI.
  (2) REST Image Calculator: calculate images, especially for group images.
  (3) Regress Out Covariates: regress nuisance covariates out.
  (4) Extract ROI Time Course: extract ROI time courses for multiple subjects.
  (5) Reslice Image: resclice images to a new vox size and new target space.
  (6) NIfTI nii to NIfTI pairs: convert NIfTI .nii (3D or 4D) files to NIfTI pairs (.hdr/.img) since REST only can process 3D .hdr/.img files.
2. Functions revised:
  (1) REST Slice Viewer: added P<->T, P<->F, P<->Z, P<->R conversion when threshoulding images; reading degree of freedom information from SPM statistical images; only+ and only-; save all clusters; cluster report functions; more AlphaSim thresholds (rmm=4, 5 and 6) for BrainMask_05_61x73x61.img; and make the Cluster Connectivity Criterion could be chosen among 6 voxels (surface), 18 voxels (edge) or 26 voxels (corner) according to rmm value.
  (2) ReHo: It should be noted that the previous release of REST does not calculate the ReHo value of the voxels near the border of the brain mask, i.e., any voxel of the 27 voxels in the cluster is outside the brain mask. The new release (here the closed test version) will calculate the ReHo value of the voxels near the border of the brain mask, users should be cautious when discussing the results near the border.
  (3) Functional Connectivity: Now it can process multiple subjects with different seed time courses (.txt) in batch mode. Give the seed time course configuration file as:
  (4) REST: Checking and fixing the error of reading and writing NIfTI images when REST starts
  (5) rest_to4d: If data has too huge or too many volumes, then it will be loaded into memory in 'single' format.
  (6) Templates: Added 3x3x3 AAL template and Brodmann template.
3. Bugs Fixed:
  (1) Fixed the bugs of color, montage and resize in REST Slice Viewer.
  (2) Fixed the bug of writing ANALYZE images.
  (3) Fixed the bug of writing data caused by finite in MATLAB 2009.
  (4) LastSphereMask would be stored under temp dir other than {REST_DIR} in case the users do not have write permission to {REST_DIR}.