-
Notifications
You must be signed in to change notification settings - Fork 145
WIP: Fix off-by-one errors in conform.py if flipping orientation #767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This work-in-progress PR addresses off-by-one errors in MGH header handling related to the Pxyz_c calculation, which represents the center of the image but is offset by half a voxel. The fix introduces two feature flags to optionally correct the affine calculation bug in nibabel's MGHHeader.get_affine() method.
Changes:
- Introduces two feature flags (FIX_MGH_AFFINE_CALCULATION and FIX_CENTER_NOT_CENTER) to control the fix behavior
- Adds helper functions get_affine_from_mgh() and get_affine_from_any() to provide corrected affine calculations
- Modifies offset calculation in map_image() to account for off-by-one errors when flipping orientation
- Updates center calculation logic in prepare_mgh_header() with conditional fix based on feature flags
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b059c18 to
d8b8d42
Compare
6411bfc to
b053d7f
Compare
b053d7f to
90d5f5e
Compare
This PR is a work in progress PR to address the issue of MGH Headers using Pxyz_c (which is not the center of the image, but offset by half a voxel).
This is also a bug in
mri_convertas documented in freesurfer/freesurfer#1358Todo: