Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spherical interpolation #500

Closed
arnodelorme opened this issue Jun 15, 2022 · 12 comments
Closed

spherical interpolation #500

arnodelorme opened this issue Jun 15, 2022 · 12 comments

Comments

@arnodelorme
Copy link
Collaborator

arnodelorme commented Jun 15, 2022

Makoto: Maruti pointed me to this issue--EEGLAB's electrode interpolation seems to follow Perrin et al. (1989), but there is an update on this topic in 2015 by Kang et al. (2015). I attached both papers here for your reference.

Question to Arno: Does eeg_interp() use the regularization parameter lambda? I don't think it is discussed in Perrin et al., but Kang et al. says it was introduced by Perrin et al. I'm a bit confused.

Anyway, it seems if we use computationally more expensive solutions (lower m, higher n) than those originally suggested by Perrin et al. (1989), it seems to produce better results in terms of the impact on the cross-electrode phase analyses.
papers.zip

@arnodelorme
Copy link
Collaborator Author

arnodelorme commented Jun 15, 2022

Thanks Makoto,

Question to Arno: Does eeg_interp() use the regularization parameter lambda? I don't think it is discussed in Perrin et al., but Kang et al. says it was introduced by Perrin et al. I'm a bit confused.

I have looked and I do not think we use the parameter lambda. It is in Perrin et al in the comments at the end.

The current code in eeg_interp line 341 is

C = pinv([Gelec;ones(1,length(Gelec))]) * values;

Could be changed to

C = pinv([Gelec+eye(size(Gelec))*lambda;ones(1,length(Gelec))]) * values;

Since lambda is a "is small positive value added to the diagonal in the matrix solutions of (1) to regularize"

We could change the default to m=3 and n=50, add lambda, and even make the number publicly accessible to users in the interface.

There is another function sphericalSplineInterpolate in clean_rawdata that uses n=200; m=4 and lambda = 1e-5
Kay has also worked on a minor modification.

Attaching a white paper of an observation I made more than 15 years ago. We actually do not use the standard spherical interpolation in eeg_interp. We use a different method to compute the difference in angle which was in the function prior to 2000 (probably implemented by Colin Humphries), and our solution is apparently more robust to interpolation of outer boundaries. I asked Jason to look at the math, but he was as puzzled as I am. This would be a great student project. I still have the testing scripts.

white_paper.zip

@MakotoMiyakoshi
Copy link

Thanks Arno. This is a perfect explanation. Maruti must be very impressed! It's also good to know that you had that white paper from 2007, I appreciate your deep thought and insight on this issue.

According to Kang et al. (2015), m=3, n=50, lambda=10^-8 is recommended. I think it is a great idea to update eeg_interp() based on Kang et al. (2015). clean_rawdata's n=200 should be certainly better but probably an overkill.

@VisLab
Copy link

VisLab commented Jun 15, 2022

The code we used in in Prep was a modification of an implementation by Christian Kothe. We did a lot of testing to evaluate accuracy for a variety of headset configurations before we settled on the parameters we used. We were not overly concerned about execution time in contrast to better accuracy.

@arnodelorme
Copy link
Collaborator Author

arnodelorme commented Jun 15, 2022 via email

@MakotoMiyakoshi
Copy link

MakotoMiyakoshi commented Jun 15, 2022 via email

@marutimishra
Copy link

Also, since you are able to dig into this and have expertise, I was wondering what you think about this article here, that seems to suggest a neurophysiological approach to interpolation rather than mathematical approaches like SSI.

@MakotoMiyakoshi
Copy link

MakotoMiyakoshi commented Jun 17, 2022 via email

@marutimishra
Copy link

marutimishra commented Jun 19, 2022

Ah, I see. make sense.
I was thinking if one can use CNNs to interpolate? and I did a brief search and found this article that exactly does that https://www.sciencedirect.com/science/article/pii/S0165027021000613
I guess it would take a long time for this to be really used. what are your thoughts?

@MakotoMiyakoshi
Copy link

MakotoMiyakoshi commented Oct 11, 2022 via email

@arnodelorme
Copy link
Collaborator Author

Is there any modification we should make to the function?

@MakotoMiyakoshi
Copy link

MakotoMiyakoshi commented Oct 17, 2022 via email

@arnodelorme
Copy link
Collaborator Author

OK, I have added an option to use the Kang method and also use custom values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants