Spm12 erds export error

Dear Francois,

I ve calculated source ERD, projected them onto normalized brain. Is it possible to export them to spm12 surface file? Read from a few earlier posts that it was possible, but isnt working.
(Whole brain source analysis, Hilbert’s only a single band selected – alpha. 15002 vertices. Exporting to Spm8 volume .nii file wasn’t a problem, but that not what I want).

This is the error I get.


** Error: [process_export_spmsurf] File > Export to SPM12 (surface)
** Line 222: Index exceeds matrix dimensions.
**
** Call stack:
** >process_export_spmvol.m>Run at 222
** >process_export_spmvol.m at 27
** >process_export_spmsurf.m>Run at 102
** >process_export_spmsurf.m at 27
** >bst_process.m>Run at 229
** >bst_process.m at 36
** >panel_process1.m>RunProcess at 141
** >panel_process1.m at 27
** >gui_brainstorm.m>CreateWindow/ProcessRun_Callback at 737
** >bst_call.m at 28
** >gui_brainstorm.m>@(h,ev)bst_call(@ProcessRun_Callback) at 277
**
**
** File: Group_analysis/Alpha_ERD_10-13_July2018/timefreq_hilbert_180711_1002.mat
**


Regards,
Gajanan

It should work indeed.
The issue could be the way you set the option “Frequency band to export”. It must be the index of the frequency band, therefore if you have only one frequency band alpha, you must set this option to “1”.
Is this what you did?

I don't see that option "1", Francois. It is just selected to alpha. Attaching images.
Would it be better if i sent you the file i analysed?

file details

Thank you again for looking into this.
Regards
Gajanan

Ok, sorry, what I say had no sense with the interface. I had the script version in mind:

% Process: Export to SPM12 (surface)
sFiles = bst_process('CallProcess', 'process_export_spmsurf', sFiles, [], ...
'outputdir',   {RawFiles{1}, 'GIFTI'}, ...
'filetag',     '', ...
'timewindow',  [-0.1, 0.5], ...
'freq_export', 1);

I don’t know why you are getting this error. I tested exactly the same thing in various configurations and it works on my end… Maybe something is missing in your database?
If you are a bit familiar with Matlab, you could try debugging it: in function process_export_spmvol.m, click on the left of line 194 to place a breakpoint, then run the export from the interface. When the execution stops, you can inspect the variables and execute the code line by line to understand where is the issue coming from.

Ok i ll check this and get back to you.

Thank you.

Thank a million Francois. Works now. I hope it was a one off problem on my system.

For some reason at line 222, the variable iFreqExport = 3. Changed it to 1 and it saved proper.

Its a temporary fix and since there are multiple files to run, in the process tab, i ve arranged the erd files in ascending order hoping that the spm .dat files that are created are also in the same order.

Thank you again for the help.

Cheers,
Gajanan

It is possibly coming from a previous execution of this process, on a file that had multiple frequency bands.
Now you changed it, it should stay like this.

In general, you can reset the default options for all the processes with the menu “Reset options” in the pipeline editor.

I understand. So far all ok.
Thank you.