Closed akeshavan closed 5 years ago
Yeah. I am pretty sure there are cases where this assumption would fail.
Looks like the header dim_info tuple should give us that information.
For example, I think this should work:
In [9]: img = nib.load('/Users/arokem/source/Site-SI/sub-NDARBA507GCT/dwi/sub-ND
...: ARBA507GCT_acq-64dir_dwi.nii.gz')
In [10]: hdr = img.header
In [11]: hdr.get_dim_info()
Out[11]: (0, 1, 2)
In [12]: slice_dim = hdr.get_dim_info()[-1]
Which seems to work well in this case!
Unfortunately, this is not always preserved. For example, the data that I preprocessed through dmriprep has:
In [13]: hdr.get_dim_info()
Out[13]: (None, None, None)
So we'll need a good fall-back strategy if that value is None
(assume third dimension?). And we need to make sure we don't break it.
@arokem : we are dropping the volumes that have > threshold outlier slices. The threshold can be defined as a number or percentation of the total number of slices. but is it safe to assume that the 2nd axis is the slice dimension? I'm thinking it's not -- is there a way with nibel to get the index of the slice dimension?
https://github.com/nipy/dmriprep/blob/master/dmriprep/run.py#L312