Skip to content

BUG: refit_hpi should use two-pass approach to fitting order #13524

Closed

Description

@larsoner

Our internal _fit_coil_order_dev_head_trans always determines GOF using all coils. For some datasets this is problematic -- a bad GOF can lead to bad errors like:

  Coil goodness-of-fits: 0.997 0.990 1.000 0.996 0.410
  Fitted dev_head_t 50.5° and 71.7 mm from device origin (GOF: 0.684)
  Coil distances after initial fit: 26.6 36.6 45.1 34.0 16.0 mm
  Using coils 1 2 4 to compute final dev_head_t
  Old order [3 4 5 1 2] errors:   2.4   0.4   0.4   0.2 131.1 mm
  New order [3 4 1 2 5] errors:  10.4  11.9 106.4  11.5  78.1 mm

You can see that the old order is correct with one bad coil (the one you'd expect to be bad anyway by GOF), and the new order is wrtong. What's happening here is the coil order/locations are matched for all 5 coils, and the one bad one is so bad it dominates the error term and causes an incorrect order to be found. This can be solved by a two-pass approach:

  1. Fit coil order/locations for the n_good coils (with n_good <= n_coils) based on gof_limit thresholding
  2. Fit the remaining order/locations for the n_coils - n_good coils, keeping the n_good coil locations/order fixed

In the case above where 4 of the 5 are good, step (2) is basically a no-op. When 3 of 5 are good, steps (1) and (2) will both require running through some permutations, which is okay.

I'll open a PR soon-ish (hopefully) to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions