nipreps / fmriprep

fMRIPrep is a robust and easy-to-use pipeline for preprocessing of diverse fMRI data. The transparent workflow dispenses of manual intervention, thereby ensuring the reproducibility of the results.
https://fmriprep.org
Apache License 2.0
629 stars 291 forks source link

Check for different qform/sform matrices in multiband/sbref pairs #2367

Open trh3 opened 3 years ago

trh3 commented 3 years ago

When fmriprep processes multiband data, it appears to rely on the sform matrix of the sbref, and makes the assumption that the sbref's sform matrix is the same as the multiband's sform. If these are not the same, fmriprep completes processing without error, but all the transformations applied to the multiband data are applied assuming a wholly incorrect xform. This leads to bad registration and normalization of the multiband images.

Now, admittedly, this is likely not a problem most folks are going to encounter, as current multiband protocols spit out correctly aligned image pairs. This issue happened with the data I was working on, because the multiband data was collected before official protocols were released for the scanner, so the image files were reconstructed using some custom scripts. These scripts put the correct xform matrix in the qform slot of the multiband, but put a different, and incorrect, xform in the sform slot of the multiband.

It would be useful if a check was implemented to just make sure that any multiband data has the same sform matrix as its corresponding sbref. No need to fix the issue in the pipeline, just throw an error if they don't match.

warmxue commented 3 years ago

Hi, I am experiencing the same problem. My sbref and func have different but correct orientations (sform), but the output func data is showing the wrong orientation (flipped). Ignoring the sbref can solve the issue, however, using a reoriented sbref will cause an error. I posted more details here: https://neurostars.org/t/incorrect-bold-func-output-orientation/20142. Just wondering if there is any update on this issue. Any suggestion would be really appreciated.

effigies commented 3 years ago

@warmxue This seems worth digging into, and probably not too difficult to fix. Are you able to share your dataset?

warmxue commented 3 years ago

@warmxue This seems worth digging into, and probably not too difficult to fix. Are you able to share your dataset?

Hi Chris, thanks for your instant reply and for being willing to help. Which type of files would you need, Dicom or Nifti? We should be able to share an example dataset. In addition to SBref and BOLD func multiband data, do you need any other files?

effigies commented 3 years ago

One subject from a BIDS dataset (along with any global JSON files) would be enough. You can share to this username @ gmail. If you're planning on sharing your data publicly in the next 36 months, you can put the whole dataset on OpenNeuro and share it with that email.

warmxue commented 2 years ago

One subject from a BIDS dataset (along with any global JSON files) would be enough. You can share to this username @ gmail. If you're planning on sharing your data publicly in the next 36 months, you can put the whole dataset on OpenNeuro and share it with that email.

Hi Chris, thanks for offering help, just to update you after re-checking the data I figured out, for that both the original functional data and the original sbref data, the .json sidecar and the nifti were not generated using a same package and the default orientation of the two packages for .json and nifti are different. When I just use dcm2niix to generate both .json and nifti file, this issue was solved.

effigies commented 2 years ago

Glad to hear you resolved your issue!