QSIPREP error witth DWI json file ("pe_direction")

Hi. I have converted my DICOM to nift with MRicron and my bids folder is passing in bids validator. But running the code I’m getting the following error:
“traits.trait_errors.TraitError: The ‘pe_direction’ trait of a DiffusionSummaryInputSpec instance must be None or ‘i’ or ‘i-’ or ‘j’ or ‘j-’, but a value of ‘’ <class ‘str’> was specified.”

I’ve tried to add a new line in the json file with "pe_direction: “None”, but it was not succesfull.
The code I’m runnig with the error:

$ sudo docker run -ti --rm -v /usr/local/freesurfer/license.txt:/fslicense.txt:ro -v /mnt/c/Users/dubergonzoni/Documents/Eduardo/Research/teste:/data:ro -v /mnt/c/Users/dubergonzoni/Documents/Eduardo/Research/DWI_Preprocessed:/out pennbbl/qsiprep:latest /data /out participant --participant_label 01 --output-resolution 1.2 --fs-license-file /fslicense.txt -w /out/tmp
Making sure the input data is BIDS compliant (warnings can be ignored in most cases).
1: [WARN] The recommended file /README is missing. See Section 03 (Modality agnostic files) of the BIDS specification. (code: 101 - README_FILE_MISSING)

    Please visit https://neurostars.org/search?q=README_FILE_MISSING for existing conversations about this issue.

    Summary:                  Available Tasks:        Available Modalities:
    13 Files, 161.55MB                                T1w
    2 - Subjects                                      dwi
    1 - Session

    If you have any questions, please post on https://neurostars.org/tags/bids.

211122-12:03:50,555 nipype.workflow INFO:
Running with omp_nthreads=8, nthreads=12
211122-12:03:50,557 nipype.workflow IMPORTANT:

Running qsiprep version 0.14.3:
  * BIDS dataset path: /data.
  * Participant list: ['01'].
  * Run identifier: 20211122-120349_49ed7581-e3e5-4e39-8d63-a2c1267ee385.

211122-12:04:31,367 nipype.workflow INFO:
Combining all 1 dwis within the single available session
211122-12:04:31,379 nipype.workflow INFO:
[{‘dwi_series’: [’/data/sub-01/dwi/sub-01_dwi.nii’], ‘fieldmap_info’: {‘suffix’: None}, ‘dwi_series_pedir’: ‘’, ‘concatenated_bids_name’: ‘sub-01’}]
211122-12:04:38,167 nipype.workflow IMPORTANT:
Creating dwi processing workflow “dwi_preproc_wf” to produce output sub-01 (1.07 GB / 43 DWIs). Memory resampled/largemem=1.29/1.36 GB.
211122-12:04:40,211 nipype.workflow INFO:
Automatically using 5, 5, 5 window for dwidenoise
211122-12:05:10,308 nipype.workflow INFO:
Using 8 threads in eddy
Process Process-2:
Traceback (most recent call last):
File “/usr/local/miniconda/lib/python3.7/multiprocessing/process.py”, line 297, in _bootstrap
File “/usr/local/miniconda/lib/python3.7/multiprocessing/process.py”, line 99, in run
self._target(*self._args, **self._kwargs)
File “/usr/local/miniconda/lib/python3.7/site-packages/qsiprep/cli/run.py”, line 972, in build_qsiprep_workflow
File “/usr/local/miniconda/lib/python3.7/site-packages/qsiprep/workflows/base.py”, line 275, in init_qsiprep_wf
File “/usr/local/miniconda/lib/python3.7/site-packages/qsiprep/workflows/base.py”, line 727, in init_single_subject_wf
File “/usr/local/miniconda/lib/python3.7/site-packages/qsiprep/workflows/dwi/base.py”, line 444, in init_dwi_preproc_wf
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 641, in init
from_file=from_file, resource_monitor=resource_monitor, **inputs
File “/usr/local/miniconda/lib/python3.7/site-packages/nipype/interfaces/base/core.py”, line 191, in init
File “/usr/local/miniconda/lib/python3.7/site-packages/traits/has_traits.py”, line 1543, in trait_set
setattr( self, name, value )
File “/usr/local/miniconda/lib/python3.7/site-packages/traits/trait_handlers.py”, line 172, in error
value )
traits.trait_errors.TraitError: The ‘pe_direction’ trait of a DiffusionSummaryInputSpec instance must be None or ‘i’ or ‘i-’ or ‘j’ or ‘j-’, but a value of ‘’ <class ‘str’> was specified.

Hi @dubergonzoni,

pe_direction is a variable that is derived from the JSON field entitled "PhaseEncodingDirection". Check if "PhaseEncodingDirection" is in your DWI JSON sidecar files. If not, you can try to find the info in the original scanner acquisition files and enter them in the jsons manually (or with code, e.g. using the JSON python library). Usually the field will take a value of “-j” or “j” corresponding to AP and PA scans. Hope this helps.


Hi @Steven,

I have inserted the " `PhaseEncodingDirection" in the json file and now it’s working.

Thank you so much.

@dubergonzoni be aware that dcm2niix only populates PhaseEncodingDirection if it can be determined from the DICOM header. Modern versions of dcm2niix can determine this for Siemens and GE data. However, Philips DICOM data does not store these parameters. If you have a Philips scanner, I suggest you contact your Philips Research Collaboration Manager and lobby them to include vital sequence information into their scans. This is a limitation of the impoverished Phillips DICOMs, not dcm2niix.

@Chris_Rorden You are right, I’m using an old retrospective Philips DICOM data. I’ll check if this lack of information with the DICOM header is still happening and figure out how to fix for the next studies.
Thank you for your clarification.