'Exclude head shape points that are far away from the MRI head.
Parameters
distance : float
Exclude all points that are further away from the MRI head than
this distance. Previously excluded points are still excluded unless
reset=True is specified. A value of distance <= 0 excludes nothing.
reset : bool
Reset the filter before calculating new omission (default is
False).'

def omit_hsp_points(self, distance=0, reset=False):

    distance = float(distance)
    if reset:
        logger.info('Coregistration:    Reset    excluded    head    shape    points')
        with warnings.catch_warnings(record=True):
            self.hsp.points_filter = None
    if (distance <= 0):
        return
    hsp_pts = self.transformed_hsp_points
    mri_pts = self.transformed_mri_points
    point_distance = _point_cloud_error(hsp_pts, mri_pts)
    new_sub_filter = (point_distance <= distance)
    n_excluded = np.sum((new_sub_filter == False))
    logger.info('Coregistration:    Excluding    %i    head    shape    points    with    distance    >=    %.3f    m.', n_excluded, distance)
    old_filter = self.hsp.points_filter
    if (old_filter is None):
        new_filter = new_sub_filter
    else:
        new_filter = np.ones(len(self.hsp.raw_points), np.bool8)
        new_filter[old_filter] = new_sub_filter
    with warnings.catch_warnings(record=True):
        self.hsp.points_filter = new_filter
