Skip to content

bug fix in nibabel.affines.rescale_affine #1366

Open
@romainVala

Description

@romainVala

Hello

I compared the affine matrix after resampling, with different soft (mrtrix, sitk from torchio)
and I notice a small difference in the translation part of the affine when using nibabel function: nib.affines.rescale_affine()

I could find the same result if I modify nibabel code like that

Instead of

    centroid = nib.affines.apply_affine(affine, (shape -1) // 2)
    t_out = centroid - rzs_out @ ((new_shape -1) // 2)

I chage to

    centroid = nib.affines.apply_affine(affine, (shape -1) / 2)
    t_out = centroid - rzs_out @ ((new_shape -1) / 2)

it make sense to me to stay with float value for the centroid coordinate.

Cheers
Romain

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions