mne-tools / mne-tools/mne-python

Source distance from centre

Open
#8,615 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the new feature or enhancement

Following PR #8534 ("source depth"), I would find it useful to have a method for source spaces compute_distance_to_center() which returns each vertex' distance to an origin of vertex coordinates. This could be useful to evaluate source/head/forward models without specifying a particular sensor configuration.
A possible API could be:

def compute_distance_to_centre(src, origin=None):
    """Compute distances between vertices and their origin.

    Parameters
    ----------
    src : instance of SourceSpaces
        The object with vertex positions for which to compute distances to origin.
    origin: None | str
        The origin of vertex coordinates to use for distance computations. Can be
        * None (default): Compute Euclidean norm of vertex coordinates (i.e. origin [0, 0, 0].
        * Talairach: Compute Euclidean norm of vertex coordinates in Talairach coordinate system.
        * MNI: Compute Euclidean norm of vertex coordinates in Talairach coordinate system.
        * COG: Compute Euclidean norm of vertex coordinates with respect to their center of gravity.

    Returns
    -------
    distances : array of shape (n_vertices,)
        The distances (in metres) from origin to vertex locations.
    """
Describe your proposed implementation

Ideally as method for source space objects.

Describe possible alternatives

Could also be a function in source_space.py (similar to compute_distance_to_sensors).

Additional comments

The different options would require transformations to MNI and Talairach coordinate systems. I would need help with that.

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 in source_space.py and review compute_distance_to_sensors and PR #8534 on source depth. Clarify the source-space API and the supported origins, especially Talairach, MNI, and COG transformations. Done means source spaces can return per-vertex distances in metres with documented behavior and coverage for the supported origin options.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design, data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.