help > Error importing SPM.mat file
Showing 1-24 of 24 posts
Display:
Results per page:
Nov 25, 2014  06:11 PM | Xiaozhen You
Error importing SPM.mat file
Dear experts,
I'm encountering the error during the Setup using SPM.mat files in batch. and I did some debugging, seems conn_importspm goes before assigning other Setup info to the global variable CONN_x. Wonder how to fix this.
Also if I have 2 different tasks within subjects, thus with 2 different SPM.mat file, can I also setup the spmfiles as spmfiles{nsub}{nsession} for conn_batch to automatically recognize the conditions etc?
Thanks!
Xiaozhen

"Reference to non-existent field 'Setup'.

Error in conn_importspm (line 9)
if nsubjects~=CONN_x.Setup.nsubjects,
CONN_x.Setup.nsubjects=conn_merge(CONN_x.Setup.nsubjects,nsubjects); end
Error in conn_batch (line 242)
conn_importspm(batch.Setup.spmfiles);
Error in BatchScript_withexcel_Connallfields_spm (line 188)
conn_batch(batch);"






if isfield(batch.Setup,'spmfiles')&&~isempty(batch.Setup.spmfiles),
        CONN_x.gui=struct('overwrite',batch.Setup.overwrite);
        conn_importspm(batch.Setup.spmfiles);
        CONN_x.gui=1;
    end
    if isfield(batch.Setup,'RT')&&~isempty(batch.Setup.RT),CONN_x.Setup.RT=batch.Setup.RT;end
    if isfield(batch.Setup,'nsubjects')&&~isempty(batch.Setup.nsubjects),
        if batch.Setup.nsubjects~=CONN_x.Setup.nsubjects, CONN_x.Setup.nsubjects=conn_merge(CONN_x.Setup.nsubjects,batch.Setup.nsubjects); end
%         CONN_x.Setup.nsubjects=batch.Setup.nsubjects;     % number of subjects
    end
Nov 26, 2014  02:11 AM | Alfonso Nieto-Castanon - Boston University
RE: Error importing SPM.mat file
Dear Xiaozhen,

The most likely reason for this error would be if you forgot to include a batch.filename and/or a batch.isnew fields in your batch structure. When you do not specify an filename for your project CONN assumes that you want to work on the currently-active project (that loaded in the CONN gui), and the error that you are getting seems to indicate that you do not have the GUI open. If you want to create a new project (e.g. named conn_myproject.mat) simply add the following fields to your batch script when defining your batch structure:

  batch.filename = 'conn_myproject.mat';
  batch.Setup.isnew = true;

Hope this helps (if this does not seem to be the issue please send or post the relevant portions of your batch script to more easily identify the problem)
Alfonso

Originally posted by Xiaozhen You:
Dear experts,
I'm encountering the error during the Setup using SPM.mat files in batch. and I did some debugging, seems conn_importspm goes before assigning other Setup info to the global variable CONN_x. Wonder how to fix this.
Also if I have 2 different tasks within subjects, thus with 2 different SPM.mat file, can I also setup the spmfiles as spmfiles{nsub}{nsession} for conn_batch to automatically recognize the conditions etc?
Thanks!
Xiaozhen

"Reference to non-existent field 'Setup'.

Error in conn_importspm (line 9)
if nsubjects~=CONN_x.Setup.nsubjects,
CONN_x.Setup.nsubjects=conn_merge(CONN_x.Setup.nsubjects,nsubjects); end
Error in conn_batch (line 242)
conn_importspm(batch.Setup.spmfiles);
Error in BatchScript_withexcel_Connallfields_spm (line 188)
conn_batch(batch);"






if isfield(batch.Setup,'spmfiles')&&~isempty(batch.Setup.spmfiles),
        CONN_x.gui=struct('overwrite',batch.Setup.overwrite);
        conn_importspm(batch.Setup.spmfiles);
        CONN_x.gui=1;
    end
    if isfield(batch.Setup,'RT')&&~isempty(batch.Setup.RT),CONN_x.Setup.RT=batch.Setup.RT;end
    if isfield(batch.Setup,'nsubjects')&&~isempty(batch.Setup.nsubjects),
        if batch.Setup.nsubjects~=CONN_x.Setup.nsubjects, CONN_x.Setup.nsubjects=conn_merge(CONN_x.Setup.nsubjects,batch.Setup.nsubjects); end
%         CONN_x.Setup.nsubjects=batch.Setup.nsubjects;     % number of subjects
    end
Nov 26, 2014  03:11 PM | Xiaozhen You
RE: Error importing SPM.mat file
Thank you Alfonso! Yes indeed that was the issue! :)
I commented out that line in the "New" step which caused the problem.

Regarding can subjects have 2 SPM.mat file referring two different task(sessions)? 
Seems not feasible at this point except treating each task as from a different subject for setup?

Thanks!
Nov 27, 2014  03:11 AM | Alfonso Nieto-Castanon - Boston University
RE: Error importing SPM.mat file
Hi Xiaozhen,

This request has come up in the past, so I am attaching a patch that should allow you to enter multiple SPM.mat files per subject (in the way that you describe, simply define batch.spmfiles{nsub}{nsession}=filename for each subject/session combination). Simply copy the attached file into the CONN distribution folder overwriting the file with the same name there. Let me know if everything works as expected and I will have this added to the next release of the toolbox as well. 

Best
Alfonso


Originally posted by Xiaozhen You:
Thank you Alfonso! Yes indeed that was the issue! :)
I commented out that line in the "New" step which caused the problem.

Regarding can subjects have 2 SPM.mat file referring two different task(sessions)? 
Seems not feasible at this point except treating each task as from a different subject for setup?

Thanks!
Attachment: conn_importspm.m
Nov 27, 2014  05:11 AM | Xiaozhen You
RE: Error importing SPM.mat file
Great, I'll give it a try with this file. Thanks again and happy thanksgiving!
Xiaozhen
Dec 9, 2014  06:12 PM | Xiaozhen You
RE: Error importing SPM.mat file
Hi Alfonso,
Thank you again for your timely and kind help. It did pull in the 2 sessions of SPM correctly. To follow up this thread, somehow after I use the attached script I reran the set up and denoising steps, it all went through fine and I can check the output without error, but in the first level analysis tab, it'll always give me the error asking me to rerun the setup (see below), then tried reran, but still getting the same error. Is it because the SPMcovariates that automatically imported in might be with different dimensions?
So in my SPM8 1st level design, my regressors of motion might be different across subjects if some of them have no outliers of bad volumes. would this be a problem?

ps, everytime I rerun the setup (by hit done), it takes so long if adding a new 2nd level covariate, is this normal?

I'm attaching the conn.mat file just in case you want to take a look at it to help solve the issue.

Thanks a lot in advance!

ERROR DESCRIPTION:

Error using conn_designmatrix (line 32)
Mismatch info: Please re-run Setup step
Error in conn_process (line 1536)
[X,nill,names]=conn_designmatrix(CONN_x.Analyses(ianalysis).regressors,X1,[]);
Error in conn_process (line 25)
case 'analyses_gui_seed',disp(['CONN: RUNNING ANALYSIS STEP (ROI-to-ROI or seed-to-voxel analyses)']); conn_process([10:12,15],CONN_x.Analysis);
Error in conn (line 3085)
conn_process('analyses_gui_seed',CONN_x.Analysis);
Error in conn_menumanager (line 102)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});
CONN v.14.n
SPM8 + Anatomy ArtRepair Beamforming DEM FieldMap INRIAlign LI MEEGtools PPPI TOM8 aal marsbar wfupickatlas
Matlab v.2012b
Dec 10, 2014  01:12 AM | Alfonso Nieto-Castanon - Boston University
RE: Error importing SPM.mat file
Hi Xiaozhen

Sorry the error message was not very descriptive in this case (and thank you for sending the conn.mat file, that really helped). The issue here seems to be a lot of duplicated ROI names in your Parcels_MNI_333.nii file (most likely the reason is an incorrectly formatted associated Parcels_MNI_333.txt or Parcels_MNI_333.csv file; CONN is only finding 14 unique ROI names in there across the 333 ROIs). If you could please send me that .txt/.csv/.xls file I will quickly check if this is the problem here and tell you how to best fix it (and I will add an additional check in the toolbox to give an early and more meaningful warning/error message in the future for this sort of issues).

Best
Alfonso

Originally posted by Xiaozhen You:
Hi Alfonso,
Thank you again for your timely and kind help. It did pull in the 2 sessions of SPM correctly. To follow up this thread, somehow after I use the attached script I reran the set up and denoising steps, it all went through fine and I can check the output without error, but in the first level analysis tab, it'll always give me the error asking me to rerun the setup (see below), then tried reran, but still getting the same error. Is it because the SPMcovariates that automatically imported in might be with different dimensions?
So in my SPM8 1st level design, my regressors of motion might be different across subjects if some of them have no outliers of bad volumes. would this be a problem?

ps, everytime I rerun the setup (by hit done), it takes so long if adding a new 2nd level covariate, is this normal?

I'm attaching the conn.mat file just in case you want to take a look at it to help solve the issue.

Thanks a lot in advance!

ERROR DESCRIPTION:

Error using conn_designmatrix (line 32)
Mismatch info: Please re-run Setup step
Error in conn_process (line 1536)
[X,nill,names]=conn_designmatrix(CONN_x.Analyses(ianalysis).regressors,X1,[]);
Error in conn_process (line 25)
case 'analyses_gui_seed',disp(['CONN: RUNNING ANALYSIS STEP (ROI-to-ROI or seed-to-voxel analyses)']); conn_process([10:12,15],CONN_x.Analysis);
Error in conn (line 3085)
conn_process('analyses_gui_seed',CONN_x.Analysis);
Error in conn_menumanager (line 102)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});
CONN v.14.n
SPM8 + Anatomy ArtRepair Beamforming DEM FieldMap INRIAlign LI MEEGtools PPPI TOM8 aal marsbar wfupickatlas
Matlab v.2012b
Dec 10, 2014  01:12 AM | Alfonso Nieto-Castanon - Boston University
RE: Error importing SPM.mat file
Also, I forgot to mention, when adding new second-level covariates to your design you do not need to re-run any of the Setup/Denoising/first-level Analysis steps. Those new covariates will already be available when you go to the second-level Results tab without any additional step (this, of course, only applies to second-level covariates; when you add new first-level covariates, conditions, ROIs, or subjects you still need to re-run those steps). 

Hope this helps
Alfonso
Originally posted by Alfonso Nieto-Castanon:
Hi Xiaozhen

Sorry the error message was not very descriptive in this case (and thank you for sending the conn.mat file, that really helped). The issue here seems to be a lot of duplicated ROI names in your Parcels_MNI_333.nii file (most likely the reason is an incorrectly formatted associated Parcels_MNI_333.txt or Parcels_MNI_333.csv file; CONN is only finding 14 unique ROI names in there across the 333 ROIs). If you could please send me that .txt/.csv/.xls file I will quickly check if this is the problem here and tell you how to best fix it (and I will add an additional check in the toolbox to give an early and more meaningful warning/error message in the future for this sort of issues).

Best
Alfonso

Originally posted by Xiaozhen You:
Hi Alfonso,
Thank you again for your timely and kind help. It did pull in the 2 sessions of SPM correctly. To follow up this thread, somehow after I use the attached script I reran the set up and denoising steps, it all went through fine and I can check the output without error, but in the first level analysis tab, it'll always give me the error asking me to rerun the setup (see below), then tried reran, but still getting the same error. Is it because the SPMcovariates that automatically imported in might be with different dimensions?
So in my SPM8 1st level design, my regressors of motion might be different across subjects if some of them have no outliers of bad volumes. would this be a problem?

ps, everytime I rerun the setup (by hit done), it takes so long if adding a new 2nd level covariate, is this normal?

I'm attaching the conn.mat file just in case you want to take a look at it to help solve the issue.

Thanks a lot in advance!

ERROR DESCRIPTION:

Error using conn_designmatrix (line 32)
Mismatch info: Please re-run Setup step
Error in conn_process (line 1536)
[X,nill,names]=conn_designmatrix(CONN_x.Analyses(ianalysis).regressors,X1,[]);
Error in conn_process (line 25)
case 'analyses_gui_seed',disp(['CONN: RUNNING ANALYSIS STEP (ROI-to-ROI or seed-to-voxel analyses)']); conn_process([10:12,15],CONN_x.Analysis);
Error in conn (line 3085)
conn_process('analyses_gui_seed',CONN_x.Analysis);
Error in conn_menumanager (line 102)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});
CONN v.14.n
SPM8 + Anatomy ArtRepair Beamforming DEM FieldMap INRIAlign LI MEEGtools PPPI TOM8 aal marsbar wfupickatlas
Matlab v.2012b
Dec 10, 2014  02:12 AM | Xiaozhen You
RE: Error importing SPM.mat file
Thank you for such prompt response Alfonso!
Yes here is the roi file and the text file for the look up. It was downloaded from the WUSTL group, and I modified it from their excel file to match how the BA.img's corresponding text file look like.
Maybe I did something wrong in the process. It's indeed little different in the sense that there can be a group of rois that has the same name..
Thank you for checking it out!
Xiaozhen
Attachment: Parcels_MNI_333.txt
Dec 12, 2014  01:12 AM | Alfonso Nieto-Castanon - Boston University
RE: Error importing SPM.mat file
Hi Xiaozhen

Yes, the issue here seems to be a problem with the formatting of Parcels_MNI_333.txt. There are two .txt formats that CONN interprets, one where you simply provide a list of ROI labels (the length of this list should be equal to the largest ROI id found in the associated .nii file; e.g. the BA.txt file), and another where you provide a list of tab-separated ROI id's and ROI names (e.g. Freesurfer *LUT.txt files). CONN was interpreting your file as the former type (taking the first column of numbers to identify the id's, from 1 to 333, and the strings at the right to identify the ROI names). The problem was that the provided list of ROI names was not unique (it contained replicated ROI names).

If you intended your file to be interpreted as the first type above (e.g. the first ROI would be named "1 Default", '2 SMhand", etc.) then simply remove the extra line at the end of your Parcels_MNI_333.txt file and that should fix this (after repeating the "Setup" step), since a mismatch between the number of lines in your .txt file and the number of id's in your .nii file is what is making CONN identify this file as the latter style.

If, on the other hand, you intended your file to be interpreted as the second type above (e.g. the first ROI would be named "Default", associated with ROI id = 1, the second "SMhand" associated with id = 2, etc.) you can either resolve those repeated names manually or use the attached patch to have REX resolve those repeated ROI-names automatically (repeated ROI-names will be resolved by adding numbers at the end of the ROI name, e.g. Default1, Default2, ..., Default40 for your file). To use this patch simply copy the attached file to your CONN distribution folder overwriting the file with the same name there (and then repeat the "Setup" step)

Hope this helps
Alfonso
Originally posted by Xiaozhen You:
Thank you for such prompt response Alfonso!
Yes here is the roi file and the text file for the look up. It was downloaded from the WUSTL group, and I modified it from their excel file to match how the BA.img's corresponding text file look like.
Maybe I did something wrong in the process. It's indeed little different in the sense that there can be a group of rois that has the same name..
Thank you for checking it out!
Xiaozhen
Attachment: rex.m
Dec 17, 2014  05:12 PM | Xiaozhen You
RE: Error importing SPM.mat file
Thank you Alfonso for the reply, yes the case for me is the latter. I also modified the txt file now with unique name now, but glad REX can now do it automatically!
Dec 23, 2014  04:12 AM | Xiaozhen You
RE: Error importing SPM.mat file
Hi Alfonso,
Sorry to bother you again :)
I finally got the con_importspm to work to import 2 sessions per subject, and also setting different session condition with different name using the script you sent to me, but now it gave me the following error (I updated the conn to p version now)
Warning: Contents.m overloaded by version in folder /data/apps/spm/8/toolbox/TOM8
SOME ERROR FOUNDS!: Please revise the Setup information
ERROR: Subject 1 does not have any scan associated with condition nonsal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 1 does not have any scan associated with condition noresp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 1 does not have any scan associated with condition resp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 1 does not have any scan associated with condition sal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 1 does not have any scan associated with condition nonsal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 1 does not have any scan associated with condition noresp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 1 does not have any scan associated with condition resp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 1 does not have any scan associated with condition sal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 2 does not have any scan associated with condition nonsal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 2 does not have any scan associated with condition noresp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 2 does not have any scan associated with condition resp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 2 does not have any scan associated with condition sal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 2 does not have any scan associated with condition nonsal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 2 does not have any scan associated with condition noresp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 2 does not have any scan associated with condition resp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 2 does not have any scan associated with condition sal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 3 does not have any scan associated with condition nonsal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 3 does not have any scan associated with condition noresp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 3 does not have any scan associated with condition resp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 3 does not have any scan associated with condition sal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 3 does not have any scan associated with condition nonsal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 3 does not have any scan associated with condition noresp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 3 does not have any scan associated with condition resp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 3 does not have any scan associated with condition sal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 4 does not have any scan associated with condition nonsal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 4 does not have any scan associated with condition noresp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 4 does not have any scan associated with condition resp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 4 does not have any scan associated with condition sal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 4 does not have any scan associated with condition nonsal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 4 does not have any scan associated with condition noresp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 4 does not have any scan associated with condition resp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 4 does not have any scan associated with condition sal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 5 does not have any scan associated with condition nonsal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 5 does not have any scan associated with condition noresp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 5 does not have any scan associated with condition resp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 5 does not have any scan associated with condition sal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 5 does not have any scan associated with condition nonsal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 5 does not have any scan associated with condition noresp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 5 does not have any scan associated with condition resp_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
ERROR: Subject 5 does not have any scan associated with condition sal_Session1_Session1_Session1_Session1_Session1_Session1_Session1_Session1
...
...
CONN: RUNNING PREPROCESSING STEP

Step 2/7: Importing conditions/covariates
100.0%  (Subject 88 Session 2)
Not ready to process step conn_process_5
CONN: RUNNING ANALYSIS STEP
Error using conn_process (line 1431)
Some conditions have not been processed yet. Re-run
previous step
Error in conn_process (line 19)
case 'analyses',        disp(['CONN: RUNNING
ANALYSIS STEP']);
conn_process([9,10:13,15],varargin{:});
Error in conn_batch (line 617)
conn_process('Analyses',batch.Analysis.analysis_number);
Error in BatchScript_withexcel_Connallfields_spm (line
228)
conn_batch(batch);

I"m attaching the conn_mat file, and also the script I wrote to run the batch. Not sure what I did wrong.
Thanks again for debugging it for me!
Xiaozhen
Dec 23, 2014  04:12 AM | Xiaozhen You
RE: Error importing SPM.mat file
HI Alfonso,
I noticed I could only upload one file at a time.
Here is the matlab script.. :)
Dec 24, 2014  05:12 AM | Alfonso Nieto-Castanon - Boston University
RE: Error importing SPM.mat file
Hi Xiaozhen,

Sorry for the misunderstanding, the original script that I sent you (in order to modify the SPM.mat files to make all conditions session-specific) was meant to be run just once, not as part of your batch scripts. Running it multiple times ended up creating all of those strange-looking _Session1_Session1_Session1_... condition names (also it would seem that the script was run different number of times for different subjects so your project ends up having different condition names across different subjects which results in the error message that you get). In any way, in your script simply change the lines that read:

  load(spmfile_i,'SPM');
  for nses=1:length(SPM.Sess),
    for ncondition=1:length(SPM.Sess(nses).U),
      SPM.Sess(nses).U(ncondition).name{1}=[SPM.Sess(nses).U(ncondition).name{1}, sprintf('_Session%d',nses)];
    end
  end
  save(spmfile_i,'SPM');

to:

  load(spmfile_i,'SPM');
  for nses=1:length(SPM.Sess),
    for ncondition=1:length(SPM.Sess(nses).U),

      strappend = sprintf('_Session%d',nses);
      newname = [regexprep(SPM.Sess(nses).U(ncondition).name{1},sprintf('(%s)*$',strappend),'') strappend];
      SPM.Sess(nses).U(ncondition).name{1}=newname;    end
  end
  save(spmfile_i,'SPM');

This can be safely run as part of your script (it will remove the unnecessary/problematic "_Session1" strings from your condition names and it will not append additional "_Session1" strings to your condition names if run multiple times)

Hope this helps
Alfonso

Originally posted by Xiaozhen You:
HI Alfonso,
I noticed I could only upload one file at a time.
Here is the matlab script.. :)
Dec 31, 2014  04:12 PM | Xiaozhen You
RE: Error importing SPM.mat file
Thank you Alfonso again for your reply!
I'm sorry that error comes up again after running this, everything seems works perfectly in the setup, and I checked the conditions and covariates, all look fine, but then in the denoising step, when I click on session 2 data for each subject it'll give me error and can't display, but session1 data is ok. Also then when I clicked first level analysis, seems both sessions are fine to check.

Could you check my conn file to see if you can spot anything weird, I did try to rerun the setup step again as it suggested in the error message, however, it still gives me the same error..
ERROR DESCRIPTION:

Index exceeds matrix dimensions.
Error in conn (line 2575)
CONN_h.menus.m_preproc.Xs=spm_get_data(CONN_h.menus.m_preproc.XS(1),pinv(CONN_h.menus.m_preproc.XS(1).mat)*xyz');
CONN v.14.p
SPM8 + Anatomy ArtRepair Beamforming DEM FieldMap INRIAlign LI MEEGtools PPPI TOM8 aal marsbar wfupickatlas
Matlab v.2012b
storage: 1259.1Gb available
SUGGESTIONS:
Potential missing Setup information. Try revising Setup fields for potential missing information

ps, after seeing the error, I tried to move task conditions except rest to covariates according to your suggestion on looking at "resting state" during a task by Fair et al., (but I'll have 2 different kind of resting state since the two tasks are fundamentally two different states).



Thank you again and happy new year!
Xiaozhen
Dec 31, 2014  08:12 PM | Alfonso Nieto-Castanon - Boston University
RE: Error importing SPM.mat file
Hi Xiaozhen,

Sorry about this, I believe this was just a bug in the GUI (it shows up when you create your project using batch scripts and do not specify any structural volumes for your data; it gives you this error whenever you try to display any results for the second-or-above sessions because the gui was not taking properly into account that you were using session-invariant structurals in this case). In any way, please try the attached patch (for version CONN14p; simply copy this file into your CONN distribution folder overwriting the file with the same name there) and let me know if everything works as expected now.

Best
Alfonso
Originally posted by Xiaozhen You:
Thank you Alfonso again for your reply!
I'm sorry that error comes up again after running this, everything seems works perfectly in the setup, and I checked the conditions and covariates, all look fine, but then in the denoising step, when I click on session 2 data for each subject it'll give me error and can't display, but session1 data is ok. Also then when I clicked first level analysis, seems both sessions are fine to check.

Could you check my conn file to see if you can spot anything weird, I did try to rerun the setup step again as it suggested in the error message, however, it still gives me the same error..
ERROR DESCRIPTION:

Index exceeds matrix dimensions.
Error in conn (line 2575)
CONN_h.menus.m_preproc.Xs=spm_get_data(CONN_h.menus.m_preproc.XS(1),pinv(CONN_h.menus.m_preproc.XS(1).mat)*xyz');
CONN v.14.p
SPM8 + Anatomy ArtRepair Beamforming DEM FieldMap INRIAlign LI MEEGtools PPPI TOM8 aal marsbar wfupickatlas
Matlab v.2012b
storage: 1259.1Gb available
SUGGESTIONS:
Potential missing Setup information. Try revising Setup fields for potential missing information

ps, after seeing the error, I tried to move task conditions except rest to covariates according to your suggestion on looking at "resting state" during a task by Fair et al., (but I'll have 2 different kind of resting state since the two tasks are fundamentally two different states).



Thank you again and happy new year!
Xiaozhen
Jan 1, 2015  04:01 AM | Xiaozhen You
RE: Error importing SPM.mat file
Thank you Alfonso! Yes it works now in that regard.
Now when I tried to start conn,
it gives me the following error:
ERROR DESCRIPTION:

Error using conn_guibackground
Too many input arguments.
Error in conn>conn_menuframe (line 5079)
if isfield(CONN_gui,'background'), b0=conn_guibackground('get',get(ha,'position'),size(c)); end
Error in conn (line 60)
conn_menuframe;
CONN v.14.p
SPM8 + Anatomy ArtRepair Beamforming DEM FieldMap INRIAlign LI MEEGtools PPPI TOM8 aal marsbar wfupickatlas
Matlab v.2012b
storage: 1240.4Gb available

Then when I used the old conn.m to open the project.mat file,  now in denoising step when I tried to visualize task conditions as confound,  condition_session1 seems include both session onsets while condition_session2 is all zero. It was correct conditions when it was imported from SPM, but then I moved them to be first level covariate, then added to confound list in denoising step as you recommended for task data. Did I miss something here?


Thanks again (sorry for asking questions on the last hour of 2014 :)
Jan 1, 2015  05:01 AM | Alfonso Nieto-Castanon - Boston University
RE: Error importing SPM.mat file
Hi Xiaozhen,

Sorry about that, I sent you the incorrect patch file (the one I sent you was part of a new release and contains some additional file dependencies). In any way, please try the attached file instead and let me know if everything works now as expected.

Best, and Happy New Year if you are in GMT-6 or above!
Alfonso
Originally posted by Xiaozhen You:
Thank you Alfonso! Yes it works now in that regard.
Now when I tried to start conn,
it gives me the following error:
ERROR DESCRIPTION:

Error using conn_guibackground
Too many input arguments.
Error in conn>conn_menuframe (line 5079)
if isfield(CONN_gui,'background'), b0=conn_guibackground('get',get(ha,'position'),size(c)); end
Error in conn (line 60)
conn_menuframe;
CONN v.14.p
SPM8 + Anatomy ArtRepair Beamforming DEM FieldMap INRIAlign LI MEEGtools PPPI TOM8 aal marsbar wfupickatlas
Matlab v.2012b
storage: 1240.4Gb available

Then when I used the old conn.m to open the project.mat file,  now in denoising step when I tried to visualize task conditions as confound,  condition_session1 seems include both session onsets while condition_session2 is all zero. It was correct conditions when it was imported from SPM, but then I moved them to be first level covariate, then added to confound list in denoising step as you recommended for task data. Did I miss something here?


Thanks again (sorry for asking questions on the last hour of 2014 :)
Attachment: conn.m
Jan 2, 2015  06:01 PM | Xiaozhen You
RE: Error importing SPM.mat file
Thank you Alfonso! Greetings in 2015 now :)

Yes it all works now all the way through, and I can check ROI-ROI 2nd level results,  however when I tried to explore graph theory measures, it gives me the following error

ERROR DESCRIPTION:

Error using close (line 93)
Invalid figure handle.
Error in conn_network (line 274)
close(h);
Error in conn_displaynetwork (line 76)
data.Zresults(n1)=conn_network({data.Z(:,:,:,n1),data.names},data.displaytheserois,1,data.Zthrtype-1,Zthr);
Error in conn (line 4710)
conn_displaynetwork('init',CONN_x.Results.xX.nsources);
Error in conn_menumanager (line 109)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});
CONN v.14.p
SPM8 + Anatomy ArtRepair Beamforming DEM FieldMap INRIAlign LI MEEGtools PPPI TOM8 aal marsbar wfupickatlas
Matlab v.2012b
storage: 1227.9Gb available
Warning: art.m overloaded by version in folder /data/apps/spm/8/toolbox/Art_detect




also, when I tried the voxel-voxel result, it gives me the following error:


ERROR DESCRIPTION:

Error using svd
Input to SVD must not contain NaN or Inf.
Error in rank (line 15)
s = svd(A);
Error in conn_glmunivariate (line 9)
Nx=rank(X);
Error in conn (line 4452)
if modeltype==1, [CONN_h.menus.m_results.B,CONN_h.menus.m_results.opt]=conn_glmunivariate('estimate',xf,yf);
Error in conn_menumanager (line 109)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});



also the confound viewing for the task conditions still shows all zeros for session 2, while they all look normal in 1st level covariate. is this just some viewing bug or I missed something when I move task conditions to first level covariate then in denoising step add these to confound?

Attached is the conn project file.

Thanks again!
Xiaozhen
Jan 3, 2015  01:01 AM | Alfonso Nieto-Castanon - Boston University
RE: Error importing SPM.mat file
Hi Xiaozhen,

Regarding issue #1, thanks for reporting this, to get around this either use the attached patch and/or simply refrain from pushing the tempting 'Ok' button on the "... please wait..." message box.

Regarding issue #2, CONN is complaining there that you have a "NaN" value for one of your second-level covariates. In particular, covariate 'T_BRI' contains a "NaN" (not-a-number) value for subject 83. If that was unintended simply modify that value in Setup.Covariates.SecondLevel. If, on the other hand, the intention was to somehow mark that covariate/subject as a "missing value", please follow instead the steps in here (http://www.nitrc.org/forum/message.php?m...) to disregard specific subjects from your second-level analyses (and enter a 0 or any other valid value, instead of "NaN", for that subject T_BRI covariate value).

Regarding issue #3, as far as I can tell your project looks perfectly fine. Since we had defined all tasks conditions to be session-specific your project contains two first-level covariates for each task (e.g. "Effect of resp_Session1" and "Effect of resp_Session2"). The first covariate will only contain values for the first session (and zero for the second session) and the second covariate will only contain values for the second session (and zero for the first session), which seems to be exactly what the corresponding effects that you included in the Denoising step seem to contain. Let me know if I am misinterpreting your question or where exactly are you failing to find the second-session values that you expected for some of these "Effect of *_Session2" covariates).

Best
Alfonso



Originally posted by Xiaozhen You:
Thank you Alfonso! Greetings in 2015 now :)

Yes it all works now all the way through, and I can check ROI-ROI 2nd level results,  however when I tried to explore graph theory measures, it gives me the following error

ERROR DESCRIPTION:

Error using close (line 93)
Invalid figure handle.
Error in conn_network (line 274)
close(h);
Error in conn_displaynetwork (line 76)
data.Zresults(n1)=conn_network({data.Z(:,:,:,n1),data.names},data.displaytheserois,1,data.Zthrtype-1,Zthr);
Error in conn (line 4710)
conn_displaynetwork('init',CONN_x.Results.xX.nsources);
Error in conn_menumanager (line 109)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});
CONN v.14.p
SPM8 + Anatomy ArtRepair Beamforming DEM FieldMap INRIAlign LI MEEGtools PPPI TOM8 aal marsbar wfupickatlas
Matlab v.2012b
storage: 1227.9Gb available
Warning: art.m overloaded by version in folder /data/apps/spm/8/toolbox/Art_detect




also, when I tried the voxel-voxel result, it gives me the following error:


ERROR DESCRIPTION:

Error using svd
Input to SVD must not contain NaN or Inf.
Error in rank (line 15)
s = svd(A);
Error in conn_glmunivariate (line 9)
Nx=rank(X);
Error in conn (line 4452)
if modeltype==1, [CONN_h.menus.m_results.B,CONN_h.menus.m_results.opt]=conn_glmunivariate('estimate',xf,yf);
Error in conn_menumanager (line 109)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});



also the confound viewing for the task conditions still shows all zeros for session 2, while they all look normal in 1st level covariate. is this just some viewing bug or I missed something when I move task conditions to first level covariate then in denoising step add these to confound?

Attached is the conn project file.

Thanks again!
Xiaozhen
Attachment: conn_network.m
Jan 5, 2015  07:01 PM | Xiaozhen You
RE: Error importing SPM.mat file
Hi Alfonso,
Thank you again for your reply!
Yes you are right there was one subject missing one behavioral data, so I changed it to 0 now and updated the conn_network.m file, the 2nd level ROI-ROI results now work fine and can be viewed without problem.
However, the graph theory part still give me the following error when I clicked "Graph Theory" and refrain from clicking "OK":) also it does not write out any graph theory related results.

Sorry that this has been taking so many rounds to fix.. Thank you so much for all your time!

Here is the error:
ERROR DESCRIPTION:

Subscripted assignment dimension mismatch.
Error in conn_network_results (line 157)
glmresults.h(:,nout)=h;
Error in conn_displaynetwork (line 84)
data.Zmodel=conn_network_results({data.Zresults,data.Zmodel});
Error in conn (line 4710)
conn_displaynetwork('init',CONN_x.Results.xX.nsources);
Error in conn_menumanager (line 109)
feval(CONN_MM.MENU{n0}.callback{n1}{1},CONN_MM.MENU{n0}.callback{n1}{2:end});
CONN v.14.p
SPM8 + Anatomy ArtRepair Beamforming DEM FieldMap INRIAlign LI MEEGtools PPPI TOM8 aal marsbar wfupickatlas
Matlab v.2012b
storage: 1227.9Gb available
Warning: art.m overloaded by version in folder /data/apps/spm/8/toolbox/Art_detect

attached is the latest conn project file
Jan 6, 2015  05:01 PM | Xiaozhen You
RE: Error importing SPM.mat file
Hi Alfonso just to update the question I had, seems it works if I specified a simpler model. 
What didn't work was I have 3 groups, 2 within subject condition to look at groupxcondition interaction in the graph theory.. is that model too complicated to handle?
Thanks again!
Xiaozhen
Jan 15, 2015  03:01 AM | Alfonso Nieto-Castanon - Boston University
RE: Error importing SPM.mat file
Hi Xiaozhen,
Thanks for reporting this, that was actually a bug in the code. Please use the attached patch (for conn14.p, copy that file to the CONN distribution folder overwriting the file with the same name there). Let me know if everything is working as expected now.
Best
Alfonso
Originally posted by Xiaozhen You:
Hi Alfonso just to update the question I had, seems it works if I specified a simpler model. 
What didn't work was I have 3 groups, 2 within subject condition to look at groupxcondition interaction in the graph theory.. is that model too complicated to handle?
Thanks again!
Xiaozhen
Jan 15, 2015  07:01 PM | Xiaozhen You
RE: Error importing SPM.mat file
Thank you so much Alfonso! Yes it works now with the new file.
Xiaozhen