MRtrix3 / mrtrix3

MRtrix3 provides a set of tools to perform various advanced diffusion MRI analyses, including constrained spherical deconvolution (CSD), probabilistic tractography, track-density imaging, and apparent fibre density
http://www.mrtrix.org
Mozilla Public License 2.0
290 stars 179 forks source link

mrconvert: auto-strip trailing axes with dimension 1 #43

Closed Lestropie closed 10 years ago

Lestropie commented 10 years ago

mrconvert with the -coord option is often used to extract a single volume from a 4D image series. In this case one is left with a 4D image, where the dimension of the fourth axis is 1. Am wondering if the default behaviour should be to remove trailing unary axes.

jdtournier commented 10 years ago

I'd rather keep the behaviour entirely predictable, which would be to leave the image as a 4D image. Removing the trailing axis can be done using the -axes option if needed - for your specific case, that would be -axes 0,1,2.

Lestropie commented 10 years ago

If that's what you want it's cool; I just don't see a use case where the user would actually want / expect that residual axis. It also means explicitly checking for it and handling it wherever a 3D volume is expected (a bug report of which I why I brought this up).

jdtournier commented 10 years ago

Well, it's not necessarily what I want... I've thought about this on and off previously, but in the end always decided it was better to keep behaviour consistent, even if it might prove inconvenient at times. And to be honest, you come across the same issues for example in MatLab...

More to the point though, I think the best way to deal with these issues is for applications to handle such data appropriately, rather than them relying on the input being exactly as expected - if only because there is no reason to expect the input data to have been generated using MRtrix in the first place, so you couldn't rely on them matching your expectations anyway...