Nrrd vs nii regarding affine data and transforms

Interesting - yes, I can reproduce that, thanks for pointing it out. Hardening the transform is applying the affine (possibly shear) matrix to the slice directions and it seems that’s preserved in the nrrd header but the directions are orthogonalized in the nii version.

The workaround for this case would be to resample the images before saving (e.g. with BRAINS Resample choosing a reference with orthogonal directions).

@lassoan and others: what do you think of enforcing orthogonality of the IJKToRAS directions?

It would mean, for example, resampling when applying a linear transform with shear E.g. here: