That will depend on exactly what you’re trying to achieve, but in general, if you’re planning on processing your images within MRtrix, there shouldn’t ever be any need to change the strides - all applications will handle the data just fine.
The only times you’ll need to worry about this is when interacting with other packages that may not handle these issues too well - or at least, handle them differently. One example is displaying an overlay on an image within FSLView - if the strides differ between the images, the overlay will generally be all wrong (at least it was the last time the issue was raised…), whereas it would be just fine in MRView. But I’ve spent quite a bit of time making sure this issue with mismatched strides / transform in NIfTI images doesn’t happen - at least not routinely: NIfTI images produced by MRtrix3 should match the strides / transform of the input image, which should avoid these types of problems.
The other time you might want to change the stride is to avoid explicit preload-to-RAM operations that might happen in some applications. For example, tckgen
will preload the source data to RAM if the datatype is not native 32-bit float or the strides do not correspond to a volume-contiguous layout. This is done to allow the fastest possible access to the image data during processing, which helps quite a bit with performance during tracking. But if you do lots of small tractography jobs and you see the application is constantly preloading data, you may find that something like:
$ mrconvert data.nii -datatype float32 -stride 0,0,0,1 data_no_preload.mif
and feeding that into tckgen
instead will avoid those preloads - the data will be accessed as-is via memory-mapping - no explicit loading required. Note that dwi2fod
produces volume-contiguous images by default; but only if the output format is *.mif/mih
- none of the other file formats support volume-contiguous storage…
And yes, that -stride
option to mrconvert
is how you can adjust it. It’s also available in a few other commands where it makes sense. The whole issue of strides is now discussed in a bit more detail here, if you’re interested.