8000 ENH: Add inputs to mrtrix3.DWIPreprocInputSpec and remove mandatory annotation for pe_dir by GalKepler · Pull Request #3470 · nipy/nipype · GitHub
[go: up one dir, main page]

Skip to content

ENH: Add inputs to mrtrix3.DWIPreprocInputSpec and remove mandatory annotation for pe_dir #3470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 23, 2022
Next Next commit
fixed some bugs in the interface to dwifslpreproc
  • Loading branch information
GalKepler committed May 11, 2022
commit 735c712c246323288adb3eb91e081c5a50589bbe
110 changes: 87 additions & 23 deletions nipype/interfaces/mrtrix3/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,26 @@
import os.path as op

from ..base import (
CommandLineInputSpec,
CommandLine,
traits,
TraitedSpec,
CommandLineInputSpec,
Directory,
File,
isdefined,
Undefined,
InputMultiObject,
TraitedSpec,
Undefined,
isdefined,
traits,
)
from .base import MRTrix3BaseInputSpec, MRTrix3Base
from .base import MRTrix3Base, MRTrix3BaseInputSpec


class DWIDenoiseInputSpec(MRTrix3BaseInputSpec):
in_file = File(
exists=True, argstr="%s", position=-2, mandatory=True, desc="input DWI image"
exists=True,
argstr="%s",
position=-2,
mandatory=True,
desc="input DWI image",
)
mask = File(exists=True, argstr="-mask %s", position=1, desc="mask image")
extent = traits.Tuple(
Expand Down Expand Up @@ -88,7 +93,11 @@ class DWIDenoise(MRTrix3Base):

class MRDeGibbsInputSpec(MRTrix3BaseInputSpec):
in_file = File(
exists=True, argstr="%s", position=-2, mandatory=True, desc="input DWI image"
exists=True,
argstr="%s",
position=-2,
mandatory=True,
desc="input DWI image",
)
axes = traits.ListInt(
default_value=[0, 1],
Expand Down Expand Up @@ -177,9 +186,15 @@ class MRDeGibbs(MRTrix3Base):

class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec):
in_file = File(
exists=True, argstr="%s", position=-2, mandatory=True, desc="input DWI image"
exists=True,
argstr="%s",
position=-2,
mandatory=True,
desc="input DWI image",
)
in_mask = File(
argstr="-mask %s", desc="input mask image for bias field estimation"
)
in_mask = File(argstr="-mask %s", desc="input mask image for bias field estimation")
use_ants = traits.Bool(
argstr="ants",
mandatory=True,
Expand Down Expand Up @@ -245,7 +260,11 @@ def _format_arg(self, name, trait_spec, value):

class DWIPreprocInputSpec(MRTrix3BaseInputSpec):
in_file = File(
exists=True, argstr="%s", position=0, mandatory=True, desc="input DWI image"
exists=True,
argstr="%s",
position=0,
mandatory=True,
desc="input DWI image",
)
out_file = File(
"preproc.mif",
Expand All @@ -267,7 +286,7 @@ class DWIPreprocInputSpec(MRTrix3BaseInputSpec):
)
pe_dir = traits.Str(
argstr="-pe_dir %s",
mandatory=True,
mandatory=False,
desc="Specify the phase encoding direction of the input series, can be a signed axis number (e.g. -0, 1, +2), an axis designator (e.g. RL, PA, IS), or NIfTI axis codes (e.g. i-, j, k)",
)
ro_time = traits.Float(
Expand All @@ -283,16 +302,42 @@ class DWIPreprocInputSpec(MRTrix3BaseInputSpec):
argstr="-align_seepi",
desc="Achieve alignment between the SE-EPI images used for inhomogeneity field estimation, and the DWIs",
)
eddy_options = traits.Str(
argstr='-eddy_options "%s"',
desc="Manually provide additional command-line options to the eddy command",
json_import = File(
exists=True,
argstr="-json_import %s",
desc="Import image header information from an associated JSON file (may be necessary to determine phase encoding information)",
)
topup_options = traits.Str(
argstr='-topup_options "%s"',
desc="Manually provide additional command-line options to the topup command",
)
eddy_options = traits.Str(
argstr='-eddy_options "%s"',
desc="Manually provide additional command-line options to the eddy command",
)
eddy_mask = File(
exists=True,
argstr="-eddy_mask %s",
desc="Provide a processing mask to use for eddy, instead of having dwifslpreproc generate one internally using dwi2mask",
)
eddy_slspec = File(
exists=True,
argstr="-eddy_slspec %s",
desc="Provide a file containing slice groupings for eddy's slice-to-volume registration",
)
eddyqc_text = Directory(
exists=False,
argstr="-eddyqc_text %s",
desc="Copy the various text-based statistical outputs generated by eddy, and the output of eddy_qc (if installed), into an output directory",
)
eddyqc_all = Directory(
exists=False,
argstr="-eddyqc_all %s",
desc="Copy ALL outputs generated by eddy (including images), and the output of eddy_qc (if installed), into an output directory",
)
export_grad_mrtrix = traits.Bool(
argstr="-export_grad_mrtrix", desc="export new gradient files in mrtrix format"
argstr="-export_grad_mrtrix",
desc="export new gradient files in mrtrix format",
)
export_grad_fsl = traits.Bool(
argstr="-export_grad_fsl", desc="export gradient files in FSL format"
Expand Down Expand Up @@ -367,7 +412,9 @@ def _list_outputs(self):
outputs = self.output_spec().get()
outputs["out_file"] = op.abspath(self.inputs.out_file)
if self.inputs.export_grad_mrtrix:
outputs["out_grad_mrtrix"] = op.abspath(self.inputs.out_grad_mrtrix)
outputs["out_grad_mrtrix"] = op.abspath(
self.inputs.out_grad_mrtrix
)
if self.inputs.export_grad_fsl:
outputs["out_fsl_bvec"] = op.abspath(self.inputs.out_grad_fsl[0])
outputs["out_fsl_bval"] = op.abspath(self.inputs.out_grad_fsl[1])
Expand All @@ -387,7 +434,11 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec):
desc="response estimation algorithm (multi-tissue)",
)
in_file = File(
exists=True, argstr="%s", position=-5, mandatory=True, desc="input DWI image"
exists=True,
argstr="%s",
position=-5,
mandatory=True,
desc="input DWI image",
)
mtt_file = File(argstr="%s", position=-4, desc="input 5tt image")
wm_file = File(
Expand All @@ -397,9 +448,15 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec):
usedefault=True,
desc="output WM response text file",
)
gm_file = File(argstr="%s", position=-2, desc="output GM response text file")
8000 csf_file = File(argstr="%s", position=-1, desc="output CSF response text file")
in_mask = File(exists=True, argstr="-mask %s", desc="provide initial mask image")
gm_file = File(
argstr="%s", position=-2, desc="output GM response text file"
)
csf_file = File(
argstr="%s", position=-1, desc="output CSF response text file"
)
in_mask = File(
exists=True, argstr="-mask %s", desc="provide initial mask image"
)
max_sh = InputMultiObject(
traits.Int,
argstr="-lmax %s",
Expand Down Expand Up @@ -511,10 +568,17 @@ class ReplaceFSwithFIRSTInputSpec(CommandLineInputSpec):
desc="input anatomical image",
)
in_t1w = File(
exists=True, argstr="%s", mandatory=True, position=-3, desc="input T1 image"
exists=True,
argstr="%s",
mandatory=True,
position=-3,
desc="input T1 image",
)
in_config = File(
exists=True, argstr="%s", position=-2, desc="connectome configuration file"
exists=True,
argstr="%s",
position=-2,
desc="connectome configuration file",
)

out_file = File(
Expand Down
0