mne-tools / mne-tools/mne-python

Forward object contains triangulation which uses omitted sources

Open
#5,556 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

I first computed source space for sample subject:
src = mne.setup_source_space(subject, spacing='ico5', subjects_dir=subjects_dir, add_dist=False)
Then forward solution:

model = mne.make_bem_model(subject=subject, ico=None,
                           subjects_dir=subjects_dir)
bem = mne.make_bem_solution(model)
fwd = mne.make_forward_solution(evoked.info, trans=trans, src=src, bem=bem,
                                meg=True, eeg=True, mindist=3.0, n_jobs=2)

Some source points were out of distance limits, so were deleted from the model:

9 source space points omitted because they are outside the inner skull surface.
114 source space points omitted because of the 3.0-mm distance limit.

But the forward object still contains triangulation which uses these omitted sources

print src[0]['nuse'], src[0]['nuse_tri']
print fwd['src'][0]['nuse'], fwd_fixed['src'][0]['nuse_tri']

10242 [20480]
10119 [20480]

After discussing this issue with @agramfort , a solution could be not to omit these sources, but to interpolate their lead fields using morph_data tool. I can do a PR for this, adding this option to
mne.make_forward_solution() function.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mne.make_forward_solution() and inspect how the source-space nuse and nuse_tri fields are handled when distance limits omit points. Reproduce the discrepancy with the setup_source_space, make_bem_model, make_bem_solution, and forward-solution calls shown in the issue. The expected behavior and whether interpolation via morph_data is required still need to be agreed before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.