[RESOLVED] Adding nocheck argument to PreFreesurfer

Hi Qunex devs,

I am running prefreesurfer on 7T Siemens data that has large echodiff of 10.26 ms. This raises a warning during the prefreesurfer pipeline

FieldMapPreprocessingAll.sh: HCPPIPEDIR: /opt/HCP/HCPpipelines
FieldMapPreprocessingAll.sh: FSLDIR: /opt/fsl/fsl
FieldMapPreprocessingAll.sh: HCPPIPEDIR_Global: /opt/HCP/HCPpipelines/global/scripts
Mon Jan 8 14:16:43 EST 2024:FieldMapPreprocessingAll.sh: Field Map Preprocessing and Gradient Unwarping
Mon Jan 8 14:16:43 EST 2024:FieldMapPreprocessingAll.sh: START
Unlikely difference in TE found: dTE = 10.26 milliseconds
Expecting values between 0.1 and 10.0 milliseconds
To force the script to use this value use the --nocheck argument

Is there a way to force the script to use this value within Qunex? I tried running with --nocheck=yes, but that didn’t do anything. If I run the script with --hcp_echodiff=9.99 it runs smoothly, so large echodiff is definitely what throws the script off.

here is my command:

qunex_container hcp_pre_freesurfer \
    --container="gitlab.qunex.yale.edu:5002/qunex/qunexcontainer:0.98.6" \
    --sessionsfolder="/Users/kolobarica/Desktop/pals/sessions" \
    --sessions="PALS_04" \
    --batchfile="/Users/kolobarica/Desktop/pals/processing/batch.txt" \
    --overwrite=yes \
    --parsessions=1 \
    --hcp_avgrdcmethod='SiemensFieldMap' \
    --hcp_brainsize=170 \
    --hcp_t1samplespacing=0.000004 \
    --hcp_t2samplespacing=0.0000037 \
    --hcp_unwarpdir=y \
    --nocheck=yes \
    --hcp_echodiff=10.26 \
    --hcp_seunwarpdir=y \
    --hcp_seechospacing=0.0000041

Hi,

this is a bit tricky. QuNex runs HCP PreFreeSurfer, which as a part of its steps runs FSL’s fsl_prepare_fieldmap. fsl_prepare_fieldmap is the one that should be executed with the --nocheck option. So, to get this option available through QuNex, it would first need to be available through HCP Pipelines. I will talk with HCP folks if this is something they would be interested in and I can then code it as this seems like something useful and easy to do.

Before that happens you have a workaround, what you can do is:

Step 1: Create a local copy of HCP pipelines (let’s say in /Users/kolobarica/Desktop/HCPpipelines, adapt this path as suits your system). Execute the following in terminal:

cd /Users/kolobarica/Desktop
git clone git@github.com:Washington-University/HCPpipelines.git

Step 2: Now we have HCPpipelines located on our disk at /Users/kolobarica/Desktop/HCPpipelines. Next, we need to add the --nocheck flag to the appropriate location. To do this, edit this file:
/Users/kolobarica/Desktop/HCPpipelines/global/scripts/FieldMapPreprocessingAll.sh and add the --nocheck to line 138 in it. So that line becomes:

${FSLDIR}/bin/fsl_prepare_fieldmap SIEMENS ${WD}/Phase ${WD}/Magnitude_brain ${WD}/FieldMap ${DeltaTE} --nocheck

Step 3: Run QuNex by overwriting the HCPpipelines in the container with the modified version you have sitting outside.

qunex_container hcp_pre_freesurfer \
    --container="gitlab.qunex.yale.edu:5002/qunex/qunexcontainer:0.98.6" \
    --sessionsfolder="/Users/kolobarica/Desktop/pals/sessions" \
    --sessions="PALS_04" \
    --batchfile="/Users/kolobarica/Desktop/pals/processing/batch.txt" \
    --overwrite=yes \
    --parsessions=1 \
    --hcp_avgrdcmethod='SiemensFieldMap' \
    --hcp_brainsize=170 \
    --hcp_t1samplespacing=0.000004 \
    --hcp_t2samplespacing=0.0000037 \
    --hcp_unwarpdir=y \
    --nocheck=yes \
    --hcp_echodiff=10.26 \
    --hcp_seunwarpdir=y \
    --hcp_seechospacing=0.0000041 \
    --dockeropt="-v /Users/kolobarica/Desktop/HCPpipelines:/opt/HCP/HCPpipelines"

The important thing is the --dockeropt parameter at the end. What this does is it binds a folder on the system’s volume (-v) over a folder inside the container’s volume. In our case it binds the HCPpipelines sitting in your desktop folder over the ones in the container and this should attach the --nocheck parameter to the relevant script.

Let me know how it goes.

Best, Jure

Another possibility might be that you have your units wrong. Apparently, the default TE value for the Siemens 7T scanner is 1.026 ms.

Best, Jure

Thanks Jure, I’ll give this workaround a try!

One last question for you, do you know if qunex has the ability to prep data for Freesurfer with extra bias correction + do submillimiter recon? E.g. see here: HighFieldRecon - Free Surfer Wiki

Hi,

Per my understanding of HighFieldRecon - Free Surfer Wiki, you need to do the firrst step manually on apropriate FS input files. Next you just need to run FS, for any extra args hcp_freesurfer uses:

        --hcp_fs_extra_reconall (str, default ''):
            A string with extra parameters to pass to FreeSurfer recon-all.
            The extra parameters are to be listed in a pipe ('|') separated
            string. Parameters and their values need to be listed
            separately. E.g. to pass `-norm3diters 3` to reconall, the
            string has to be: "-norm3diters|3".
            (Please note that it will only be used when HCP Pipelines are
            used. It is not implemented in hcpmodified!)

Best, Jure