How to calculate the distance between two EEG electrodes for a given montage?

Suppose I have a mne.channels.DigMontage object (say, standard_1020), and the names of two channels (say, Fp1 and F3), how do I calculate their spatial distance? Specifically:

  1. What distance measure should I use, and what’s the formula for this distance measure? Since we are talking about a sphere, I don’t suppose Euclidean distance is a good choice.
  2. Is there a built-in MNE function that can calculate this? I know that by calling mne.channels.DigMontage.get_positions() I can get the 3D coordinates of the channels, but how do I calculate their distances?

Thanks!

What do you need this distances for?

That depends on what you need the distances for. Depending on your use case, this might still be good enough?

Not that I know of.


In GitHub - sappelhoff/eeg_positions: Compute and plot standard EEG electrode positions. I dealt with a similar problem: placing “electrodes” at specific distances along contour lines on a sphere. Perhaps reading a bit through the materials can bring up some ideas for you: eeg_positions.find_point_at_fraction — eeg_positions 2.2.0.dev0 documentation

I think in general you are dealing with a difficult problem, as you have measured the electrodes, but you have not measured the surface (the scalp) that they lie on. Yet you want the shortest distance on the surface.

So in one way or another you will have to make assumptions:

  1. using template positions as a proxy instead of your measured positions … and then e.g., using arc lengths as in the eeg_positions repository
  2. just using euclidean distance because it might be “good enough” (not sure about this)
  3. projecting your measured electrodes to be on a sphere and then continue as in 1.