How to calculate data strides

Hi MRtrix experts,

How does MRtrix calculate data strides from Nifti data? does it base on affine?

Regards,
John

1 Like

Hello @VSsmall ,

MRtrix3 calculates strides in the format of scanner co-ordinate system. This might be helpful to you.

https://mrtrix.readthedocs.io/en/latest/getting_started/image_data.html

Suren

1 Like

Thanks!!

Regards,
John

Hi John,

Strides of a NIfTI image are always +1,+2,+3(,+4,…). However, upon reading a NIfTI (or any other image format), if the header transform is not approximately an identity matrix (i.e. the image axes do not approximately correspond to RAS), then MRtrix3 will internally permute / flip the axes in terms of both the transform and the strides in order for the image to “look like” a RAS image. See specifically “Interaction between strides and image transform”.

Cheers
Rob

Thanks!!!