Using the new SanitizeImage interface might be a good place to start.
The problem is still present even if no susceptibiliyt distortion correction is performed.
https://openneuro.org/datasets/ds001236/versions/00002?app=FMRIPREP&version=53&job=3734dfcf-c09a-41aa-9db6-e32a4bb3115f
I previously thought this had something to do with PhaseEncodingDirection of the _bold file, but no I see it is happening whether it is set to "j" or "j-". It seems the problem happens when FLIRT is used to coregister vs bbregister.
Just to +1 this, I'm seeing something similar with the generated aCompCor mask.

huh - that was with bbregister? Could be a slightly different issue. Could you upload the data to OpenNeuro.org so I could try to debug it?
It says the bbregister refinement was rejected so I'm assuming that's not what it used. Happy to upload, though !
It's at least using the bbregister path. The FreeSurfer path uses mri_coreg and bbregister, and falls back to mri_coreg if the bbregister refinement is too different from a basic rigid registration. The FLIRT path follows the same principle, but it uses FLIRT and FLIRT+BBR.
I confirmed that the orientation issue does not happen when bbregister is being used: https://openneuro.org/datasets/ds001236/versions/00002?app=FMRIPREP&version=53&job=d94c02d1-aed6-437e-a508-74c9a224c238 (on this particular dataset).
I found a solution for the FLIRT related issue, but I could not replicate the issue reported by @emdupre using FMRIPREP 1.0.7 (with or without freesurfer) on the sample data provided. Maybe it's something different or related to dev code you've been currently working on?

I'll look into it and open another issue if necessary !
Thanks!
Best,
Chris
On Thu, Feb 22, 2018 at 10:22 AM, Elizabeth DuPre notifications@github.com
wrote:
I'll look into it and open another issue if necessary !
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/poldracklab/fmriprep/issues/999#issuecomment-367773306,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAOkp1C5s7xhSifwLX9cmjm7Ttu3w5Rvks5tXbBNgaJpZM4SNOzc
.
Most helpful comment
It's at least using the bbregister path. The FreeSurfer path uses mri_coreg and bbregister, and falls back to mri_coreg if the bbregister refinement is too different from a basic rigid registration. The FLIRT path follows the same principle, but it uses FLIRT and FLIRT+BBR.