Issue with initial preprocessing in BATMAN Pipeline on Philips DWI data (Reverse Phase-Encoding)

Hi Neurostars community,

After successfully completing the BATMAN tutorial dataset and getting it to run smoothly, I am now working on processing my own DWI data collected on a Philips 3T scanner. I have already converted it to BIDS format and organized properly. My plan is to eventually run the pipeline on multiple subjects, but for now, I am starting with just one subject to work through any issues. My main challenge is at the initial preprocessing stage, specifically in handling reverse phase-encoding (RPE) corrections.

Data Overview

DWI Directory:

The dwi folder contains two acquisitions collected in the AP direction:

sub-22_dir-AP_acq-1_dwi.bval  
sub-22_dir-AP_acq-1_dwi.bvec  
sub-22_dir-AP_acq-1_dwi.nii.gz  
sub-22_dir-AP_acq-1_dwi.json  
sub-22_dir-AP_acq-2_dwi.bval  
sub-22_dir-AP_acq-2_dwi.bvec  
sub-22_dir-AP_acq-2_dwi.nii.gz  
sub-22_dir-AP_acq-2_dwi.json

Both acquisitions have the following dimensions:

mrinfo sub-22_dir-AP_acq-1_dwi.nii.gz
Dimensions:        144 x 144 x 81 x 51
Voxel size:        1.66667 x 1.66667 x 1.7 x 5.3

Fieldmap Directory:

The fmap folder contains AP and PA b=0 images:

sub-22_dir-AP_epi.nii.gz  
sub-22_dir-AP_epi.json  
sub-22_dir-PA_epi.nii.gz  
sub-22_dir-PA_epi.json

Both fieldmaps have the following dimensions:

mrinfo sub-22_dir-AP_epi.nii.gz
Dimensions:        144 x 144 x 81
Voxel size:        1.66667 x 1.66667 x 1.7

Preprocessing Steps

I have followed a systematic approach to prepare my data for dwifslpreproc:

1. DWI Directory:

  • Concatenated Gradient Tables:
paste -d' ' sub-22_dir-AP_acq-1_dwi.bval sub-22_dir-AP_acq-2_dwi.bval > concatenated.bval
paste -d' ' sub-22_dir-AP_acq-1_dwi.bvec sub-22_dir-AP_acq-2_dwi.bvec > concatenated.bvec
  • Attached Gradients to the DWI File:
mrconvert dwi_den_unr_even.mif dwi_den_unr_even_with_gradients.mif \
          -fslgrad concatenated.bvec concatenated.bval
  • Extracted b=0 Volumes and Computed Mean:
dwiextract dwi_den_unr_even_with_gradients.mif --bzero b0_AP_even.mif
mrmath b0_AP_even.mif mean mean_b0_AP_even.mif -axis 3

2. Fieldmap Directory:

  • Prepared AP-PA Fieldmaps:
    • Converted NIfTI to MIF:
mrconvert sub-22_dir-PA_epi.nii.gz b0_PA_even.mif
mrconvert sub-22_dir-AP_epi.nii.gz b0_AP_even.mif
  • Computed Mean Images:
mrmath b0_PA_even.mif mean mean_b0_PA_even.mif -axis 3
mrmath b0_AP_even.mif mean mean_b0_AP_even.mif -axis 3
  • Concatenated AP and PA:
mrcat mean_b0_AP_even.mif mean_b0_PA_even.mif -axis 3 b0_pair.mif

Processing with dwifslpreproc

I attempted to process my data using dwifslpreproc:

singularity exec ~/bin/mrtrix3_latest.sif dwifslpreproc \
  dwi_den_even_resized_with_gradients.mif \
  sub-02_den_preproc.mif \
  -nocleanup \
  -pe_dir AP \
  -rpe_pair \
  -se_epi b0_pair.mif \
  -eddy_options " --slm=linear --data_is_shelled"

The Problem

While the command runs without crashing or giving me any errors, the warping correction doesn’t seem to work as expected. Instead of producing a properly corrected AP-PA combined image, the output still resembles the original AP image and it doesn’t seem like the PA image contributes to the distortion correction.

Additional Information

  • I have run the same pipeline successfully using the BATMAN tutorial dataset.
  • I have manually run topup on similar data previously, and it worked.
  • The b0_pair.mif file appears valid, and the dimensions match.

Question

Is there something specific about Philips DWI data (e.g., odd slice dimensions, intensity scaling, etc.) that could affect the performance of dwifslpreproc or topup during preprocessing?

I have been trying to ensure that the RPE correction works as expected, specifically that the PA information is correctly applied to correct the AP data. However, I am running into issues where the resulting warp does not seem to properly resolve the distortions in the AP images. Instead, the output looks more like the original AP image, as if the PA information wasn’t correctly incorporated.

Here’s what I have tried so far:

  • Tested both odd and even slice dimensions, ensuring the images align properly.

  • Processed the files in two ways: by concatenating acquisitions into one file and also by processing them individually.

  • Confirmed the phase-encoding directions in the metadata (AP and PA).

  • Resized images to ensure matching dimensions for AP and PA images before concatenation for b0_pair.mif.

Despite these steps, the correction doesn’t seem to work as expected. Are there any known issues with Philips data or preprocessing steps (e.g., intensity scaling, qform/sform discrepancies, or metadata handling) that I might be missing? How can I ensure that the reverse phase-encoding (RPE) correction is correctly applied?

Any insights, suggestions, or things to check would be greatly appreciated. Please let me know if you have further questions or queries. Thank you so much!