Dear Liang,
you don't need to excuse yourself for asking this question. Although SPM is a toolbox of MATLAB functions, it does not come with a documented API. Each function itself is documented, but there is no comprehensive function index. In a nutshell, the following steps are what I teach students in SPM batch courses:
1. Use the GUI to set up a typical template for your study. Do not enter any subject specific data. Use dependencies to link outputs from one processing step to subsequent inputs. Use stuff from BasicIO to organise your batch (i.e. create directories, select files that are need as inputs more than once in your batch). Make sure to "clear value" for inputs that you want to set per subject.
2. Save this batch.
3. If you want to run a script for processing multiple subjects, use "Save batch & script". This will generate a script template that needs to be completed with MATLAB code that specifies the inputs for each subject.
4. Run the script.
If you are not interested in automation or you want to test your saved batch before, skip step 3 and 4 and fill in data for one subject. Then, let SPM do the processing and watch the outputs in MATLAB command window. You will find messages like this
Running job #X
...
Running "Check Registration"
SPM12: spm_check_registration (v$Rev$) 10:25:11 - 18/09/2015
========================================================================
Display /spm12/canonical/single_subj_T1.nii,1
...
The banner line "SPM12: ..." contains the top-level function name that is called. If this does not take you directly to the place you are looking for, do a full text search for more specific messages that appear during job execution. Most likely, this will take you right to the place in the code where interesting things happen.
Best,
Volkmar
|