Hi Phil,
to write your first module for the batch system, it is probably best to look at some of the existing ones. I usually suggest the ImCalc or CheckReg modules, since these are very simple. What you need is:
1) a config file describing inputs, computation (a MATLAB function handle), outputs (dependencies, if applicable). Have a look at spm_cfg_imcalc or spm_cfg_checkreg.m
2) your computation function. It should take a single variable as input, which will be a struct with the fields defined as input items in the config file above.
If you want to pass outputs to other batch modules, it should return a single output variable. This variable can be any kind of MATLAB variable (struct, cell, array). To return multiple outputs of different types either a struct or a cell array are usually best suited.
3) some hook to get your module recognised by SPM. The easiest way is probably to place your code in a SPM toolbox. Make a folder in fullfile(spm('dir'), 'toolbox'), place your *_cfg_*.m file there and restart SPM. SPM will scan all toolbox folders for _cfg_ files and add them to the toolbox menu.
Hope this helps,
Volkmar
|