From 51ec4db715ce54de01e3695a077805eaab43012e Mon Sep 17 00:00:00 2001 From: Jenny Chen Date: Wed, 23 Oct 2024 13:20:25 -0400 Subject: [PATCH] add eddy_quad after running eddy --- designer2/designer.py | 2 +- docs/docs/designer/usage.md | 9 +++++++++ lib/designer_func_wrappers.py | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/designer2/designer.py b/designer2/designer.py index 2997c59d..c693ad1a 100644 --- a/designer2/designer.py +++ b/designer2/designer.py @@ -95,7 +95,7 @@ def usage(cmdline): #pylint: disable=unused-variable rpe_options.add_argument('-rpe_all', metavar=(''), help='Specify that ALL DWIs have been acquired with opposing phase-encoding; this information will be used to perform a recombination of image volumes (each pair of volumes with the same b-vector but different phase encoding directions will be combined together into a single volume). The argument to this option is the set of volumes with reverse phase encoding but the same b-vectors as the input image') rpe_options.add_argument('-rpe_header', action='store_true', help='Specify that the phase-encoding information can be found in the image header(s), and that this is the information that the script should use') rpe_options.add_argument('-rpe_te', metavar=(''), help='Specify the echo time of the reverse phase encoded image, if it is not accompanied by a bids .json sidecar.') - + rpe_options.add_argument('-eddy_quad_output', metavar=(''), help='path to a not yet existing directory you want to save eddy_quad output to') def execute(): #pylint: disable=unused-variable from mrtrix3 import app, fsl, run, path #pylint: disable=no-name-in-module, import-outside-toplevel diff --git a/docs/docs/designer/usage.md b/docs/docs/designer/usage.md index 2c07b4bc..5debffde 100644 --- a/docs/docs/designer/usage.md +++ b/docs/docs/designer/usage.md @@ -170,6 +170,15 @@ Olesen, J. L., Ianus, A., Østergaard, L., Shemesh, N., & Jespersen, S. N. (2023 - Perform rigid motion correction using ANTs (useful for cases where eddy breaks down). - Runs volume-to-volume registration for each DWI image using a mutual information cost function and b-spline interpolation. +### `-eddy_quad_output ` +- eddy_quad (QC report) will run after -eddy +- Path to a not yet existing folder you want to save eddy_quad output to. +- By default, it will save to the scratch (use `-nocleanup` to save scratch directory) directory (path/to/scratch/eddy_processing/dwi_post_eddy.qc) + +{: .ref } +> Matteo Bastiani, Michiel Cottaar, Sean P. Fitzgibbon, Sana Suri, Fidel Alfaro-Almagro, Stamatios N. +Sotiropoulos, Saad Joabdi and Jesper L.R. Andersson. (2019). Automated quality control for within and between studies diffusion MRI data using a non-parametric framework for movement and distortion correction. Neurolmage 184:801-812. + --- ## Options relating to Gibbs artifact correction diff --git a/lib/designer_func_wrappers.py b/lib/designer_func_wrappers.py index 66d08f29..2a661116 100644 --- a/lib/designer_func_wrappers.py +++ b/lib/designer_func_wrappers.py @@ -903,6 +903,25 @@ def run_eddy(shell_table, dwi_metadata): elif not app.ARGS.rpe_header and not app.ARGS.rpe_all and not app.ARGS.rpe_pair: raise MRtrixError("the eddy option must run alongside -rpe_header, -rpe_all, or -rpe_pair option") + if app.ARGS.eddy_quad_output: + run.command('eddy_quad "%s" -idx "%s" -par "%s" -m "%s" -b "%s" -g "%s" -o "%s"' % + ('eddy_processing/dwi_post_eddy', + 'eddy_processing/eddy_indices.txt', + 'eddy_processing/eddy_config.txt', + 'eddy_processing/eddy_mask.nii', + 'eddy_processing/bvals', + 'eddy_processing/bvecs', + app.ARGS.eddy_quad_output + )) + else: + run.command('eddy_quad "%s" -idx "%s" -par "%s" -m "%s" -b "%s" -g "%s"' % + ('eddy_processing/dwi_post_eddy', + 'eddy_processing/eddy_indices.txt', + 'eddy_processing/eddy_config.txt', + 'eddy_processing/eddy_mask.nii', + 'eddy_processing/bvals', + 'eddy_processing/bvecs' + )) run.command('mrconvert -force -fslgrad working.bvec working.bval dwiec.mif working.mif', show=False) # End timer