Passing max angle and step size to mrtrix tckgen from qsirecon

Summary of what happened:

I would like to run mrtrix_singleshell_ss3t_noACT in neonates, and would like to adjust the reconstruction parameters. I tried different ways to pass the arguments in but was not successful.

Command used (and if a helper script was used, a link to the helper script or the command generated):

export APPTAINERENV_FS_LICENSE=$GROUP_HOME/freesurferlicense.txt
singularity run --containall --writable-tmpfs --cleanenv \
--bind /home/groups/jyeatman/software/howard/ENA50/ENA50_T1w_LPS.nii.gz:/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/data/mni_1mm_t1w_lps_brain_infant.nii.gz \
--bind /home/groups/jyeatman/software/howard/ENA50/ENA50_T2w_LPS.nii.gz:/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/data/mni_1mm_t2w_lps_brain_infant.nii.gz \
--bind /home/groups/jyeatman/software/howard/ENA50/ENA50_T1w_skull_LPS.nii.gz:/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/data/mni_1mm_t1w_lps_infant.nii.gz \
--bind /home/groups/jyeatman/software/howard/ENA50/ENA50_T2w_skull_LPS.nii.gz:/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/data/mni_1mm_t2w_lps_infant.nii.gz \
--bind /home/groups/jyeatman/software/howard/ENA50/ENA50_mask_LPS.nii.gz:/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/data/mni_1mm_t1w_lps_brainmask_infant.nii.gz \
--bind /home/groups/jyeatman/software/howard/mrtrix_singleshell_ss3t_noACT.json:/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/data/pipelines/mrtrix_singleshell_ss3t_noACT.json \
/home/groups/jyeatman/software/singularity_images/qsiprep-0.21.4.sif \
/scratch/groups/jyeatman/howard/DBPFullwT1 \
/scratch/groups/jyeatman/howard/DBPFullwT1/derivatives/ participant --participant-label sub-$SLURM_ARRAY_TASK_ID \
-w /scratch/groups/jyeatman/howard/DBPFullwT1-work/qsiprep-work \
--recon_only \
--recon_input /scratch/groups/jyeatman/howard/DBPFullwT1/derivatives/qsiprep \
--recon_spec mrtrix_singleshell_ss3t_noACT \
--fs-license-file $GROUP_HOME/freesurferlicense.txt \
--nthreads 10 \
--omp-nthreads 8 \
--output-resolution 1 \
--infant \
--skip-odf-reports # to avoid node plot peaks crashes

and the tracking section of my custom json

   {
      "name": "track_ifod2",
      "software": "MRTrix3",
      "action": "tractography",
      "qsirecon_suffix": "MRtrix3_fork-SS3T_act-None",
      "input": "ss3t_csd",
      "parameters": {
        "use_5tt": false,
        "use_sift2": true,
        "tckgen":{
          "algorithm": "iFOD2",
          "select": 1e3, # just to test
          "max_length": 200,
          "min_length": 4,
          "power":0.33,
          "quiet": true,
          "max_angle": 15.0,
          "step_size": 0.2
        },

Version:

qsiprep-0.21.4

Environment (Docker, Singularity / Apptainer, custom installation):

Singularity

Data formatted according to a validatable standard? Please provide the output of the validator:

qsiprep ran successfully before this step, and qsirecon was able to pick up the qsiprep outputs

240507-20:20:59,272 nipype.workflow INFO:
	 found ['/scratch/groups/jyeatman/howard/DBPFullwT1/derivatives/qsiprep/sub-990745/dwi/sub-990745_acq-b700_dir-PA_space-T1w_desc-preproc_dwi.nii.gz'] in /scratch/groups/jyeatman/howard/DBPFullwT1/derivatives/qsiprep
240507-20:20:59,274 nipype.workflow INFO:
	 CHECKING /scratch/groups/jyeatman/howard/DBPFullwT1/derivatives/qsiprep/sub-990745/anat/sub-990745_desc-brain_mask.nii.gz: True
240507-20:20:59,275 nipype.workflow INFO:
	 CHECKING /scratch/groups/jyeatman/howard/DBPFullwT1/derivatives/qsiprep/sub-990745/anat/sub-990745_desc-preproc_T1w.nii.gz: True
240507-20:20:59,275 nipype.workflow INFO:
	 Found usable QSIPrep-preprocessed T1w image and mask.
240507-20:20:59,276 nipype.workflow INFO:
	 CHECKING /scratch/groups/jyeatman/howard/DBPFullwT1/derivatives/qsiprep/sub-990745/anat/sub-990745_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5: True
240507-20:20:59,276 nipype.workflow INFO:
	 CHECKING /scratch/groups/jyeatman/howard/DBPFullwT1/derivatives/qsiprep/sub-990745/anat/sub-990745_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5: True
240507-20:20:59,276 nipype.workflow INFO:
	 Found high-res anatomical data in preprocessed inputs for 990745.
240507-20:20:59,277 nipype.workflow INFO:
	 Anatomical (T1w) available for recon: {'has_qsiprep_5tt_hsvs': False, 'has_freesurfer_5tt_hsvs': False, 'has_freesurfer': False, 'has_qsiprep_t1w': True, 'has_qsiprep_t1w_transforms': True}
[{'bids_dwi_file': '/scratch/groups/jyeatman/howard/DBPFullwT1/derivatives/qsiprep/sub-990745/dwi/sub-990745_acq-b700_dir-PA_space-T1w_desc-preproc_dwi.nii.gz’}]
{'has_qsiprep_5tt_hsvs': False, 'has_freesurfer_5tt_hsvs': False, 'has_freesurfer': False, 'has_qsiprep_t1w': True, 'has_qsiprep_t1w_transforms': True}

Relevant log outputs (up to 20 lines):

Traceback (most recent call last):
  File "/opt/conda/envs/qsiprep/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/conda/envs/qsiprep/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/cli/run.py", line 1330, in build_recon_workflow
    retval["workflow"] = init_qsirecon_wf(
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/workflows/recon/base.py", line 130, in init_qsirecon_wf
    single_subject_wf = init_single_subject_wf(
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/workflows/recon/base.py", line 337, in init_single_subject_wf
    dwi_recon_wfs[dwi_file] = init_dwi_recon_workflow(
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/workflows/recon/build_workflow.py", line 65, in init_dwi_recon_workflow
    new_node = workflow_from_spec(
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/workflows/recon/build_workflow.py", line 220, in workflow_from_spec
    return init_mrtrix_tractography_wf(**kwargs)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/qsiprep/workflows/recon/mrtrix.py", line 546, in init_mrtrix_tractography_wf
    tracking = pe.Node(TckGen(**tracking_params), name="tractography", n_procs=omp_nthreads)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 629, in __init__
    super(CommandLine, self).__init__(**inputs)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/nipype/interfaces/base/core.py", line 202, in __init__
    self.inputs.trait_set(**inputs)
  File "/opt/conda/envs/qsiprep/lib/python3.10/site-packages/traits/has_traits.py", line 1520, in trait_set
    setattr(self, name, value)
traits.trait_errors.TraitError: Cannot set the undefined 'max_angle' attribute of a 'TckGenInputSpec' object.

Screenshots / relevant information:

I tried two alternatives based on what I read from the mrtrix documentation (tckgen — MRtrix 3.0 documentation) and the other json files in the qsirecon options

"angle": 15.0,
"step": 0.2

and

"max_angle": 15.0,
"step_size": 0.2

but both did not work for me.


Thanks @mattcieslak!

qsiprep passes mrtrix parameters through nipype, so I would have to look in nipype/interfaces/mrtrix3/tracking.py for the correct names for the various arguments.

I should be using angle and step_size.