Skip to content

v0.5.0 — deformable registration + label-safe affine

Choose a tag to compare

@github-actions github-actions released this 28 Jun 13:23
· 6 commits to main since this release

Major features

Deformable registration

When two scans show the same anatomy but the patient (or organ) moved between them, a pure affine resample misses the deformation. New API:

  • transform_deformable(source_dcm, mask, target_dcm, out, ...) — full pipeline
  • deformable_register(source_img, target_img, mask?, ...) — lower-level
  • DeformableResult dataclass exposes the warped mask, the dense displacement vector field, the final metric and the iteration count

Multi-resolution B-spline + Mattes mutual information, optional Symmetric Forces Demons refinement. The displacement field is exported as a 3-component vector NIfTI so callers can re-use it without re-running the registration.

Affine improvements

  • direct NIfTI -> SimpleITK conversion (~30 % faster, no tempfile dance)
  • auto_axes="xyz" checks all 8 flip combinations for unusual patient orientations
  • verify_labels: detects when labels are silently lost in the NN cast (e.g. odd-valued labels 1/3/5) and retries with subpixel upsampling
  • volume_warn_ratio: warns when the registered mask volume is more than 2x or less than half the source volume
  • new diagnostic dict returned by transform(): used_reverse, used_flips, label_loss, volume_ratio, alignment

Tests

  • synthetic shift recovery (Dice > 0.8 after warp)
  • displacement field shape sanity
  • real end-to-end fixture (Lena Knie 19 T0, DESS -> T2, gitignored locally)