Nrrd vs nii regarding affine data and transforms

Thanks for the detailed response.

ITK states that it is allowed to store sheared volumes in itk image data objects (source). I’ve tested current ITK behavior now and found the followings:

  • ITK can read sheared volumes - direction matrix contain shear - from mha and nrrd formats (could not test others, as I could not modify headers to introduce shear)
  • ITK orthogonalizes direction matrix when writing images in all formats I tested (mha, nrrd, nifti, mgz, mnc)

So, there is definitely fundamental inconsistency within ITK between reading and writing files.

A short-term solution could be that we refuse writing volumes with non-orthogonal axes in Slicer. That way we could avoid accidental data corruption. The difficulty is reliable detection of non-orthogonal axes without false alarms.

1 Like

I consider the version of the NIfTI implemented in ITK that does not support affine to be obsolete. I do not consider NIfTI v1 and NIfTI v2 obsolete!

My research group encountered the same issue. Was there a resolution to either executing the conversion of Nrrd to Nii while taking into account the orthogonal considerations or completing a step beforehand to account for the differences?

Until ITK does not support writing of non-orthogonal axes, probably the best is to resample the volume on a rectilinear grid using one of the image resample modules. For example, you can use “Crop volume module”; or use “Resample scalar/vector/dwi volume” module and set “Manual output parameters”.