help > RE: New error importing SPM.mat files into CONN
Jul 30, 2015  04:07 PM | Alfonso Nieto-Castanon - Boston University
RE: New error importing SPM.mat files into CONN
Hi Ruth,

The SPM.mat files entered in the CONN "import" option should be the ones generated in SPM's "specify 1st-level design" option defining your experimental info (i.e. containing a SPM variable that describes your different conditions, source of functional data, etc.), not the .mat files containing SPM batch processing steps (i.e. containing a matlabbatch variable defining a set of preprocessing steps).

There are a couple of ways to do what you want using batch scripts:

1) If you have already created matlabbatch variables defining your desired SPM preprocessing options you may simply run those using the syntax:

 spm_jobman('initcfg');
 spm_jobman('run',matlabbatch);

 and then use CONN's batch.Setup fields to enter the resulting files into a new CONN project. If you need to run some additional preprocessing steps from CONN see these post (http://www.nitrc.org/forum/forum.php?thr...) for some additional info on how to do that. 

2) Alternatively, you may use CONN's batch.New fields to run all of the desired SPM preprocessing steps from CONN directly. This is typically the simplest approach since that will automatically add most of the relevant result files into CONN directly so you do not need to do that in your scripts (e.g. segmentation masks generated during SPM normalization step are added to Setup.ROIs, realignment parameters generated during SPM realignment step are added to Setup.CovariatesFirstLevel, etc.). See help conn_batch (batch.New options) for additional info on how to do this, but briefly you would just need to enter your original functional and anatomical files and then enter in batch.New.steps the desired SPM preprocessing steps (from your description it seems that perhaps the 'indirect normalization' default batch pipeline might be what you need, or at least it will serve as a good starting point)

Hope this helps
Alfonso 


Originally posted by Ruth Shaffer:
Hello,

I'm working on a pipeline that will batch preprocess resting state data part in SPM12 and part in CONNv15d.  In SPM, the current selected steps include: realign, slice timing, normalization, coregistration (one for each of 2 sessions), and normalize: write.  I hope to finish preprocessing in CONN using steps: ART based motion detection and smoothing.  I have SPM.mat files created for each subject that include just a 1X6 cell variable called "matlabbatch2" (that contains fields specifying each of the 6 steps listed above, as organized by SPM batch).  However, I keep getting an error when loading the .mat files:

ERROR DESCRIPTION:

Reference to non-existent field 'SPM'.

Error in conn_importspm (line 23)
if isfield(spmfile.SPM,'xBF')&&isfield(spmfile.SPM.xBF,'UNITS'),

Error in conn (line 2369)
conn_importspm;

Error in conn_menumanager (line 119)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});


Is it possible that my SPM.mat files are not formatted correctly (even though each of the SPM steps executed)?

Thank you in advance for any help you can give me!

Best,

Ruth Shaffer

Threaded View

TitleAuthorDate
Ruth Shaffer Jul 30, 2015
RE: New error importing SPM.mat files into CONN
Alfonso Nieto-Castanon Jul 30, 2015
Ruth Shaffer Jul 30, 2015