Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slice timing issue with Anterior to Posterior #29

Closed
cchaswell opened this issue Dec 28, 2020 · 7 comments
Closed

Slice timing issue with Anterior to Posterior #29

cchaswell opened this issue Dec 28, 2020 · 7 comments
Assignees
Labels
question Further information is requested

Comments

@cchaswell
Copy link

I was running data from a site that specified their slice timing direction as Anterior to Posterior in beta 6. I chose that option in the halfpipe user interface, however it found 44 scans with I-S direction. I continued to try to run and got an error:

[2020-12-28 14:56:56,0915] [halfpipe ] [ERROR ] Exception: The 'slice_encoding_direction' trait of a TShiftInputSpec instance must be 'k' or 'k-', but a value of 'j-' <class 'str'> was specified.

I'm not sure if that is due to some of the scans possibly not being A-P or not.

Also, how can I tell the direction from header information? I am double checking what sites have told me but I cannot find that information from using something like fslhd to check the header.

Thank you.

@HippocampusGirl HippocampusGirl added the question Further information is requested label Dec 28, 2020
@HippocampusGirl
Copy link
Member

Dear Courtney,

Apparently it is unsupported if the slice encoding direction is not on the third axis of the NIfTI file.

  1. Could you try to re-orient the files so that this is the case, for example using fslswapdim weird_nifti.nii.gz LR IS PA new_nifti.nii.gz. I have not tested this, so you may need to play around with the exact parameters.

  2. Also, we could ask the developers of fmriprep, because this is an issue in their code.

@HippocampusGirl
Copy link
Member

Apparently the developers of fmriprep discussed this at nipreps/fmriprep#1345, and decided that it's not an issue. One of the developers of AFNI writes "I have never seen data where the slice-encoding dimension is not k, and am not sure how the software would behave. "

@cchaswell
Copy link
Author

cchaswell commented Dec 30, 2020 via email

@HippocampusGirl
Copy link
Member

So what you are saying is that the image metadata contradicts the slice acquisition direction provided by the sites? In this case, I think before we think any further on the software side, we need to be doubly sure that they were actually acquired that way. My suggestion would be to work with the sites to get first-hand information on the sequence to make sure that they did not confuse slice acquisition and phase encoding direction :-)

@cchaswell
Copy link
Author

cchaswell commented Dec 30, 2020 via email

@HippocampusGirl
Copy link
Member

It's actually two steps. First, you need to find which dimension stores the slices.

$ fslhd {file} | grep _dim
phase_dim       2
freq_dim        1
slice_dim       3

If they are all zeros, that means that the information is missing from the NIfTI header. However, if you get 1, 2, or 3, those correspond to the x, y, and z axes, respectively.

Now, you need to see which anatomical axis the dimension corresponds to. In this case, slice_dim is 3, so the axis is z. So we ask for the orientation of the z-axis, which is called qform_zorient. For the other axes, there are also qform_xorient and qform_yorient, and running fslhd {file} will print them all. However, we can also use fslval to get just the information we want.

$ fslval {file} qform_zorient
Inferior-to-Superior

This is exactly what Halfpipe does in the background, just with Python/Nibabel instead of FSL tools :-)

@ilyaveer
Copy link
Contributor

ilyaveer commented Jan 5, 2021

Courtney, indeed very likely that some confused slice acquisition order and phase encoding direction. I second the fmriprep people, I don't know any data set where data was not acquired in the axial direction (i.e., I-S or S-I). Good to know that this confusion occurs, we should be very explicit in our manual about the difference between acquisition order and encoding direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants