Project-MONAI / Project-MONAI/MONAI

Make the Affine 32 Again

Open
#6,961 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
8.7k
Forks
1.6k
Avg merge
5d 1h
Merged PRs (30d)
20

Description

Is your feature request related to a problem? Please describe.
When read in the NiftiImage with LoadImage transform the affine matrix is saved in torch.float64, which causes problems when using MacBook's neural engine because mps accelerator doesn't support float64.

Describe the solution you'd like
Just make the affine matrix into float 32, thank you!

Describe alternatives you've considered
None

Additional context
None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the NiftiImage handling used by the LoadImage transform and identify where the affine matrix dtype is established. Verify the behavior on an MPS device, then confirm that the affine is float32 and no longer triggers float64 incompatibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.