I am trying to downsample my source localization output to an atlas, but I ran into some errors.

I loaded my atlas to the anatomy page and the mapping seems fine, but when I try to load this atlas from the subject anatomy, it failed:

But I can re-load the atlas in a drop-down manu to the right hand side box. After reloading the atlas, I tried to run the "Down Sample to Atlas" function in the pipeline but I got an error output:

Line 161: Index in position 1 exceeds array bounds (must not exceed 1). _______________________________________________
Call stack: >process_source_atlas.m>Run at 161 >process_source_atlas.m at 24 >bst_process.m>Run at 197 >bst_process.m at 37 >panel_process1.m>RunProcess at 124 >panel_process1.m at 26 >gui_brainstorm.m>CreateWindow/ProcessRun_Callback at 768 >bst_call.m at 28 >gui_brainstorm.m>@(h,ev)bst_call(@ProcessRun_Callback) at 292 _______________________________________________

Does anyone know what these error messages mean and how I can fix them?

It looks like there is a scaling issue here: your ROIs cover most of the skull and skin, and don't look at all aligned with the cortex.

The atlas in after reloading in the drop-down manu:

This looks pretty ugly in my opinion. Use surface-based atlases for surface-based source modeling.

My file structures:

I can see here that you are using a linear MNI normalization.
If you are using MNI-based parcellations, it is highly recommended to use a non-linear MNI registration. Use SPM Segment, or even better: run CAT12 on your MRI.

@Francois I was also able to get the reduced connectivity (coh) matrix for the source after applying PCA on each scout.

I have another question - is there a way to arrange the regions in the order I want in the connectivity matrix? I need to compare this connectivity matrix to the one I got from fMRI, in which the ROIs are arranged in a specific order.

I was also able to get the reduced connectivity (coh) matrix for the source after applying PCA on each scout.

This looks very noisy. You will need to run some group-level statistics to extract some meaningful information.

I have another question - is there a way to arrange the regions in the order I want in the connectivity matrix?

This is something you'll need to do manually with a Matlab script, by changing the order or the rows and columns in the following field of the connectivity file: RefRowNames, RowNames, TF.

I have another question. After I preprocess my data, I created overlapping spheres (volume) using regular grid:

Then I ran source localization and got the following outputs:

Then I was trying to run the connectivity analysis to get the coherence matrix using the following settings:

It throws an error:

Do you know what it means? I am guessing that the source localization for a regular grid doesn't keep the time series data for the source space. Is there a way that I can work with the time series at the source space for a regular grid?

I could not reproduce this error. Please try with a smaller set of scouts, and try to understand what it the cause of the problem. Maybe some of the scouts are empty?
If you can't reproduce it, please try using the example dataset from the introduction tutorials, and describe how to reproduce the error from that example.

I am guessing that the source localization for a regular grid doesn't keep the time series data for the source space. Is there a way that I can work with the time series at the source space for a regular grid?

I'm not sure I understand this.
If you want to extract the scouts time series explicitly before running the connectivity analysis, use the process Extract > Scouts time series.

I was trying to run the connectivity analysis to get the coherence matrix using the following settings

I see that you are using a PCA approach. Make sure you update Brainstorm, as we fixed a major bug recently regarding the computation of the first PCA mode:

Another question regarding the connectivity. I was trying to run some envelope correlation for the source signals, but the correlation matrix seems only showing positive correlations. I am wondering how the correlation is calculated? Should there be negative correlations as well?

@Francois. I think I figured out how to display negative correlations.

But another more important question - is there a way that I can run connectivity on timefreq data? I want to perform the following pipeline:
Source localization > hilbert-transform (envelop) on the source timeseries > downsample the envelop signals > run correlation on the downsampled signals > take the mean of the correlation for voxels in each scout.

However, I am stuck in the second step because I cannot run any source analysis on time-freq datatype which is the output of the hilbert-transform. Is there a way to do this operation?

However, I am stuck in the second step because I cannot run any source analysis on time-freq datatype which is the output of the hilbert-transform.

In the line above, you say "Source localization > hilbert-transform (envelop) on the source timeseries". This is correct way of proceeding, and does not require "any source analysis on time-freq datatype" (which is not possible).

If you really want to limit the source estimation to a specific frequency band, then filter all your recordings (including the noise recordings), and then estimate the sources.

For discussing new topics, please create new threads on the forum - this will make it easier to search the forum in the future. Btw, this topic of "source reconstruction of time-frequency decomposition" has been discussed a few times in the past, you can probably find these threads on the forum.

Yes, next time I will open new threads for a new topic.

Actually, I think I made a mistake when when I was talking about the pipeline:

However, I am stuck in the second step because I cannot run any source analysis on time-freq datatype which is the output of the hilbert-transform.

I actually wanted to say:

However, I am stuck in the second step because I cannot run any connectivity analysis on time-freq datatype which is the output of the hilbert-transform.

And you already answered that there isn't any way to run connectivity on time-freq data. What I actually wanted to do is to down-sample the hilbert-transformed timeseires to remove autocorrelation, and then see if I can find any correlation structures for the whole brain activity. Potentially I would like to see if I can recover the default network structures that can be found in fMRI.

I think what I can only do is to Compute the hilbert-transform on source signals > Group them into scouts > Export them to matlab, and run my own analysis from there.

I think I got all my questions answered, thank you for all your suggestions. They are very helpful! And I really like Brainstorm. It is a great platform for MEG/EEG analysis particularly for interactive data analysis.