This post attempts to summarize and begin explaining an issue recently observed by @hyerangjin when doing group analysis whereby she wanted to compare time-frequency-decomposed activity. She observed that when projecting sources to the template, then doing TF and averaging within a scout, the activity looked quite different from sensor-level averaged TF activity. She later did a different pipeline where the scouts were back-projected from the template to subjects and TF and scout-averaging done in subject space. That second approach gave much closer results to the sensors and to what was expected.
I've been inspecting the code and trying to simplify the steps to isolate the issue. I now believe the main issue is that the sources were unconstrained. When projecting to the template, it only asks whether the source space is cortex surface or MRI volume. With unconstrained, it seems to compute the norm instead of keeping the 3 orientations or using the normal orientation. Then of course the TF computation of the norm is not as expected.
When doing TF with unconstrained sources without projecting to the template, it looks like it computes the TF for each orientation and then averages them, or maybe that's because this is what we selected as the scout function processing option. It's not obvious it would apply that function to the 3 orientations as well as to the scout source locations.
This figure illustrates the description above. The first line is a single-vertex scout projected to the template (code modified to do single-vertex nearest neighbor interpolation), showing the time series (norm of xyz) on the left and TF on right. The second line TF is for the same scout before projecting, i.e. in subject space. 3rd line is the same scout time series and TF in subject space but after computing the norm. 4th line is same as 3 without computing the norm, so there are 3 time series and 3 TF plots (2nd shown, which is the largest and looks similar to the one on the 2nd line)
A few other things I noted while investigating this:
-
Projecting scouts "erodes" them (scouts that share an edge become separated by a gap):
-
The inverse distance weighted interpolation (Shepard's), is not implemented correctly.
The weights are (1/d_i - 1/d_max)^2, where d is the distance. Because of the squaring, subtracting 1/d_max is not an equivalent formula. I'm not convinced my tests were correct but it seemed not to change anything at all doing this interpolation or strict nearest-neighbor. -
In general, using this interpolation method with 8 nearest neighbors means we're spatially smoothing a little when projecting sources. I would personally prefer if the smoothing was done separately (I believe there is a process for that) and the interpolation be as fateful as possible. I think there are good interpolation methods for fields on triangulations. They may already be used in Bst in surface manipulation functions? On the other hand, it might be better yet if from the very start we could project the template cortex points to the subject cortex and compute the sources directly at those. Then no source interpolation would be needed at all. Of course, it may depend on what we're doing and whether these warped points are still relatively evenly spaced in subject space. Is this currently possible?

