/sub-FADFMRI100/ses-1/fmap/sub-FADFMRI100_ses-1_task-rest_run-001_bold-revPE.nii.gz
And many other files have the same error too.
Screenshots / relevant information:
Hi, I’m a beginner to neuroimaging analysis.
I wanted to check how phase direction works in fmap scans for BIDS datasets.
I have a dataset that looks like it has been converted using dcm2niix, and is now in a BIDS format.
The fieldmap files don’t meet the BIDS spec, so I am working out how to change them so that they do.
The fmap file names are written like sub-FADFMRI100_ses-1_task-rest_run-001_bold-revPE.nii.gz
It looks like it should be
sub-FADFMRI100_ses-1_task-rest_run-001_dir-AP_epi.nii.gz
It looks like the fmap files are the 4th option here, so I need the phase encoding direction for the file name.
This is a long way of asking, if I have the PhaseEncodingDirection (in the json file) and the image orientation (eg LAS, RPI, which I can get from the nifti file header), does this uniquely define the alphanumeric label phase encoding direction that needs to be in the filename? Is there more data I would need to use?
Hi Steven, thanks for the welcome and quick reply!
Apologies, I previously fixed issue number 2 that you mentioned, I just didn’t type the correct file name in.
sub-FADFMRI100_ses-1_run-001_dir-AP_epi.nii.gz
would be the corrected file name.
For this specific scan it is j- phase encoding direction, so it would be dir_AP.
Because I need to correct most of the dataset, I’m just curious what you mean by typically? Are there any other factors it’s dependant on? I believe all scans have the phase encoding direction, but I will check
Thanks for your response, I’m planning to write some code to fix the file names, but I just wanted to double check I understood the conversion, here are the steps I think to follow:
To determine the direction of the phase encoding for the file name:
Extract the NIfTI image qform_xorient, qform_yorient & qform_zorient values using fslhd.
Look at the BIDS json sidecar file, extract the phaseEncodingDirection.
Use the appropriate qform orient and flip if there is a minus.
Hi, @Steven are you sure chatGPT is correct? I have posed this exact question to chatGPT and it has given me conflicting answers on different occasions. Based on what I have read here: https://mrtrix.readthedocs.io/en/latest/concepts/pe_scheme.html#fixed-phase-encoding, I understand that phase encoding direction should be defined relative to the image axes, meaning the AP phase encoding direction should be j- for an RAS+ image orientation. But does is the opposite of what you/chatGPT proposed: j = AP, since RAS+ increases from posterior-to-anterior. Am I missing something?
@jhau, no you and @gabeyaw are correct and ChatGPT is wrong.
If the image is in RAS+, then proceeding from 0…N along the j axis is moving from posterior to anterior. So j would be posterior-to-anterior and j- would be anterior-to-posterior, which I would encode as dir-PA and dir-AP, respectively.
Note that the dir-<label> is just mnemonic for humans. The thing that’s important for processing is that the PhaseEncodingDirection is correct in the image metadata, and any reorientation of the image must also adjust the metadata. Which is why it’s best to let dcm2niix or a similar tool do the conversion and freeze your input data as-is.