Skip to content

Commit

Permalink
add eddy_quad after running eddy
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenny Chen authored and Jenny Chen committed Oct 23, 2024
1 parent 5e1ff62 commit 51ec4db
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion designer2/designer.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def usage(cmdline): #pylint: disable=unused-variable
rpe_options.add_argument('-rpe_all', metavar=('<reverse PE dwi volume>'), 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=('<echo time (s)>'), 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=('<path>'), 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
Expand Down
9 changes: 9 additions & 0 deletions docs/docs/designer/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <path/to/eddy_quad/output/folder>`
- 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
Expand Down
19 changes: 19 additions & 0 deletions lib/designer_func_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 51ec4db

Please sign in to comment.