# Issue with \`omit\_head\_shape\_points\` not affecting point count in automatic coregistration

**URL:** <https://mne.discourse.group/t/issue-with-omit-head-shape-points-not-affecting-point-count-in-automatic-coregistration/10325>\
**Category:** Support & Discussions\
**Tags:** coregistration\
**Created:** [September 30, 2024, 12:10pm UTC](https://mne.discourse.group/t/issue-with-omit-head-shape-points-not-affecting-point-count-in-automatic-coregistration/10325 "2024-09-30T12:10:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tghafari](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/tghafari/32/1779_2.png) [@tghafari](https://mne.discourse.group/u/tghafari)\
**Post date:** [September 30, 2024, 12:10pm UTC](https://mne.discourse.group/t/issue-with-omit-head-shape-points-not-affecting-point-count-in-automatic-coregistration/10325/1 "2024-09-30T12:10:36Z")

</div>

Hello,

I’m trying to perform automatic coregistration using MNE-Python. Below are the steps I’m following:

```python
import mne

# Load the epochs and extract info
info = mne.read_epochs(epoched_fif, preload=True, verbose=True).info

# Use estimated fiducials from fsaverage
fiducials = "estimated"

# Initialize the Coregistration object
coreg = mne.coreg.Coregistration(info, 
                                 subject=fs_sub, 
                                 subjects_dir=fs_sub_dir,
                                 fiducials=fiducials)

# Fit fiducials
coreg.fit_fiducials(verbose=True)

# First ICP iteration
coreg.fit_icp(n_iterations=20, 
              nasion_weight=1., 
              verbose=True)

# Omit head shape points that are farther than 5mm
coreg.omit_head_shape_points(distance=5/1000) 

# Second ICP iteration with higher nasion weight
coreg.fit_icp(n_iterations=20, 
              nasion_weight=10., 
              verbose=True)

```

The initial coregistration setup and `fit_fiducials` seem to work correctly. However, when I attempt to omit head shape points using `omit_head_shape_points`, the points that are farther than 5mm are correctly identified (as confirmed by the logger and the `self._extra_points_filter` mask), but they are **not removed** from the actual points.

Upon comparing `coreg._dig_dict` before and after the call to `omit_head_shape_points`, the number of points remains unchanged. It seems like the mask is created, but not applied to filter out the points. This behavior continues even when I call `fit_icp` again.

Is this a bug in how the mask is applied, or am I missing something in my process? Any guidance would be appreciated!

**Additional Information:**

- MNE version: 1.8.0
- Operating system: macOS 14.5

Thank you for your help

---

<div class="post-metadata">

**Author:** ![tghafari](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/tghafari/32/1779_2.png) [@tghafari](https://mne.discourse.group/u/tghafari)\
**Post date:** [December 12, 2024, 10:03am UTC](https://mne.discourse.group/t/issue-with-omit-head-shape-points-not-affecting-point-count-in-automatic-coregistration/10325/2 "2024-12-12T10:03:36Z")

</div>

I though I’d share this with everyone.

Turns out, omit\_head\_shape\_points is removing points further than the defined distance, but mne.viz.plot\_alignment() uses the original hsp points to plot the coregistration. So, automatic coregistration following [mne tutorial](https://mne.tools/stable/auto_tutorials/forward/25_automated_coreg.html) works.

Bests,  
Tara
