mne-tools / mne-tools/mne-python

ENH: Measure head motion from cHPI

Open
#6,607 5 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

It might be helpful to know how much head motion there was in a scan when cHPI was used, either for QA/reporting or to help decide whether to use movement compensation in maxfilter/maxwell_filter.

If we do something like what happens for fMRI, the steps would be (roughly) to 1) use chpi.read_head_pos or chpi._calculate_head positions to get the quaternions, 2) convert the translations to mm (as in viz.plot_head_positions), 3) convert the rotations to radians to degrees*, 4) concatenate translations and rotations into an array, 5) do a diff, 6) take the euclidean norm at each measurement (e.g., second), and then 7) take the mean and standard deviation of the norms to get motion per second.

*The logic of treating degrees of rotation as mm is borrowed from afni, see e.g. https://afni.nimh.nih.gov/afni/community/board/read.php?1,82641,82645#msg-82645 .

And I made a gist: https://gist.github.com/jhouck/b0e93a60f17c708c5a342dce354551e2

It might make sense to use some standard time with chpi._calculate_head positions, like setting both t_step_min and t_step_max to 1.0, but maybe that would be left to the user.

Thoughts?

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 by reviewing chpi.read_head_pos and chpi._calculate_head, then compare the translation handling in viz.plot_head_positions with the proposed gist. Check how maxfilter/maxwell_filter currently consume head-position data. Done should include an agreed API and validated motion-per-second statistics, but the issue does not name tests or implementation files.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
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.