MRG, ENH: Extend usability of stc_near_sensors #9396
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have some fNIRS collaborators who generate figures where the fNIRS electrodes are projected onto the nearest brain areas, like in ECoG:
or:
Yes, I know the units on the colorbar are painful. :) But at least it's clear it's just a proximity-based projection and not actual inverse imaging!
This PR makes this possible by:
picks
argument tostc_near_sensors
so that fNIRS electrodes (HbO usually) can be used.smoothing_steps=0
meaning "no smoothing steps at all". Evensmoothing_steps=1
makes some smooth transitions where discrete ones are really desired. This caused me to shift "nearest" to -1 in thebrain
interface, which I think is fine.mode='weighted'
argument tostc_near_sensors
that ensures that each STC vertex value is either zero, or a weighted sum of values from the sensors. This is more like what our smoothing/interpolation functions usually do. For example, if all sensors have a value of 1, all STC values are either 1 or 0. The default mode"sum"
makes it so that some of these values can be greater than 1, which is a bit wacky (it's probably not a great default in this sense).cc @rob-luke since you might be interested in this. Like I said it's not the greatest, but people do it (like in ECoG / sEEG) so I think it's probably worth having at least some way to do this.