Deep source modeling (phase 1) - #14130
Conversation
|
you can test it with this small code snippet: |
|
Thank you @payamsash! I ran you test code snippet using a cerebellar surface for |
| FIFF.FIFFV_MNE_SURF_LEFT_HEMI = 101 | ||
| FIFF.FIFFV_MNE_SURF_RIGHT_HEMI = 102 | ||
| FIFF.FIFFV_MNE_SURF_MEG_HELMET = 201 # Use this irrespective of the system | ||
| FIFF.FIFFV_MNE_SURF_SUBCORTICAL_ID_BASE = 1000 # + aseg value, e.g. hippocampus |
There was a problem hiding this comment.
additions to the FIFF standard need to go in https://github.com/mne-tools/fiff-constants. Presumably this would go here-ish:
There was a problem hiding this comment.
Done, see this PR. I also added a temp one here: mne/_fiff/tests/test_constants.py
|
ready to be reviewed @drammock . Thanks in advance |
…face-source-space
larsoner
left a comment
There was a problem hiding this comment.
I'm happy with this API / direction, it looks workable. We should wait for @drammock though
FYI we plan to cut 1.13 in the next few days, I think we should merge this PR soon after that lands so we have a release cycle to properly integrate the necessary features and work out issues
drammock
left a comment
There was a problem hiding this comment.
This approach is OK for me. Can you add some basic tests? I'm thinking: label input, mesh input, and I/O roundtrip
| This is a first, deliberately narrow proof of concept: it has been | ||
| validated interactively on the ``sample`` subject. Known gaps, to be | ||
| addressed in follow-up work: morphing (:class:`~mne.SourceMorph`) does | ||
| not yet support these source spaces, and | ||
| :func:`mne.extract_label_time_course` does not yet know how to select | ||
| vertices within a subcortical-surface label. |
There was a problem hiding this comment.
I'm 50/50 on whether this warning should go at the top of the docstring (just before Parameters section) rather than in the Notes section. Thoughts?
| This is a first, deliberately narrow proof of concept: it has been | |
| validated interactively on the ``sample`` subject. Known gaps, to be | |
| addressed in follow-up work: morphing (:class:`~mne.SourceMorph`) does | |
| not yet support these source spaces, and | |
| :func:`mne.extract_label_time_course` does not yet know how to select | |
| vertices within a subcortical-surface label. | |
| .. warning:: | |
| This is **experimental** functionality. :class:`~mne.SourceSpaces` created by | |
| this function are not (yet) compatible with morphing (:class:`~mne.SourceMorph`) | |
| and :func:`mne.extract_label_time_course` does not yet know how to select | |
| vertices within a subcortical-surface label. |
There was a problem hiding this comment.
I think the warning could very well go at the top. Could also maybe add that plotting support for these source spaces is limited (at least plot() method of resulting MixedSourceEstimate currently throws error)?
| :func:`mne.extract_label_time_course` does not yet know how to select | ||
| vertices within a subcortical-surface label. | ||
|
|
||
| .. versionadded:: 1.12 |
There was a problem hiding this comment.
@larsoner should this go in before 1.12 release, or just after? I'm OK with either, slightly lean toward after
| if keep_largest_component: | ||
| rr, tris = _keep_largest_component(rr, tris) | ||
| s = _surf_from_mesh(rr, tris, subject) | ||
| s["id"] = FIFF.FIFFV_MNE_SURF_SUBCORTICAL_ID_BASE |
There was a problem hiding this comment.
IIUC, if the user passes a mesh (not a label) then the id is just the offset (SUBCORTICAL_ID_BASE), since we have no way of knowing what subcortical structure(s) the mesh represents. Are the seg_ids for volume labels always non-zero? In other words, if a source has id == 1000 then for certain we don't know what structure this is?
There was a problem hiding this comment.
yes, for label-based source spaces the seg_id is always the nonzero FS aseg label value, so they can never be 1000. and yes with only given surface we can't say which structure it represents.
|
also maybe worth asking @johnsam7 and @jasmainak for opinions here. |
|
@payamsash and @ttaiv I would say try to run this branch to simplify CMB example script and then it will be trivial to merge this branch. Example script: https://github.com/johnsam7/ceremegbellum/blob/main/examples/example_script.py that way you'll discover what the API needs. |
|
@jasmainak Regarding the CMB example script, I think the effect of this PR is that calling |
…face-source-space # Conflicts: # tools/vulture_allowlist.py
| _tag_ignore_names = ( | ||
| # pending addition to fiff-constants, see mne-tools/mne-python#14130 | ||
| "FIFFV_MNE_SURF_SUBCORTICAL_OFFSET", | ||
| ) |
There was a problem hiding this comment.
can remove this now; mne-tools/fiff-constants#47 is merged. You'll need to update the hash in mne/_fiff/tests/test_constants.py though (just below the imports at the top of the file)
Reference issue (if any)
First phase of #14097, also see #6784
What does this implement/fix?
adds
setup_subcortical_source_spacewhich should/will support bothlabel(aseg) andsurface(e.g coming from CBM).Additional information
This is just a Proof-of-concept with
samplesubject.