BIDS structure to detect rev_b0

Hello TractoFlow team,

I’m having problems getting TractoFlow to recognize the rev_b0 image in my BIDs structure. I ran dcm2bids with the following config:

{
    "descriptions": [
        {
            "dataType": "anat",
            "modalityLabel": "T1w",
            "criteria": {
                "SeriesDescription": "*MPRAGE*"
            }
        },
        {
            "dataType": "dwi",
            "modalityLabel": "dwi",
            "criteria": {
                "SeriesDescription": "*DTI*"
            }
        },
        {
            "dataType": "func",
            "modalityLabel": "bold",
            "customLabels": "task-rest",
            "criteria": {
                "SeriesDescription": "*restbold*"
            }
        },
        {
            "dataType": "fmap",
            "modalityLabel": "fmap",
            "customLabels": "phase",
            "criteria": {
                "SidecarFilename": "*B0map*ph*"
            },
            "IntendedFor": 1
        }
    ]
}

And I see this in the directory structure:

sub-600009963128/anat:
sub-600009963128_T1w.json  sub-600009963128_T1w.nii.gz

sub-600009963128/dwi:
sub-600009963128_run-01_dwi.bval  sub-600009963128_run-01_dwi.json    sub-600009963128_run-02_dwi.bval  sub-600009963128_run-02_dwi.json
sub-600009963128_run-01_dwi.bvec  sub-600009963128_run-01_dwi.nii.gz  sub-600009963128_run-02_dwi.bvec  sub-600009963128_run-02_dwi.nii.gz

sub-600009963128/fmap:
sub-600009963128_phase_run-01_fmap.json  sub-600009963128_phase_run-01_fmap.nii.gz  sub-600009963128_phase_run-02_fmap.json  sub-600009963128_phase_run-02_fmap.nii.gz

sub-600009963128/func:
sub-600009963128_task-rest_bold.json  sub-600009963128_task-rest_bold.nii.gz

However, topup is not running. Does it expect some pre0defined file name to find the corresponding rev_b0s?

Thanks!

Dear @gsudre,

Thank you for using Tractoflow.

A couple of things:

  1. In the BIDS structure rev_b0 needs the suffix _epi and not fmap. See here
  2. Make sure that you’ve got the PhaseEncodingDirection tag in you dwi (json file) as well as in you’re rev_b0 (json file). You can use the option “sidecarChanges” in your config file for dcm2bids to add the information in the json file if it’s not there by default. You need a reverse phase encoding direction between (rev_b0 and dwi) in order to use topup.

Give it a try and don’t hesitate to ask for help.

Best,
Arnaud

As @abore noted, the BIDS file must specify the PhaseEncodingDirection. If your BIDS sidecar lists PhaseEncodingAxis instead of PhaseEncodingDirection, it means that dcm2niix was unable to to determine the polarity of the phase encoding. If your system is from Siemens, PhaseEncodingDirection should be detected. If your system is from GE, you may need to upgrade to the latest release of dcm2niix to detect PhaseEncodingDirection. If your system is from Philips, the DICOM images do not provide information to determine the polarity (I would suggest you lobby your Philips Research Collaboration Manager to report this information in future software releases).

Thank you both for your answers! Yes, I do have PhaseEncodingDirection in the json for both DTI and rev_b0. However, it’s j- for both of them. I’m not too familiar with topup. Should I do something to the rev_b0 sequence?

To be specific, I’m not sure about the “rev” part. The scan is described as “The main magnetic field (i.e. B0) was spatially mapped using a double-echo, gradient-recalled echo (GRE) sequence. Both magnitude and phase images were selected for image reconstruction since it is the phase signal which contains information about the magnetic field”. I’m using the output of dcm2niix in the phase scan (not the magnitude), so do I need to somehow reverse the image (rev_), and make it j+? I actually get two different .nii + sidecar when I convert that scan, each with a single 3D volume, but both j-.

Somewhat unrelated, the actual DTI sequence was acquired in 2 separate runs, such that the bvecs of run1 and run2, together, form a sphere. Should I (manually?) concatenate the two sessions + bval + bvec prior to running TractoFlow, such that all DTI properties are estimated using both runs at once (e.g. instead of two separate, incomplete, FA maps)?

Thanks again,

Gustavo

Hi @gsudre,

From what you describe I think this a not a rev_b0 especially because the phase encoding direction is the same as the DWI protocol. Also, usually a rev_b0 does not come with mag and phase. You acquisition looks like fieldmaps. You can see a description here here. Tractoflow is not able to use this kind of images.

About your DWI protocol: make sure the phase encoding directions are the same and then yes you’ll have to concatenate these two acquisitions before running tractoflow. You can use the docker hub (scilpy:latest) here and use the command line scil_concatenate_dwi.py to concatenate your dwis.

Hope it helps
Best,
Arnaud

Yes, that’s quite helpful. Thanks Arnaud!

I have a follow up question about how our DWI data needs to be organized in BIDS format for use with Tractoflow.

If I understand correctly, there should be one DWI run with one particular phase encoded direction (mine is LR/i-/x-) along with bvec and bval files for the run. Then, for susceptibility dist correction, I need one reverse phase encoded (RL/i/x) B0 image.

In the past, I typically pulled out the single B0 image from a RL phase encoded run (which is the first image in that run) to use in FSL correction routines.

Here are my current BIDS /sub-X/ses-01/dwi directory contents

sub-S6581DHW_ses-01_acq-dir91LR_dwi.bval
sub-S6581DHW_ses-01_acq-dir91LR_dwi.bvec
sub-S6581DHW_ses-01_acq-dir91LR_dwi.json
sub-S6581DHW_ses-01_acq-dir91LR_dwi.nii.gz
sub-S6581DHW_ses-01_acq-dir91LR_sbref.json
sub-S6581DHW_ses-01_acq-dir91LR_sbref.nii.gz
sub-S6581DHW_ses-01_acq-dir91RL_dwi.bval
sub-S6581DHW_ses-01_acq-dir91RL_dwi.bvec
sub-S6581DHW_ses-01_acq-dir91RL_dwi.json
sub-S6581DHW_ses-01_acq-dir91RL_dwi.nii.gz
sub-S6581DHW_ses-01_acq-dir91RL_rev_b0.json
sub-S6581DHW_ses-01_acq-dir91RL_rev_b0.nii.gz
sub-S6581DHW_ses-01_acq-dir91RL_sbref.json
sub-S6581DHW_ses-01_acq-dir91RL_sbref.nii.gz

The _rev_b0.* files were added by me through extraction of the first image of the *RL_dwi.nii.gz run.

What are the proper contents of this folder to allow it work with Tractoflow?

Here is my call to tractoflow uses the singularity image, but I’m getting Read_BIDS errors, which might be due to me not having the proper files.

nextflow run tractoflow/main.nf
–bids basefolder/bidsfolder/sub-subjid
–dti_shells “DTI_SHELLS”
–fodf_shells “FODF_SHELLS”
-with-singularity ${basefolder}/singularity/tractoflow_2.2.1_b9a527_2021-04-13.sif
–participants_label $subjid
-resume

Thanks.

Hi @Chyatt ,

From what I can see, you acquired a full RL/LR. We are currently working on a new version that will be able to take advantage of this kind of acquisition. In the meantime, if you want to make it work you will have to simplify your BIDS organisation. Choose either a RL or LR acquisition put it in the dwi folder then take one of the rev_b0 (the opposite Phase Encoding Direction) and put it in a fmap folder but call it sub-S6581DHW_ses-01_acq-dir91RL_epi.nii.gz. Finally, the json file of this fmap should have a field called “IntendedFor” with the path of the corresponding dwi.

When running tractoflow, the bids arg should point to main bids folder not the subject one.

Hope it helps.
Don’t hesitate if you need more help

Arnaud

That solved the problem. Thanks!

For anyone else with this issue, here is what I did

I deleted the following files
sub-S6581DHW_ses-01_acq-dir91RL_dwi.bval
sub-S6581DHW_ses-01_acq-dir91RL_dwi.bvec
sub-S6581DHW_ses-01_acq-dir91RL_dwi.nii.gz

Then I move the following file to /fmap
sub-S6581DHW_ses-01_acq-dir91RL_dwi.json

and renamed it as
sub-S6581DHW_ses-01_acq-dir91RL_epi.json

and added the following text to the bottom of that json file, just before the last curly brace

“IntendedFor”:
“ses-01/dwi/sub-S6581DHW_ses-01_acq-dir91LR_dwi.nii.gz”

(intended for the LR, or “i-” seq in /dwi)

Then moved
sub-S6581DHW_ses-01_acq-dir91RL_rev_b0.nii.gz

to fmap and renamed as
sub-S6581DHW_ses-01_acq-dir91RL_epi.nii.gz