Qsiprep node inputs : bval_file, bvec_file <undefined>

Hi! I tried qsiprep with fs reconstruction done with freesurfer 7.3.1, and qsiprep 0.16.1.

However, all of my 45 subjects were encountered with crash log like below.

login3.stampede2(1069)$ cat crash-20221121-090623-tg881334-gather_inputs-f7d5ccf4-e07a-44f1-96b1-55a465528bfd.txt 
Node: qsiprep_wf.single_subject_NDARINV0Y8YJ2UR_wf.dwi_preproc_ses_2YearFollowUpYArm1_run_01_wf.hmc_sdc_wf.gather_inputs
Working directory: /out/tmp/qsiprep_wf/single_subject_NDARINV0Y8YJ2UR_wf/dwi_preproc_ses_2YearFollowUpYArm1_run_01_wf/hmc_sdc_wf/gather_inputs

Node inputs:

b0_threshold = 100
bval_file = <undefined>
bvec_file = <undefined>
dwi_file = <undefined>
epi_fmaps = <undefined>
original_files = <undefined>
raw_image_sdc = True
topup_max_b0s_per_spec = 3
topup_requested = False

Traceback (most recent call last):
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node gather_inputs.

Traceback:
	Traceback (most recent call last):
	  File "/usr/local/miniconda/lib/python3.8/site-packages/nipype/interfaces/base/core.py", line 398, in run
	    runtime = self._run_interface(runtime)
	  File "/usr/local/miniconda/lib/python3.8/site-packages/qsiprep/interfaces/eddy.py", line 76, in _run_interface
	    get_best_b0_topup_inputs_from(
	  File "/usr/local/miniconda/lib/python3.8/site-packages/qsiprep/interfaces/epi_fmap.py", line 204, in get_best_b0_topup_inputs_from
	    spec_lookup[unique_bids_file] = spec_line % spec['TotalReadoutTime']
	TypeError: must be real number, not NoneType

I checked that all the subjects have a valid BIDS file, and have bval and bvec files. However, the error log above shows that the node inputs for bval, bvec are . Is there something that I can do to fix this? Thank you in advance!

Hi,

This looks like the problem. Is TotalReadoutTime defined in your DWI json files?

While we’re at it, can you show the command you used to run QSIPrep, including any other parts of your submissions script that may be relevant?

Thanks,
Steven

1 Like

Thank you @Steven for your response!

The json file for the dwi was the following : {"registration_matrix_T1": [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], "IntendedFor": "sub-NDARINV0ZTJ2432_ses-2YearFollowUpYArm1_run-01_dwi.nii", "RepetitionTime": 4.2, "EchoTime": 0.089, "FlipAngle": 90.0, "PhaseEncodingDirection": "i"} (it’s from ABCD, but I added “PhaseEncodingDirection” : “i”)

The whole command I ran was the following

#SBATCH -J qsiprep_icx-normal#name of the job #SBATCH -N 2  #24 sub per node, so for 128 subjects, 5.01 neede,d so doing 6  #how many nodes you need #SBATCH -n $1  #how many jobs 
#SBATCH -p icx-normal #skx-dev for faster allocation#flat-quadrant #the queue on stampede 2 to use
#SBATCH -o ./step3_shell_outputs/icx-normal_QSIPREP_preproc.o%j  #change according to you job name
#SBATCH -e ./step3_shell_outputs/icx-normal_QSIPREP_preproc.e%j #change according to you job name
#SBATCH -t 48:00:00
#SBATCH -n 1
#SBATCH -N 1
#SBATCH -c 160
##SBATCH –-mail-user=dyhan0316@gmail.com

echo "hi"

data_pth=/scratch/08834/tg881334/2019/2.BIDS/

sub_save_dir=/scratch/08834/tg881334/2019/5.qsiprep_results/
supp_dir=/work2/08834/tg881334/stampede2/CHA_preproc/CHA_preproc_supplementary_files
sing_img_dir=${supp_dir}/qsiprep-0.16.1.sif
fs_dir=/scratch/08834/tg881334/2019/4.FS_untar

module load tacc-singularity
#change nthreads per omp to like 4 
#infant when 4.5~5 등등
singularity run --cleanenv -B ${data_pth}/:/data:ro,${sub_save_dir}/:/out,${supp_dir}:/freesurfer,${fs_dir}:/fs_input ${sing_img_dir} /data /out participant -w /out/tmp --output_resolution 1.2 --denoise_after_combining --unringing_method mrdegibbs --b0_to_t1w_transform Affine --intramodal_template_transform SyN --fs-license-file /freesurfer/license.txt --skip_bids_validation --freesurfer-input /fs_input --recon-spec mrtrix_multishell_msmt_ACT-hsvs --omp-nthreads 4

Encountered exactly the same problem, is it because the dwi json dictionary file missed a ‘TotalReadoutTime’ key?:slightly_frowning_face::slightly_frowning_face:

Hi! Have you solved the problem? I’ve got the same one :frowning: Although I specify that not fieldmap is needed, it still looks for it and I get the same error.

Hi @Irina1, and welcome to neurostars!

This is an old issue, and it is hard to help with the limited amount of information you provided. Can you please make sure you’re using the most recent qsiprep version, and then if you’re still getting an error, open up a Software Support post and fill in all the information.

Thanks,
Steven

Hi, did you solve this question? I have the same questions. Could you please share how to solve this question?

Hi Steven,
Actually, I have the same problem, and I used qsiprep_1_0_wf to analyze. When I checked my DWI Josn file, I found it didn’t include the TotalReadoutTime. Below is my submission script.

apptainer run --containall --writable-tmpfs \
    -B $inputpath,$outputpath,${freesurfer_license_folder}:/opt/freesurfer/license.txt \
    -B ${scratch_dir} \
    ${path_to_singularity_image} \
    $inputpath $outputpath participant \
    --fs-license-file /opt/freesurfer/license.txt \
    --participant-label $subjID \
    --skip-bids-validation \
    --anat-modality T1w \
    --denoise-method dwidenoise \
    --unringing-method mrdegibbs \
    --verbose \
    --work-dir $scratch_dir \
    --use-syn-sdc \
    --output-resolution 1.2

Second, my datasets did not include fieldmap data and different phase encoding directions data, but I want to use the [Fieldmap-less estimation (experimental)] method to apply Susceptibility correction. So I add --use-syn-sdc, But I am so confused If I need to add command –ignore fieldmaps? And if my script needs any correction. Looking forward to your reply.
Sincerely

Hi @Yufeng_He,

You need TotalReadoutTime in your DWI json if you want to do any distortion correction. For the fieldmapless method, you do not need to ignore field maps unless you have files in the fmap folder you are trying to ignore.

Best,
Steven

I am so happy to receive your reply. Actually, I have reanalysis converted .dcm to NII data using heudiconv. But the DWI josn file didn’t include the TotalReadoutTime. If I calculate the TotalReadoutTime and add it to my DWI josn file manually, is it possible?
Whatever, I read the neurostars other questions, and acquired the TotalReadoutTime = Echo spacing * (ReconMatrixPE - 1). But I checked my DWI josn file, and it also didn’t include Echo spacing. So I asked Chatgpt (hope it is right), and it told me Echo Spacing= 1/Bandwidth Per Pixel Phase Encode. So now, I know
“PixelBandwidth”: 1595,
“AcquisitionMatrixPE”: 112.
And according the equation, the TotalReadoutTime is 1/1595*(112-1)=0.06959
Are my calculations correct?
Looking forward to your reply,
Sincerely

Hi @Yufeng_He,

Yes if you calculate the TotalReadoutTime you can add it to your JSONS. I don’t know well enough if that calculation is correct. But, I think for your purposes, you can just use one value for all your images (something reasonable like 20-50 ms), and see how that works. Just make sure the same value is used for all images.

Best,
Steven

Yes, thank you so much. I will try it again.

Hi Steven! Thank you so much for your feedback. My problem is identical to @Yufeng_He, the issue is with the TotalReadoutTime which is absent in the json file.

I ran the following:

docker run -ti --rm \
    -v /media/scripts:/scripts:ro \
    -v /media:/data:ro \
    -v /media/sub_12_output:/out \
    -v /home/ocuments/license.txt:/opt/freesurfer/license.txt:ro \
    pennbbl/qsiprep:latest \
    /data /out participant \
    --output-resolution 1.8 \
    --verbose \
    --write-graph \
    --ignore fieldmaps

and got this:

Node inputs:

b0_threshold = 100
bval_file = <undefined>
bvec_file = <undefined>
dwi_file = <undefined>
eddy_config = /opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/data/eddy_params.json
epi_fmaps = <undefined>
json_file = <undefined>
original_files = <undefined>
raw_image_sdc = True
topup_max_b0s_per_spec = 1
topup_requested = False

- some error traceback --
Traceback:
	Traceback (most recent call last):
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 397, in run
	    runtime = self._run_interface(runtime)
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/interfaces/eddy.py", line 92, in _run_interface
	    get_best_b0_topup_inputs_from(
	  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/interfaces/epi_fmap.py", line 244, in get_best_b0_topup_inputs_from
	    spec_lookup[unique_bids_file] = spec_line % spec["TotalReadoutTime"]
	TypeError: must be real number, not NoneType

Hi @Irina1,

Same solution should work for you too. Also qsiprep is now maintained under the pennlinc (not pennbbl) dockerhub repo. I recommend not using the latest tag and u stead using a numbered version so you don’t unknowingly switch versions mid study.

Best,
Steven

@Steven, thank you so much, it was very helpful! I replaced pennbbl with pennlinc, indicated the version, and finally got the output for the ‘figures’ folder.

Regarding TotalReadoutTime: I manually set the TotalReadoutTime in my JSON file and it worked (unfortunately, I don’t have parameters needed to calculate TotalReadoutTime, so I just picked an approximate number that other people use), e.g.

{
    "Manufacturer": "Philips",
    "PatientPosition": "HFS",
    "SeriesDescription": "ImageMRSERIES",
    "ProtocolName": "WIPDTI_jones30_b1000_SPIRweakSENSE",
    "SeriesNumber": 3,
    "AcquisitionNumber": 3,
    "ImageComments": "Hippo",
    "PhilipsRescaleSlope": 13.4598,
    "PhilipsRescaleIntercept": 0,
    "PhilipsScaleSlope": 0.000954389,
    "UsePhilipsFloatNotDisplayScaling": 1,
    "EchoTime": 0.051,
    "RepetitionTime": 4.41,
    "TotalReadoutTime": 0.1,
    "PhaseEncodingDirection": "j",
    "ImageOrientationPatientDICOM": [
        0.998597,
        -0.0230705,
        0.0476607,
        0.0270212,
        0.996101,
        -0.0839846
    ],
    "ConversionSoftware": "dcm2niix",
    "ConversionSoftwareVersion": "v1.0.20220720"
}