We have noticed that the biggest problem that troubles beginners of functional magnetic resonance imaging is error reporting (Figure 1). Among all the errors, the computer environment setting (software installation) accounted for 40%, and the data sorting problem accounted for 50%. So please be sure to read this guide carefully, it will help you avoid 90% of possible errors, and save your precious time to focus on the analysis of results!

Figure 1. You definitely never want to see this error (“the red”) again

1. Installation of DPABI/DPABISurf

The prerequisites for DPABI/DPABISurf to run smoothly:

(0) A windows/mac/linux computer with relatively decent performance

The equivalent or higher performance of processors than the 7th Gen Intel-i5. More than 16G of the memory. Better to have a solid state drive (twin tail disk) and to reserve more than 300G disk space. If you use a PC with Windows operating system and want to use DPABISurf, you also need to upgrade Windows from Home Edition to Professional Edition (search for "Windows Professional Edition Upgrade" in Google to get a complete solution).


Many users would like to put SPM or DPABI into the toolbox of MATLAB, then there shouldn’t be any spaces, Chinese characters or special characters in the installation path! Such as

The installation path like "C:\Program files\MATLAB" is absolutely not allowed, as there is a space between Program and files! In addition, if your account name of the operating system ("Administrator" by default) contains Chinese characters, it is recommended to create a new English account (without spaces), and install MATLAB under this account.

(2) SPM

SPM is a free and open source software, please go to http://www.fil.ion.ucl.ac.uk/spm/software/download/ and fill in a table with some simple personal information to download. It is recommended to download SPM12. Remember that the software path should not include any spaces, Chinese characters or special characters!

(3) FSL (please ignore this if you are windows users)

If you are using a computer with a mac or linux system, you need to additionally install another MRI data processing software, FSL, please go to https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FslInstallation, and follow the steps on the web page to download and install it. Alternatively, you can install the docker version of DPABISurf.


Please go to http://rfmri.org/DPABI to download the latest version of DPABI (including DPARSF).

Installation of SPM and DPABI/DPARSF. Remember that the software path should not include any spaces, Chinese characters or special characters!

After downloading, open MATLAB and click "Set Path" (Figure 2).

Figure 2. Set path

First, click "default" to restore the path. Next click “Add Folder”to add SPM path. And then click "Add with subfolders" (Figure 3), find the location where DPABI is stored in the pop-up window and click "open" to add it. Finally, click "save" and close this window.


Figure 3. Add with subfolders

After that, you can input "dpabi" in the "command window" and press Enter. When you see the interface as shown below, you successfully completed the installation of DPABI/DPARSF.

Figure 4. DPABI

2. Data collation

DPABI/DPABISurf is a scientific and efficient R-fMRI pre-processing pipeline. But if you want DPABI/DPARSF to run smoothly, you need to organize your data in strict accordance with the requirements of DPABI/DPARSF. Tips: When you are organizing data, please use DPABI->Utilities->Check Data Organization repeatedly to check whether your data organization is qualified! Almost all the errors as "index exceeds dimensions" can be solved by the Check Data Organization!

(1) Create a "working directory"

Create a folder of any name (but it cannot contain any spaces, Chinese characters or special characters!) anywhere you want, which is the "working directory" of preprocessing. Most of the preprocessing operations are under "working directory". This is a very important concept, so please keep it in mind. For demonstration, we created a folder named "dpabi" as the working directory (Figure 5).

Figure 5. Working directory

(2) Copy the MRI data of subjects

Next, we need to the MRI data of subjects under the working directory according to the requirements of DPABI/DPARSF. The following is an example of three subjects:

Figure 6. An example of 3 subjects

This figure shows the form of the created folder. The working directory should include folders named "FunRaw" and "T1Raw". Each of them contains three folders: "Sub001", "Sub002", " "Sub003". This example is of the situation of three subjects, please follow this pattern for more subjects.

The “FunRaw” folder contains the functional image data, while the “T1Raw” folder contains the structural images. You need to select the folder containing functional images or structural images from the raw data, and then copy the image data into the corresponding folder.

Note 1: DPABI/DPARSF has very strict requirements on sorting the data format under the working directory. The names of the two folders "FunRaw" and "T1Raw" must be in full compliance with this form, and should not be changed, otherwise the “error” will be reported. Although the name of subject folders such as "Sub001", "Sub002", and "Sub003" are more arbitrary and you can change them according to your needs, you should still keep the names of corresponding subject folders in "FunRaw" and "T1Raw" are exactly the same. Any difference will cause an error. An example is when a student accidentally entered an extra space at the end when naming a folder, which resulted in an error.

Note 2: The example here fits when the raw data you had is in dicom format. If your data is in NIFTI format, please rename the two folders "FunRaw" and "T1Raw" as "FunImg" and "T1Img". The way to judge the dicom/NIFTI format: the number of data files in the dicom format is very large (hundreds to thousands); while the number of data files in the NIFTI format is one for each subject and each sequence is only one (4D .nii file) or hundreds (3D .img/.hdr files).

Note 3: Generally speaking, the raw data is organized according to the sequence and the data of each scan sequence has its corresponding folder. But sometimes the data is completely messy, then you need to use the "Dicom Sorter" function of DPABI to organize the messy raw data into a form that we can understand.

To open Dicom Sorter, please call DPABI and click Utilities->DICOM Sorter

Figure 7. Dicom Sorter


Fill in the suffix of the original file in the "Suffix" box. If there is no suffix, clear this box. Next click "Add All" to find the folder that contains all the original files. Finally enter the output directory you want in "Output Dir" box and click the "Sort" button. It should be noted that if there is no suffix, the original folders should not contain any other types of files except DICOM ones, otherwise you will get an error.

(3) What should I do if “errors” show up?

It's frustrating to see "the red", but you can always log in at http://rfmri.org/DPABIDiscussion, and quickly search by the keyword of the error to see how the previous people solved it. If you do not find the relevant answer, you can also post for help. However, you may need to wait for a while to get the solution. So, before you asking for help, we have a few simple tips for you to take home and worth trying when "the red" shows up.

(1) Run with our Demo Data

Please go to http://rfmri.org/DemoData to download the demo data for processing.

(2) Run with data of one/several subject(s)

You can randomly select one or several subject(s) to run as a test. If your data of these subjects can pass the test, then there is a high probability that the error is caused by the data of some other subjects. At this time, you need to carefully take a look at whether the name of some folder does not correspond strictly, or whether the data of some subject is not copied completely. You can easily infer it from the number of dicom files. Normally, the number of dicom files for each sequence of a same batch of subjects is also the same. You can easily find the problem where the number of dicom files of a subject is inconsistent with others.

(3) Reinstall the software/use another computer

If errors were always reported even though you had tried with data of many subjects, the issue may get a bit tricky. It may be caused by the unfitness of the operating environment. At this time, you can try to uninstall the software, then reinstall it and reboot your computer. Or simply using another computer may resolve this issue. This operating sequence of solutions can be considered: 1) rerun; 2) shutdown and restart matlab; 3) reboot the computer; 4) reinstall DPABI/SPM; 5) reinstall matlab; 6) reinstall windows; 7) try another computer.






1. 这种报错(“红字”)你绝不想看到第二遍






“C:\Program files\MATLAB”这样的安装路径就绝对不可以!因为在Programfiles之间有一个空格!



3 FSL windows用户请忽略)





下载完成后打开MATLAB,点击“Set Path”(图2)。

2. Set path

首先点击“default”将路径还原,随后点击“Add Folder”来添加SPM路径。接着点击“Add with Subfolders”(图3),在弹出的窗口中找到存放DPABI的位置,点击“open”添加,最后点击“save”即可关闭此窗口


3. add with subfolders

随后在“command window”内输入“dpabi”后回车,当您看到如下图的界面时,就完成DPABI/DPARSF的安装了。


2. 数据的整理

DPABI/DPABISurf是一套科学高效的R-fMRI预处理流程,但如果要顺利地让DPABI/DPARSF运作,您必须严格按照DPABI/DPARSF的要求整理好您的数据。提示:在整理数据中,请反复用DPABI->Utilities->Check Data Organization检查数据整理是否合格!几乎所有“索引超出维度”的问题都可以通过Check Data Organization来解决!







注意点1: DPABI/DPARSF对工作路径下的数据格式整理要求是非常严格的,“FunRaw”“T1Raw”这两个文件夹名称必须完全按照规定中的要求,不能有任何变化,否则就会报错。“Sub001”“Sub002”“Sub003”这样的被试文件夹虽然比较自由,您可以根据自己的需求修改,但是必须保持“FunRaw”“T1Raw”两个文件夹下对应的被试文件夹名称完全一致,有任何不同都会导致报错。一个例子是有学员不小心在命名文件夹时在最后多输了一个空格,结果就导致了报错。

注意点2: 这里示范的是当您手中的原始数据是dicom格式的条件下,如果您手中的数据是NIFTI格式的,请将“FunRaw”“T1Raw”两个文件夹重命名为“FunImg”“T1Img”。判断dicom格式/NIFTI格式的方法:dicom格式的数据文件数量非常多(成百上千),NIFTI格式的数据文件数量每个被试,每个序列只有一个(4D .nii文件),或数百个(3D .img/.hdr文件)。

注意点3: 一般而言,原始数据是按照序列组织的,每个扫描序列的数据都有对应的文件夹,但有时数据完全是杂乱无章的,这时就需要使用DPABI“Dicom Sorter”功能了,它可以将杂乱无章的原始数据整理成我们可以理解的形式。

要打开Dicom Sorter,请启动DPABI后依次点击Utilities->DICOM Sorter


“Suffix”栏中填写原始文件的后缀,如果没有后缀就将这一栏清空;点击“Add All”后找到包含所有原始文件的那个文件夹;最后在“Output Dir”中输入您想要输出结果的路径,点击“Sort”键即可,需要注意的是,如果没有后缀的话原始文件夹中不能包含除了DICOM格式之外任何其它类型的文件,否则会报错。

3. 出错了怎么办?


(1)先用我们的演示数据Demo Data跑






4. 要提问求助怎么办?

(1)   提问前请仔细学习严老师的免费在线网络课程http://rfmri.org/Course,大多数问题在这里都有答案!认真观看3遍以后再提问。

(2)   请认真阅读严老师的DPABI/DPABISurf/DPARSF报错处理指南https://www.rfmri.org/DPABIErrorHandling,尝试自行排除错误。

(3)   请在在http://rfmri.org搜索相应的报错信息,看看前人是否遇到过相似的错误,严老师是如何回答的,参照解决。

(4)   如果以上方法无法解决你的问题,请在http://rfmri.org提交你的问题。这里面提交的问题肯定都能获得回答的,只是可能会有些滞后。

(5)   建议你选4,不过偶尔也可以在The R-fMRI Journal Club微信群(微信添加rfmriorg2进群)提问。严老师每天早晨统一挑选回答一次。

(6)   如果需要连续交互式提问,请到每周一次的严老师直播解“惑”课提问!直面所有问题,直播答问视频。请访问http://y.deepbrain.com

(7)   如果需要通过参加集中特训解决所有问题,建议参加DPABI/DPABISurf/DAPRSF特训营(http://rfmri.org/DPABICamp7)!