[RESOLVED] Dwi_dtifit using a dti data file different than "data.nii.gz"

Hi, I’m processing DWI data collected using the HCP Lifespan protocol (b-values: 1500, 3000). The HCP course 2019 practical mentions that the DTI model is good for low b-value data. So I extracted the lower b-value data (1500) using the FSL tool select_dwi_vols and named the output file as “data_b1500”.

Looking at the possible parameters for dwi_dtifit, I see no option for entering the data file unlike the bvals and bvecs files. I looked into the “dwi_dtifit.sh” script inside the qunex container, and it seems that “data.nii.gz” is hard-coded as the dwi data file.

My question is: is there a way to use another file name besides “data.nii.gz” for dwi_dtifit? If not, what is your suggestion to run dtifit using a data file named “data_b1500.nii.gz” (and data_b1500.bval, data_b1500.bvec files)?

Thank you.

Estephan

Hi Estephan,

Yes, the input data that gets used is hard coded to the outputs of steps that preceed dwi_dtifit. In other words, dwi_dtifit will take as its input, the outputs from QuNex commands that are usually ran before it. I can see merit where this is problematic, which is well outlined in your post. Right now there are two options:

  1. Rename/organize your data manually so dwi_dtifit will use the files you want it to use.
  2. Enter the QuNex container, load the environment and run FSL DTIFIT directly by bypassing QuNex. There you can provide any parameters to it that you want. This can be a bit tricky on HPC systems with schedulers.

In the meantime, we will consider making dwi_dtifit more flexible so you will be able to configure which input files get used, e.g. through a data_suffix parameter, which you could set to b1500 in your case.

Jure

Hi,

In the next version, we will add functionality that will allow you to add a custom suffix for dwi_dtifit, in your case this suffix would be _b1500 and this would make the command use data, bval and bvec with this suffix.

Jure

We added a new parameter called diffdata with which you can set the input data for DTIFIT, similarly as with bvals and bvecs before. Version that adds this functionality will be released over the next couple of days.

Hi Jure, I tried to run dwi_dtifit using qunex 0.98.4 with the new parameter diffdata and got errors related to the file path. Following the instructions in the command page https://qunex.readthedocs.io/en/latest/api/gmri/dwi_dtifit.html, I used this command:

msi_resources_time=00:10:00; msi_resources_nodes=1; msi_resources_ntaskspernode=1; msi_resources_mem=32000; msi_queue=agsmall; msi_resources_jobname=DTIFIT; \
study_sharedfolder=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02; \
qunex_container dwi_dtifit \
--batchfile=${study_sharedfolder}/processing/batch_K99Aim2.txt --sessionsfolder=${study_sharedfolder}/sessions \
--mask="T1w/Diffusion/nodif_brain_mask" \
--diffdata="/T1w/Diffusion/data_b1500.nii.gz" --bvecs="T1w/Diffusion/data_b1500.bvec" --bvals="T1w/Diffusion/data_b1500.bval" \
--sse --wls --save_tensor --gradnonlin="grad_dev" --overwrite="yes" \
--scheduler=SLURM,time=${msi_resources_time},nodes=${msi_resources_nodes},cpus-per-task=${msi_resources_ntaskspernode},mem=${msi_resources_mem},partition=${msi_queue},jobname=${msi_resources_jobname} \
--bind=${study_sharedfolder}:${study_sharedfolder} --container=${HOME}/qunex/qunex_suite-0.98.4.sif

And the error log for an example session is this:

# Generated by QuNex 0.98.4 on 2023-08-29_14.02.24.045980
#


-- qunex.sh: Specified Command-Line Options - Start --
   Study Folder: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02
   Sessions Folder: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions
   Session: 10001
   Study Log Folder: 
   overwrite prior run: yes
   bvecs: T1w/Diffusion/data_b1500.bvec
   bvals: T1w/Diffusion/data_b1500.bval
   diffdata: /T1w/Diffusion/data_b1500.nii.gz
   sse: yes
   wls: yes
   save_tensor: yes
   gradnonlin: grad_dev
-- qunex.sh: Specified Command-Line Options - End --

e[32m ------------------------- Start of work -------------------------------- e[0m


e[31m Removing existing dtifit run for 10001... e[0m

Running command:

e[32m dtifit --data=/T1w/Diffusion/data_b1500.nii.gz --out=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/dti --mask=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/nodif_brain_mask --bvecs=T1w/Diffusion/data_b1500.bvec --bvals=T1w/Diffusion/data_b1500.bval --sse --wls --save_tensor --gradnonlin='grad_dev' e[0m
Could not open matrix file T1w/Diffusion/data_b1500.bvec
Could not open matrix file T1w/Diffusion/data_b1500.bval
Image Exception : #63 :: No image files match: /T1w/Diffusion/data_b1500
Image Exception : #22 :: Failed to read volume /T1w/Diffusion/data_b1500.nii.gz
Error : No image files match: /T1w/Diffusion/data_b1500
terminate called after throwing an instance of 'std::runtime_error'
  what():  Failed to read volume /T1w/Diffusion/data_b1500.nii.gz
Error : No image files match: /T1w/Diffusion/data_b1500
/opt/fsl/fsl/share/fsl/bin/dtifit: line 2: 3456670 Aborted                 /opt/fsl/fsl-6.0.7.1/bin/dtifit "$@"
e[31m --- Checking outputs... e[0m


e[31m  -- dtifit run not found or incomplete for 10001. Something went wrong. e[0m
e[31m     Check output: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion e[0m

e[31m ERROR: dtifit run did not complete successfully e[0m

So it seems that qunex_container can resolve the full path for the mask file from the parameter entered --mask="T1w/Diffusion/nodif_brain_mask", but this is not true for the data, bvec and bval files using similar parameter values. Since I’m running multiple sessions with a single command, using an absolute path for each of these files would not work. Do you have any suggestions on how to handle this?

Thank you.

Estephan

Update: I ran the dwi_dtifit command through a loop over all sessions using absolute paths, and got into another error related to grad_dev file.

Command:

subjID_list="10001 10002 10004 10005 10006 10007 10009 10011 10012 10013 10014 10015 10016 10018 10019 10021 10022 10023 10024 10030 10031 10033 10034 10035 10036 10037 10038 10039 10041 10042 11004 11006 11009 11012 11015 20001 20002 20004 20005 20006 20008 20010 20011 20012 20013 20015 20016 20017 20018 20019 20021 20022"; \
for subjID in ${subjID_list}; do \
msi_resources_time=00:10:00; msi_resources_nodes=1; msi_resources_ntaskspernode=1; msi_resources_mem=32000; msi_queue=agsmall; msi_resources_jobname=DTIFIT; \
study_sharedfolder=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02; diff_dirpath="${study_sharedfolder}/sessions/${subjID}/hcp/${subjID}/T1w/Diffusion"; \
qunex_container dwi_dtifit \
--batchfile=${study_sharedfolder}/processing/batch_K99Aim2.txt --sessionsfolder=${study_sharedfolder}/sessions --sessions=${subjID} \
--mask="T1w/Diffusion/nodif_brain_mask" \
--diffdata="${diff_dirpath}/data_b1500.nii.gz" --bvecs="${diff_dirpath}/data_b1500.bvec" --bvals="${diff_dirpath}/data_b1500.bval" \
--sse --wls --save_tensor --gradnonlin="${diff_dirpath}/grad_dev.nii.gz" --overwrite="yes" \
--scheduler=SLURM,time=${msi_resources_time},nodes=${msi_resources_nodes},cpus-per-task=${msi_resources_ntaskspernode},mem=${msi_resources_mem},partition=${msi_queue},jobname=${msi_resources_jobname} \
--bind=${study_sharedfolder}:${study_sharedfolder} --container=${HOME}/qunex/qunex_suite-0.98.4.sif; \
sleep 2; done

Example error log:

# Generated by QuNex 0.98.4 on 2023-08-29_15.52.01.713824
#


-- qunex.sh: Specified Command-Line Options - Start --
   Study Folder: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02
   Sessions Folder: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions
   Session: 10001
   Study Log Folder: 
   overwrite prior run: yes
   bvecs: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bvec
   bvals: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bval
   diffdata: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.nii.gz
   sse: yes
   wls: yes
   save_tensor: yes
   gradnonlin: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz
-- qunex.sh: Specified Command-Line Options - End --

e[32m ------------------------- Start of work -------------------------------- e[0m


e[31m Removing existing dtifit run for 10001... e[0m

Running command:

e[32m dtifit --data=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.nii.gz --out=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/dti --mask=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/nodif_brain_mask --bvecs=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bvec --bvals=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bval --sse --wls --save_tensor --gradnonlin='/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz' e[0m
Image Exception : #63 :: No image files match: '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
Image Exception : #22 :: Failed to read volume '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
Error : No image files match: '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
terminate called after throwing an instance of 'std::runtime_error'
  what():  Failed to read volume '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
Error : No image files match: '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
/opt/fsl/fsl/share/fsl/bin/dtifit: line 2: 2986595 Aborted                 /opt/fsl/fsl-6.0.7.1/bin/dtifit "$@"
e[31m --- Checking outputs... e[0m


e[31m  -- dtifit run not found or incomplete for 10001. Something went wrong. e[0m
e[31m     Check output: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion e[0m

e[31m ERROR: dtifit run did not complete successfully e[0m

The grad_dev file for each session has the correct full path, however for some reason qunex is not liking it.

acn67:~ moana004$ ls /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz
/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz

Finally, using the dtifit command copied from the error log above outside the qunex container runs without problems:

acn67:~ moana004$ dtifit --data=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.nii.gz --out=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/dti --mask=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/nodif_brain_mask --bvecs=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bvec --bvals=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bval --sse --wls --save_tensor --gradnonlin='/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
0 121 0 145 0 121
0 slices processed
1 slices processed
2 slices processed
3 slices processed
4 slices processed
5 slices processed
6 slices processed
7 slices processed
8 slices processed
9 slices processed
10 slices processed
...

HI,

In the first issue, you are providing different paths:

bvecs: T1w/Diffusion/data_b1500.bvec
bvals: T1w/Diffusion/data_b1500.bval
diffdata: /T1w/Diffusion/data_b1500.nii.gz

Notice the slash at the beginning of diffdata. This probably makes the script look for /T1w/... in the root of your system. In my experience it is always best to provide full and absolute paths, especially so when you are going into the container as you also have bindings to take care of.

I am unable to reproduce the second issue, it seems like the file does not exist there (when in the container) or there are some kind of permission issues once inside the container. You can test what is going on by entering the container manually and inspecting everything:

# 1. enter the container
study_sharedfolder="/home/moanae/shared/project_K99_ChrTMDHCP_qunex02"

singularity shell -B ${study_sharedfolder}:${study_sharedfolder} ${HOME}/qunex/qunex_suite-0.98.4.sif

# 2. source QuNex
source /opt/qunex/env/qunex_environment.sh

# 3. inspect (we need to set the vars again as we are now inside the container)
study_sharedfolder="/home/moanae/shared/project_K99_ChrTMDHCP_qunex02"
subjID=10001
diff_dirpath="${study_sharedfolder}/sessions/${subjID}/hcp/${subjID}/T1w/Diffusion"

ls -l ${diff_dirpath}
ls -l ${diff_dirpath}/grad_dev.nii.gz

Let me know what this does.

Thanks Jure. I tested what you suggested. What I found was:

  1. the file seems to be visible once inside the container.
acn96:~ moana004$ study_sharedfolder="/home/moanae/shared/project_K99_ChrTMDHCP_qunex02"; singularity shell -B ${study_sharedfolder}:${study_sharedfolder} ${HOME}/qunex/qunex_suite-0.98.4.sif
Apptainer> source /opt/qunex/env/qunex_environment.sh
--> unsetting the following environment variables: PATH MATLABPATH PYTHONPATH QUNEXVer TOOLS QUNEXREPO QUNEXPATH QUNEXEXTENSIONS QUNEXLIBRARY QUNEXLIBRARYETC TemplateFolder FSL_FIXDIR FREESURFERDIR FREESURFER_HOME FREESURFER_SCHEDULER FreeSurferSchedulerDIR WORKBENCHDIR DCMNIIDIR DICMNIIDIR MATLABDIR MATLABBINDIR OCTAVEDIR OCTAVEPKGDIR OCTAVEBINDIR RDIR HCPWBDIR AFNIDIR PYLIBDIR FSLDIR FSLBINDIR PALMDIR QUNEXMCOMMAND HCPPIPEDIR CARET7DIR GRADUNWARPDIR HCPPIPEDIR_Templates HCPPIPEDIR_Bin HCPPIPEDIR_Config HCPPIPEDIR_PreFS HCPPIPEDIR_FS HCPPIPEDIR_PostFS HCPPIPEDIR_fMRISurf HCPPIPEDIR_fMRIVol HCPPIPEDIR_tfMRI HCPPIPEDIR_dMRI HCPPIPEDIR_dMRITract HCPPIPEDIR_Global HCPPIPEDIR_tfMRIAnalysis HCPCIFTIRWDIR MSMBin HCPPIPEDIR_dMRITractFull HCPPIPEDIR_dMRILegacy AutoPtxFolder EDDYCUDA USEOCTAVE QUNEXENV CONDADIR MSMBINDIR MSMCONFIGDIR R_LIBS FSL_FIX_CIFTIRW FSFAST_HOME SUBJECTS_DIR MINC_BIN_DIR MNI_DIR MINC_LIB_DIR MNI_DATAPATH FSF_OUTPUT_FORMAT ANTSDIR
 
Generated by QuNex 
------------------------------------------------------------------------ 
Version: 0.98.4 
User: moana004 
System: acn96 
OS: RedHat Linux #1 SMP Tue Jun 20 11:48:01 UTC 2023 
------------------------------------------------------------------------ 
 
        ██████\                  ║      ██\   ██\                        
       ██  __██\                 ║      ███\  ██ |                       
       ██ /  ██ |██\   ██\       ║      ████\ ██ | ██████\ ██\   ██\     
       ██ |  ██ |██ |  ██ |      ║      ██ ██\██ |██  __██\\██\ ██  | 
       ██ |  ██ |██ |  ██ |      ║      ██ \████ |████████ |\████  /     
       ██ ██\██ |██ |  ██ |      ║      ██ |\███ |██   ____|██  ██\      
       \██████ / \██████  |      ║      ██ | \██ |\███████\██  /\██\     
        \___███\  \______/       ║      \__|  \__| \_______\__/  \__|    
            \___|                ║                                       
 
 
                       DEVELOPED & MAINTAINED BY: 
 
                    Anticevic Lab, Yale University 
               Mind & Brain Lab, University of Ljubljana 
                     Murray Lab, Yale University 
 
                      COPYRIGHT & LICENSE NOTICE: 
 
Use of this software is subject to the terms and conditions defined in 
'LICENSES' which is a part of the QuNex Suite source code package: 
https://gitlab.qunex.yale.edu/qunex/qunex/-/tree/master/LICENSES 
 
 ---> Setting up Octave  

(qunex) [acn96 ~]$ study_sharedfolder="/home/moanae/shared/project_K99_ChrTMDHCP_qunex02"
(qunex) [acn96 ~]$ subjID=10001
(qunex) [acn96 ~]$ diff_dirpath="${study_sharedfolder}/sessions/${subjID}/hcp/${subjID}/T1w/Diffusion"
(qunex) [acn96 ~]$ ls -l ${diff_dirpath}
total 1071836
-rw-rw-r--. 1 moana004 moanae       953 May  1 20:34 bvals
-rw-rw-r--. 1 moana004 moanae      6570 May  1 20:34 bvecs
-rw-------. 1 moana004 moanae       494 Aug 29 13:03 data_b1500.bval
-rw-------. 1 moana004 moanae      3000 Aug 29 13:03 data_b1500.bvec
-rw-------. 1 moana004 moanae 304769183 Aug 29 13:03 data_b1500.nii.gz
-rw-rw-r--. 1 moana004 moanae 566474928 May  1 20:46 data.nii.gz
drwxrwsr-x. 2 moana004 moanae      4096 May  1 20:46 eddylogs
-rw-rw-r--. 1 moana004 moanae     12868 May  1 20:45 fov_mask.nii.gz
-rw-rw-r--. 1 moana004 moanae  26155510 May  1 20:45 grad_dev.nii.gz
-rw-rw-r--. 1 moana004 moanae     38695 May  1 20:46 nodif_brain_mask.nii.gz
-rw-rw-r--. 1 moana004 moanae        67 May  1 20:46 nodif_brain_mask.stats.txt
drwxrwsr-x. 2 moana004 moanae      4096 May  2 15:41 QC
(qunex) [acn96 ~]$ ls -l ${diff_dirpath}/grad_dev.nii.gz
-rw-rw-r--. 1 moana004 moanae 26155510 May  1 20:45 /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz
  1. Even without the slash in the beginning of diffdata I got the same error.
# Generated by QuNex 0.98.4 on 2023-08-30_13.48.19.156169
#


-- qunex.sh: Specified Command-Line Options - Start --
   Study Folder: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02
   Sessions Folder: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions
   Session: 10001
   Study Log Folder: 
   overwrite prior run: yes
   bvecs: T1w/Diffusion/data_b1500.bvec
   bvals: T1w/Diffusion/data_b1500.bval
   diffdata: T1w/Diffusion/data_b1500.nii.gz
   sse: yes
   wls: yes
   save_tensor: yes
   gradnonlin: T1w/Diffusion/grad_dev.nii.gz
-- qunex.sh: Specified Command-Line Options - End --

e[32m ------------------------- Start of work -------------------------------- e[0m


e[31m Removing existing dtifit run for 10001... e[0m

Running command:

e[32m dtifit --data=T1w/Diffusion/data_b1500.nii.gz --out=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/dti --mask=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/nodif_brain_mask --bvecs=T1w/Diffusion/data_b1500.bvec --bvals=T1w/Diffusion/data_b1500.bval --sse --wls --save_tensor --gradnonlin='T1w/Diffusion/grad_dev.nii.gz' e[0m
Could not open matrix file T1w/Diffusion/data_b1500.bvec
Could not open matrix file T1w/Diffusion/data_b1500.bval
Image Exception : #63 :: No image files match: T1w/Diffusion/data_b1500
Image Exception : #22 :: Failed to read volume T1w/Diffusion/data_b1500.nii.gz
Error : No image files match: T1w/Diffusion/data_b1500
terminate called after throwing an instance of 'std::runtime_error'
  what():  Failed to read volume T1w/Diffusion/data_b1500.nii.gz
Error : No image files match: T1w/Diffusion/data_b1500
/opt/fsl/fsl/share/fsl/bin/dtifit: line 2: 206413 Aborted                 /opt/fsl/fsl-6.0.7.1/bin/dtifit "$@"
e[31m --- Checking outputs... e[0m


e[31m  -- dtifit run not found or incomplete for 10001. Something went wrong. e[0m
e[31m     Check output: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion e[0m

e[31m ERROR: dtifit run did not complete successfully e[0m

  1. Using absolute paths solves the problem for the data, bvec and bval files but causes the problem with grad_dev file.
# Generated by QuNex 0.98.4 on 2023-08-30_13.54.16.431337
#


-- qunex.sh: Specified Command-Line Options - Start --
   Study Folder: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02
   Sessions Folder: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions
   Session: 10001
   Study Log Folder: 
   overwrite prior run: yes
   bvecs: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bvec
   bvals: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bval
   diffdata: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.nii.gz
   sse: yes
   wls: yes
   save_tensor: yes
   gradnonlin: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz
-- qunex.sh: Specified Command-Line Options - End --

e[32m ------------------------- Start of work -------------------------------- e[0m


e[31m Removing existing dtifit run for 10001... e[0m

Running command:

e[32m dtifit --data=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.nii.gz --out=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/dti --mask=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/nodif_brain_mask --bvecs=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bvec --bvals=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bval --sse --wls --save_tensor --gradnonlin='/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz' e[0m
Image Exception : #63 :: No image files match: '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
Image Exception : #22 :: Failed to read volume '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
Error : No image files match: '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
terminate called after throwing an instance of 'std::runtime_error'
  what():  Failed to read volume '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
Error : No image files match: '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
/opt/fsl/fsl/share/fsl/bin/dtifit: line 2: 217332 Aborted                 /opt/fsl/fsl-6.0.7.1/bin/dtifit "$@"
e[31m --- Checking outputs... e[0m


e[31m  -- dtifit run not found or incomplete for 10001. Something went wrong. e[0m
e[31m     Check output: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion e[0m

e[31m ERROR: dtifit run did not complete successfully e[0m

Interestingly, running the command within the container reproduced the error with grad_dev.nii.gz even though the file is available.

(qunex) [acn96 ~]$ subjID_list="10001"; \
> for subjID in ${subjID_list}; do \
> study_sharedfolder=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02; diff_dirpath="${study_sharedfolder}/sessions/${subjID}/hcp/${subjID}/T1w/Diffusion"; \
> /opt/qunex/bash/qx_utilities/dwi_dtifit.sh \
> --batchfile=${study_sharedfolder}/processing/batch_K99Aim2.txt --sessionsfolder=${study_sharedfolder}/sessions --session=${subjID} \
> --mask="${diff_dirpath}/nodif_brain_mask.nii.gz" \
> --diffdata="${diff_dirpath}/data_b1500.nii.gz" --bvecs="${diff_dirpath}/data_b1500.bvec" --bvals="${diff_dirpath}/data_b1500.bval" \
> --sse --wls --save_tensor --gradnonlin="${diff_dirpath}/grad_dev.nii.gz" --overwrite="yes"; \
> done


-- dwi_dtifit.sh: Specified Command-Line Options - Start --
   Study Folder: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02
   Sessions Folder: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions
   Session: 10001
   Study Log Folder: 
   overwrite prior run: yes
   mask: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/nodif_brain_mask.nii.gz
   bvecs: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bvec
   bvals: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bval
   diffdata: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.nii.gz
   sse: yes
   wls: yes
   save_tensor: yes
   gradnonlin: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz
-- dwi_dtifit.sh: Specified Command-Line Options - End --

 ------------------------- Start of work -------------------------------- 


 Removing existing dtifit run for 10001... 

Running command:

 dtifit --data=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.nii.gz --out=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/dti --mask=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/nodif_brain_mask.nii.gz --bvecs=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bvec --bvals=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/data_b1500.bval --sse --wls --save_tensor --gradnonlin='/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz' 
Image Exception : #63 :: No image files match: '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
Image Exception : #22 :: Failed to read volume '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
Error : No image files match: '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
terminate called after throwing an instance of 'std::runtime_error'
  what():  Failed to read volume '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
Error : No image files match: '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
/opt/fsl/fsl/share/fsl/bin/dtifit: line 2: 1870969 Aborted                 /opt/fsl/fsl-6.0.7.1/bin/dtifit "$@"
 --- Checking outputs... 


  -- dtifit run not found or incomplete for 10001. Something went wrong. 
     Check output: /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion 

 ERROR: dtifit run did not complete successfully 

(qunex) [acn96 ~]$ ls -l '/home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz'
-rw-rw-r--. 1 moana004 moanae 26155510 May  1 20:45 /home/moanae/shared/project_K99_ChrTMDHCP_qunex02/sessions/10001/hcp/10001/T1w/Diffusion/grad_dev.nii.gz

What if you set 775 permissions to all files within ${study_sharedfolder}/sessions/${subjID}/hcp/${subjID}/T1w/Diffusion and execute the command after that?

chmod 775 ${study_sharedfolder}/sessions/${subjID}/hcp/${subjID}/T1w/Diffusion/*

It is funny that copy pasting the dtifit command works, but only outside of the container … The QuNex call to dtifit looks fine and from that point on it is simply the execution of the prepared dtifit command.

I made some changes on our end to make this more robust, e.g. if you will provide just --gradnonlin=grad_dev.nii.gz it will automatically look for it in the Diffusion folder as well. This will be released soon as we are preparing a new version already due to some bug fixes.

What if you provide the problematic parameter without .nii.gz not sure what FSL’s dtifit is looking for here exactly. But I am grasping at straws here as it finds the file outside of the container for some reason.

Sounds good. I’ll see what I can find by tinkering with it. Thank you.

Updates: tried the new qunex version 0.98.6.

Using absolute paths with a loop to call qunex for each participant completed successfully, so whatever changes were done from the 0.98.4 version worked.

Command

subjID_list="10001"; \
for subjID in ${subjID_list}; do \
msi_resources_time=00:10:00; msi_resources_nodes=1; msi_resources_ntaskspernode=1; msi_resources_mem=32000; msi_queue=agsmall; msi_resources_jobname=DTIFIT; \
study_sharedfolder=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02; diff_dirpath="${study_sharedfolder}/sessions/${subjID}/hcp/${subjID}/T1w/Diffusion"; \
qunex_container dwi_dtifit \
--batchfile=${study_sharedfolder}/processing/batch_K99Aim2.txt --sessionsfolder=${study_sharedfolder}/sessions --sessions=${subjID} \
--mask="T1w/Diffusion/nodif_brain_mask" \
--diffdata="${diff_dirpath}/data_b1500.nii.gz" --bvecs="${diff_dirpath}/data_b1500.bvec" --bvals="${diff_dirpath}/data_b1500.bval" \
--sse --wls --save_tensor --gradnonlin="${diff_dirpath}/grad_dev.nii.gz" --overwrite="yes" \
--scheduler=SLURM,time=${msi_resources_time},nodes=${msi_resources_nodes},cpus-per-task=${msi_resources_ntaskspernode},mem=${msi_resources_mem},partition=${msi_queue},jobname=${msi_resources_jobname} \
--bind=${study_sharedfolder}:${study_sharedfolder} --container=${HOME}/qunex/qunex_suite-0.98.6.sif; \
sleep 2; done

done_dwi_dtifit_10001_2023-08-31_10.15.20.538630.log (4.6 KB)

When using relative paths, qunex seems to be able to resolve the file paths correctly but it still spits out errors about not being able to open them. I noticed that the file paths for diffdata, bval, and bvec have an extra T1w/Diffusion/ which is causing the error.

Command:

msi_resources_time=00:10:00; msi_resources_nodes=1; msi_resources_ntaskspernode=1; msi_resources_mem=32000; msi_queue=agsmall; msi_resources_jobname=DTIFIT; \
study_sharedfolder=/home/moanae/shared/project_K99_ChrTMDHCP_qunex02; \
qunex_container dwi_dtifit \
--batchfile=${study_sharedfolder}/processing/batch_K99Aim2.txt --sessionsfolder=${study_sharedfolder}/sessions --sessions="10001" \
--mask="T1w/Diffusion/nodif_brain_mask.nii.gz" \
--diffdata="T1w/Diffusion/data_b1500.nii.gz" --bvecs="T1w/Diffusion/data_b1500.bvec" --bvals="T1w/Diffusion/data_b1500.bval" \
--sse --wls --save_tensor --gradnonlin="T1w/Diffusion/grad_dev.nii.gz" --overwrite="yes" \
--scheduler=SLURM,time=${msi_resources_time},nodes=${msi_resources_nodes},cpus-per-task=${msi_resources_ntaskspernode},mem=${msi_resources_mem},partition=${msi_queue},jobname=${msi_resources_jobname} \
--bind=${study_sharedfolder}:${study_sharedfolder} --container=${HOME}/qunex/qunex_suite-0.98.6.sif

error_dwi_dtifit_10001_2023-08-31_10.37.28.010056.log (3.6 KB)

So for my purposes I’m good to proceed with dwi_dtifit using absolute paths, but I thought that this information might be helpful for debugging purposes. Thanks for your help.

Estephan

Glad it is working for absolute/complete paths now, I will mark this as resolved.

When using non-full paths, you can just provide the filename, e.g. --mask="nodif_brain_mask.nii.gz" and QuNex will look for this automatically in the T1w/Diffusion folder.

Jure