[RESOLVED] Hcp_fmri_volume errors when using Siemens fieldmap


Hi, when I run the hcp_fmri_volume step in my LegacyStyle Test data, I met an error. My test data has the single band fMRI data and Siemens fieldmaps (2 magnitude images + 1 phase diff image). Here, 2 magnitude images were merged to a file in …/unprocessed/FieldMap1/CBDP0008A_FieldMap_Magnitude.nii.gz, and the phase diff image is in …/unprocessed/FieldMap1/CBDP0008A_FieldMap_Phase.nii.gz.

The FieldMap1 in unprocessed/ is automatically generated by qunex setup_hcp , but I’m not sure about its correction.

When I successfully run the pre_freesurfer, freesurfer, and post_freesurfer, I try to run the hcp_fmri_volume in a same way (in QuNex v0.93.2 using singularity):

qunex hcp_fmri_volume \
    --sessions="/DataDir/CBD/DICOM_CBDP/DICOM2HCP_test/CBDP_study/processing/batch.txt" \

where the corresponding information (reading from original json files) in file processing/batch.txt is:

 # ---> fMRI Volume
 _hcp_bold_echospacing   : 0.000489996
 _hcp_bold_dcmethod      : SiemensFieldMap
 _hcp_bold_sbref         : NONE
 _hcp_bold_echodiff      : 2.46
 _hcp_bold_unwarpdir     : y
 _hcp_bold_gdcoeffs      : NONE
 _hcp_bold_doslicetime   : TRUE
 _hcp_bold_slicetimerparams : --odd
# Generated by QuNex 0.90.10 on 2022-04-15_16.04.1650009840
 id: CBDP0008A
 subject: CBDP0008A
 bids: /DataDir/CBD/DICOM_CBDP/DICOM2HCP_test/CBDP_study/sessions/CBDP0008A/bids
 raw_data: /DataDir/CBD/DICOM_CBDP/DICOM2HCP_test/CBDP_study/sessions/CBDP0008A/nii
 hcp: /DataDir/CBD/DICOM_CBDP/DICOM2HCP_test/CBDP_study/sessions/CBDP0008A/hcp
 hcpready: true
 01: T1w             :T1w
 02: T2w             :T2w
 03: FM-Magnitude    :magnitude
 05: FM-Phase        :phasediff
 06: bold1:rest      :bold rest run-1

However, it reported an error info:

--- Full QuNex call for command: hcp_fmri_volume 

gmri hcp_fmri_volume --sessions="/DataDir/CBD/DICOM_CBDP/DICOM2HCP_test/CBDP_study/processing/batch.txt" --sessionsfolder="/DataDir/CBD/DICOM_CBDP/DICOM2HCP_test/CBDP_study/sessions" 


WARNING: Use of parameters with changed name(s)!
         The following parameters have new names:
         ... hcp_biascorrect_t1w is now None!
         ... bold_preprocess is now bolds!
         Please correct the listed parameter names in command line or batch file!
WARNING: Parameter qx_cifti_tail was not specified. Its value was imputed from parameter hcp_cifti_tail and set to '_Atlas'!
WARNING: Parameter qx_nifti_tail was not specified. Its value was imputed from parameter hcp_nifti_tail and set to ''!
WARNING: Parameter cifti_tail was not specified. Its value was imputed from parameter qx_cifti_tail and set to '_Atlas'!
WARNING: Parameter nifti_tail was not specified. Its value was imputed from parameter qx_nifti_tail and set to ''!

# Generated by QuNex 0.93.2 on 2022-04-18_14.03.27.810508
gmri hcp_fmri_volume \
  --sessions="/DataDir/CBD/DICOM_CBDP/DICOM2HCP_test/CBDP_study/processing/batch.txt" \
  --sessionsfolder="/DataDir/CBD/DICOM_CBDP/DICOM2HCP_test/CBDP_study/sessions" \

Starting multiprocessing sessions in /DataDir/CBD/DICOM_CBDP/DICOM2HCP_test/CBDP_study/processing/batch.txt with a pool of 1 concurrent processes

---- Running local

Starting processing of sessions CBDP0008A at Monday, 18. April 2022 14:03:27

Session id: CBDP0008A 
[started on Monday, 18. April 2022 14:03:27]
Running HCP fMRI Volume pipeline [LegacyStyleData] ... 
---> PreFS results present.
---> FS results present.
---> PostFS results present.

---> Preprocessing settings (unwarpdir, refimage, moveref, seimage) for BOLD 1
     ... phase encoding direction not specified
     ... unwarp direction: y
     ... using study general EchoSpacing: 0.000489996 s
     ... Siemens fieldmap magnitude image 1 present 
     ... Siemens fieldmap phase image 1 present 
ERROR: Unknown error occured: 
Traceback (most recent call last):
  File "/opt/qunex/python/qx_utilities/hcp/process_hcp.py", line 2966, in hcp_fmri_volume
    fmmag = hcp['fieldmap'][int(fmnum)]['magnitude']
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

HCP fMRIVolume completed on Monday, 18. April 2022 14:03:27

===> Final report for command hcp_fmri_volume
... CBDP0008A ---> HCP fMRI Volume failed
===> Not all tasks completed fully!

I am not familiar with HCP pipeline, so I don’t know which part is wrong.

looking for your replay!

Lianglong Sun

Liaglong, hi!

Could you please provide us with list of commands that you ran when importing and processing the dataset and the related log files? We’re specifically interested in the log files for create_session_info. When create_session_info was run, the expectation is that the session_hcp.txt would then include the following information:

hcpready: true
 01: T1w             :T1w : fm(1)
 02: T2w             :T2w : fm(1)
 03: FM-Magnitude    :magnitude : fm(1)
 05: FM-Phase        :phasediff : fm(1)
 06: bold1:rest      :bold rest run-1 : fm(1)

The fm(1) enables identification of fieldmap image pairs and is used to inform, which of the fieldmap image paris is to be used for distortion correction for the specific bold (or structural) image. This information is missing from your session_hcp.txt files and the compiled batch.txt file.

The solutions to your issue are the following:

  1. You can edit the batch.txt file and add fm(1) to the sequence information as indicated above.
  2. You can rerun create_session_info command using the latest container and check whether the expected information is added to the session_hcp.txt files. It not, you can send us the create_session_info log file(s) to see, what the issue might be.
  3. You can wait for us to improve the hcp_fmri_volume command to be robust to the missing fm information in the batch.txt file. This might take a while.

With kind regards,


Grega, Hi~

It worked!

I didn’t run the create_session_info command before. I thought I could just manually change it, and I didn’t notice the fm sign in your wiki. Now I know how to do it, and the create_session_info command is successful. Thank you very much for your guidance!

With kind regards,