Correlation of Single Voxel with External Variable

Hi,

I’m hoping I can get some assistance with a part of my analysis. We are attempting to extrapolate data from the sensor level down to a single voxel to create a “virtual sensor” that we can then apply further analysis to. The end goal of this step is to be able to look at a time course for each voxel that could then be correlated with a behavioral variable that changes across epochs in order to create a volumetric stc showing each voxel’s correlation with that variable. We were able to do something similar in fieldtrip with beamforming but we’d like to recreate it in MNE.

My initial thought was multiplying each vertex of the kernel made by the _assemble_kernel function as part of the _apply_inverse function by the data and correlating each vertex that way. However, that leads to correlations with each vertex, not each voxel and I don’t quite know how well that translates after using the combine_xyz function.

Would you be able to help figure out the best way to create a time series for each voxel or is there a better way of correlating the time series of each voxel that I’m not familiar with? I’d also be happy to provide more information about what we are looking to do if that would help.

Best,
Chris

Using private functions is unsafe and can break at any time, I don’t recommend this.

If you want to know the mapping from input to output, you can for example create an EvokedArray using np.eye(len(info['ch_names])) as the “data”, ensure your inverse method is linear, and apply_inverse on it. It gives you the linear matrix that maps sensors to sources.

If you already have your evoked data, you can just put it through the inverse, and then look at the resulting stc.data[ii]th row of the data