Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

BUG: Dev version of coreg crashing sometimes during fiducial fit

オープン
#14,420 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
data, desktop

調査の方向性

The traceback points to _filtered_extra_points in mne/coreg.py, which indexes the digitization hsp array with _extra_points_filter. The filter has 175 entries but hsp has 270, so the filter is stale after a new dig is loaded. Find where _extra_points_filter is set and reset when dig data changes. Done means fit_fiducials runs without IndexError after loading a second dig, covered by a test in mne/tests/test_coreg.py. The reporter has no reliable reproduction yet, so a test that reproduces the size mismatch is a useful first step.

索引モデルが issue の本文から書いたものです。

説明

BUG
Description of the problem

@larsoner @payamsash

Working my way slowly through a set of 180 coregistrations 😄, I've been test driving the dev versions of mne.coreg quite a bit. I do want to say, on the whole, it's looking great and working fast, so thanks @payamsash and all for the good work! With that said, there are a couple small issues I've come across.

Notably, I am sometimes, but not always, getting a crash when trying an initial fiducial fit to one of the ANTS template anats after loading in a new dig. I don't have a reliable reproduction MWE yet because I haven't been able to figure out what circumstances are differentiating the successful and crashing fid fits, but I wanted to throw this error up here so folks know about it since I know the coreg gui is under active development.

I just recently started hitting this issue, so I'll work on narrowing down an example that more reliably reproduces the behavior.

Steps to reproduce
mne.gui.coregistration(scale_by_distance=False, fullscreen=False, show=True)

# 1. Load an ANTS template.
# 2. Load an infant MEG file with dig.
# So far, the first fit after launching the gui has always worked
# 3. Click the "Fit fiducials" button.
# 4. Reset parameters.
# 5. Load a new infant MEG file with dig.
# After loading a new dig, fid fit will often succeed, but sometimes fail
# 6. Click the "Fit fiducials" button.
Link to data

No response

Expected results

I expect the fiducials to fit and the gui to not crash.

Actual results

Sometimes the gui freezes.

Here's the traceback from my terminal.
`IndexError Traceback (most recent call last)
File ~/repos/mne-python/mne/gui/_coreg.py:1508, in CoregistrationUI._fit_fiducials(self)
1506 def _fit_fiducials(self):
1507 with self._lock(scale_mode=True):
-> 1508 self._fits_fiducials()

File ~/repos/mne-python/mne/gui/_coreg.py:1513, in CoregistrationUI._fits_fiducials(self)
1511 with self._lock(params=True, fitting=True):
1512 start = time.time()
-> 1513 self.coreg.fit_fiducials(
1514 lpa_weight=self._lpa_weight,
1515 nasion_weight=self._nasion_weight,
1516 rpa_weight=self._rpa_weight,
1517 verbose=self._verbose,
1518 )
1519 end = time.time()
1520 self._display_message(
1521 f"Fitting fiducials finished in {end - start:.2f} seconds."
1522 )

File :12, in fit_fiducials(self, lpa_weight, nasion_weight, rpa_weight, verbose)

File ~/repos/mne-python/mne/coreg.py:1911, in Coregistration.fit_fiducials(self, lpa_weight, nasion_weight, rpa_weight, verbose)
1889 """Find rotation and translation to fit all 3 fiducials.
1890
1891 Parameters
(...) 1908 The modified Coregistration object.
1909 """
1910 logger.info("Aligning using fiducials")
-> 1911 self._log_dig_mri_distance("Start")
1912 n_scale_params = self._n_scale_params
1913 if n_scale_params == 3:
1914 # enforce 1 even for 3-axis here (3 points is not enough)

File ~/repos/mne-python/mne/coreg.py:1869, in Coregistration._log_dig_mri_distance(self, prefix)
1868 def _log_dig_mri_distance(self, prefix):
-> 1869 errs_nearest = self.compute_dig_mri_distances()
1870 logger.info(
1871 f"{prefix} median distance: {np.median(errs_nearest * 1000):6.2f} mm"
1872 )

File ~/repos/mne-python/mne/coreg.py:2175, in Coregistration.compute_dig_mri_distances(self)
2162 """Compute distance between head shape points and MRI skin surface.
2163
2164 Returns
(...) 2171 mne.dig_mri_distances
2172 """
2173 # we don't use dig_mri_distances here because it should be much
2174 # faster to use our already-determined nearest points
-> 2175 hsp_points, mri_points, _ = self._setup_icp(0)
2176 hsp_points = apply_trans(self._head_mri_t, hsp_points)
2177 return np.linalg.norm(mri_points - hsp_points, axis=-1)

File ~/repos/mne-python/mne/coreg.py:1959, in Coregistration._setup_icp(self, n_scale_params)
1957 mri_pts = [np.zeros((0, 3))]
1958 weights = [np.zeros(0)]
-> 1959 if self._has_dig_data and self._hsp_weight > 0: # should be true
1960 head_pts.append(self._filtered_extra_points)
1961 mri_pts.append(
1962 self._processed_high_res_mri_points[
1963 self._nearest_transformed_high_res_mri_idx_hsp
1964 ]
1965 )

File ~/repos/mne-python/mne/coreg.py:1857, in Coregistration._has_dig_data(self)
1853 @property
1854 def _has_dig_data(self):
1855 return (
1856 self._has_mri_data
-> 1857 and len(self._nearest_transformed_high_res_mri_idx_hsp) > 0
1858 )

File ~/repos/mne-python/mne/coreg.py:1787, in Coregistration._nearest_transformed_high_res_mri_idx_hsp(self)
1784 @property
1785 def _nearest_transformed_high_res_mri_idx_hsp(self):
1786 return self._nearest_calc.query(
-> 1787 apply_trans(self._head_mri_t, self._filtered_extra_points)
1788 )[1]

File ~/repos/mne-python/mne/coreg.py:1760, in Coregistration._filtered_extra_points(self)
1758 return self._dig_dict["hsp"]
1759 else:
-> 1760 return self._dig_dict["hsp"][self._extra_points_filter]

IndexError: boolean index did not match indexed array along axis 0; size of axis is 175 but size of corresponding boolean axis is 270`

Additional information

~$ mne sys_info
Platform Linux-6.17.0-1033-oem-x86_64-with-glibc2.39 (X11)
Python 3.14.6 | packaged by conda-forge | (main, Jun 12 2026, 08:51:42) [GCC 14.3.0]
Executable /home/nordme/miniconda3/envs/bids_dev26/bin/python3.14
CPU Intel(R) Xeon(R) w5-2455X (24 cores)
Memory 125.4 GiB

Core
├☑ mne 1.14.0.dev85+g5ec89de23 (development, latest release is 1.13.2)
├☑ numpy 2.4.6 (OpenBLAS 0.3.33 with 24 threads via pthreads)
├☑ scipy 1.18.0
└☑ matplotlib 3.11.0 (backend=qtagg)

Numerical (optional)
├☑ scikit-learn 1.8.0
├☑ threadpoolctl 3.6.0
├☑ numba 0.65.1
├☑ nibabel 5.4.2
├☑ nilearn 0.14.0
├☑ dipy 1.12.1
├☑ openmeeg 2.5.16
├☑ pandas 3.0.3
├☑ h5io 0.2.5
├☑ h5py 3.16.0
└☐ unavailable python-picard, jamica, cupy

Visualization (optional)
├☑ pyvista 0.48.4 (OpenGL 4.5.0 NVIDIA 595.99.02 via NVIDIA RTX A400/PCIe/SSE2)
├☑ pyvistaqt 0.12.0
├☑ vtk 9.6.2
├☑ qtpy 2.4.3 (PySide6=6.11.1)
├☑ pyqtgraph 0.14.0
├☑ mne-qt-browser 0.7.5
├☑ ipywidgets 8.1.8
├☑ trame 3.13.2
├☑ trame_client 3.13.2
├☑ trame_server 3.12.5
├☑ trame_vtk 2.11.13
├☑ trame_vuetify 3.2.2
└☐ unavailable ipympl, trame_pyvista

Ecosystem (optional)
├☑ mne-bids 0.21.0.dev6+gcd32e35ff
├☑ mne-nirs 0.7.3
├☑ mne-connectivity 0.8.1
├☑ mne-icalabel 0.9.0
├☑ mne-bids-pipeline 1.11.0.dev84+g51b0df8e9
├☑ autoreject 0.4.4
├☑ neo 0.14.5
├☑ eeglabio 0.1.3
├☑ edfio 0.4.13
├☑ curryreader 0.1.2
├☑ mffpy 0.11.0
├☑ pybv 0.8.1
├☑ pymef 1.4.8
├☑ antio 0.7.0
├☑ defusedxml 0.7.1
└☐ unavailable mne-features

主要言語
Python
スター
3.5k
フォーク
1.6k
平均マージ
1日 3時間
マージ済み PR(30日)
74

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mne-tools/mne-python のほかの issue

mne-tools/mne-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。