-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[MRG] FIX: read easycap-M10 montage #7224
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
Conversation
| rpa = np.mean([ch_pos['FT10'], ch_pos['TP10']], axis=0) | ||
| rpa *= head_size / np.linalg.norm(rpa) | ||
| elif basename == 'easycap-M10.txt': | ||
| nasion = lpa = rpa = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change does not look like reading one versus the other but rather whether or not the nasion/LPA/RPA are defined for the montage. Can you explain a bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Selecting the right cap happens on line 130/133 in the next hunk below. This here is a secondary change -- the M10 montage has different channel names so inferring the nasion can't be done with the same code. Based in this mapping (p. 5) the same heuristic could be applied though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth shifting the inferred LPA/RPA to fit the head more precisely?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The best thing to do would be to figure out where they are supposed to be in the montage, rather than judge based on the plot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least for M1 I think that based on a standard 1020 layout definition we should be able to figure it out. It looks like like T3 and T4 being 10% of the way between LPA/RPA and Cz, and Fpz / Oz are 10% up from Nasion/Inion:
http://chgd.umich.edu/wp-content/uploads/2014/06/10-20_system_positioning.pdf
I'd first verify that the spacings in that doc are (at least approximately) accurate for M1 and then go from there.
For M10 we might want to see if the numerical names have readable equivalents (e.g., "10" is "Cz" or whatever) and go from there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first plot looks much better - that seems to be the exact problem I have in plots in #7193.
@larsoner, @christianbrodbeck - I have digitized positions for this cap, I think, I can take a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(ok, the problem is different in the PR, there it is yet another eeg montage. But I should have easycap digitized too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be helpful if you can check. And we should check that the percentage arc length math works, too. If it doesn't we should figure out how much they differ and choose which one seems correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @larsoner! These are the new montages after adding fiducials based on the spherical coordinate system:
Codecov Report
@@ Coverage Diff @@
## master #7224 +/- ##
=======================================
Coverage 89.77% 89.77%
=======================================
Files 445 445
Lines 80134 80134
Branches 12820 12820
=======================================
Hits 71938 71938
Misses 5378 5378
Partials 2818 2818 |
larsoner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me assuming 115 is the correct theta
|
These look good, if you still need a digitized coordinates I paste them for the M1 cap here (the file is actually a digitization_rotated_coords.txt This was done with photogrammetry from video frames, without control points in physical units, so the units do not mean anything. |
christianbrodbeck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mmagnuski in that case you have digitized fiducials so this should be a different issue right?
|
Trying to |
|
Merge with master manually if easier
|
|
Resolving the conflicts is easy enough but I did not want to merge into |
|
@christianbrodbeck I'm not sure I understand. Eric wrote it would be useful if I posted the digitized positions in resolving the issue here, so I did. |
This would just make a "merge commit" in your PR, it would not merge your changes into
Indeed it would be nice to see at least how close the spherical representation is to the digitized one. I say we merge this once the conflicts are fixed (via the GitHub interface with a merge commit or via rebasing, whatever you find easiest), and then I'm happy to take a quick look at some point at the digitized file (it's not a blocker here). I would say don't bother with the M10 for now unless it's trivial or you are motivated to find it. |
|
Ah, I made the merge commit. |
|
@larsoner @christianbrodbeck |
|
can you touch examples that use this easycap-M10 file such as to see how it looks like now? |
|
@agramfort This example's example build artifact does not seem to contain mayavi images, and a search for "easycap" does not yield any other examples... |
|
@christianbrodbeck You need to change something in an example for it to render. That's what Alex meant with "touch". |
|
@larsoner |
|
In the general case you have to define what you mean by circumference. Relative to what sphere center and what radius? In spherical montage cases his seems perhaps trivial to define, but that is a specific case of the more general (realistic dig / not true sphere) dig case. At some point we decided that anything at z=0 would be on the head sphere, where z we choose somehow suitably in head coordinates. Basically I'm open to figuring out how to redefine how we plot things, but it's not a easy as saying "it should be done this way", because it's better if we have something that works for all cases rather than special casing the spherical montage case. So if we are going to change it, we need to understand what we do now and how it should change for all cases. |
I remembered a detail, which is why this it didn't seem trivial for the cases like this. We want the sensor positions to stay the same regardless when and which channels you pick from the data, i.e., the location of channel X in the full montage should end up being plotted in the same location relative to the spherical head whether or not you've done You could say that keeping the EEG locations in
because we currently only populate I guess we could get around this by always populating I'm not sure if this would have side effects but we could try it. It would at least probably produce the behavior that you were expecting. It's arguably more consistent with what we do in the true-digitization case, because we do not get modify Modifying the |
Oh, I didn't mean to sound "it should be done this way". What you describe sounds ok - the user can easily change the coordinates so that the channels are plotted the way they prefer.
I don't see a problem here actually (but I may be missing something) - the default sphere is in I don't want to pollute this PR with my slightly off-topic questions, we can move the discussion somwehere else - I can for example open a PR to add the info about topomap plotting and |
|
Sounds good to me |
|
As far as I am concerned this is ready for merge, I don't think there was anything left to address? |
|
Failures are unrelated |
* FIX: Easycap-M10 montage * FIX: DigMontage.plot() defaults * Infer fiducials * STY * ENH Easycap montages: add fiducials in spherical coordinates * DOC [ci skip] * STY: capitalization Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
* FIX: Easycap-M10 montage * FIX: DigMontage.plot() defaults * Infer fiducials * STY * ENH Easycap montages: add fiducials in spherical coordinates * DOC [ci skip] * STY: capitalization Co-authored-by: Eric Larson <larson.eric.d@gmail.com>




There was a bug in the standard montage reader that read easycap-M1 even when
easycap-M10was specified.While investigating I also noticed that the
DigMontage.plotdefault parameters don't agree with the documentation, below I changed the default parameters to match the docs (since the docs do agree with the default parameters ofplot_montage()).