Skip to content
Prev Previous commit
Next Next commit
specified positions, requires for gradient exports
  • Loading branch information
axiezai committed Nov 30, 2020
commit fb3f6194bac36bebf1440c373622f2c60bb41af7
47 changes: 33 additions & 14 deletions nipype/interfaces/mrtrix3/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,13 @@ def _format_arg(self, name, trait_spec, value):

class DWIPreprocInputSpec(MRTrix3BaseInputSpec):
in_file = File(
exists=True, argstr="%s", position=-5, mandatory=True, desc="input DWI image"
exists=True, argstr="%s", position=-6, mandatory=True, desc="input DWI image"
)
out_file = File(
"preproc.mif",
argstr="%s",
mandatory=True,
position=-4,
position=-5,
usedefault=True,
desc="output file after preprocessing",
)
Expand All @@ -261,68 +261,86 @@ class DWIPreprocInputSpec(MRTrix3BaseInputSpec):
"-rpe_all",
"-rpe_header",
argstr="%s",
position=-3,
position=-4,
mandatory=True,
desc="Specify acquisition phase-encoding design, one of the -rpe_* options must be provided",
)
pe_dir = traits.Str(
argstr="-pe_dir %s",
position=-2,
position=-3,
mandatory=True,
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(
argstr="-readout_time %f",
position=-1,
position=-2,
desc="Total readout time of input series (in seconds)",
)
in_epi = File(
exists=True,
argstr="-se_epi %s",
position=-1,
desc="Provide an additional image series consisting of spin-echo EPI images, which is to be used exclusively by topup for estimating the inhomogeneity field (i.e. it will not form part of the output image series)",
)
align_seepi = traits.Bool(
argstr="-align_seepi",
position=0,
desc="Achieve alignment between the SE-EPI images used for inhomogeneity field estimation, and the DWIs",
)
eddy_options = traits.Str(
argstr="-eddy_options %s",
position=1,
desc="-eddy_options ” EddyOptions” Manually provide additional command-line options to the eddy command (provide a string within quotation marks that contains at least one space, even if only passing a single command-line option to eddy)",
)
topup_options = traits.Str(
argstr="-topup_options %s",
position=1,
desc="-topup_options ” TopupOptions” Manually provide additional command-line options to the topup command (provide a string within quotation marks that contains at least one space, even if only passing a single command-line option to topup)",
)
export_grad_mrtrix = traits.Bool(
argstr="-export_grad_mrtrix", desc="export new gradientt files in mrtrix format"
argstr="-export_grad_mrtrix",
position=2,
desc="export new gradientt files in mrtrix format",
)
export_grad_fsl = traits.Bool(
argstr="-export_grad_fsl", desc="export gradient files in FSL format"
argstr="-export_grad_fsl",
position=2,
desc="export gradient files in FSL format",
)
out_grad_mrtrix = File(
"dwi.b", argstr="%s", usedefault=True, desc="name of new gradient file"
"grad.b",
argstr="%s",
usedefault=True,
position=3,
requires=["export_grad_mrtrix"],
desc="name of new gradient file",
)
out_grad_fsl = traits.Tuple(
File("dwi.bvecs", usedefault=True, desc="bvecs"),
File("dwi.bvals", usedefault=True, desc="bvals"),
File("grad.bvecs", usedefault=True, desc="bvecs"),
File("grad.bvals", usedefault=True, desc="bvals"),
argstr="%s, %s",
position=3,
requires=["export_grad_fsl"],
desc="Output (bvecs, bvals) gradients FSL format",
)


class DWIPreprocOutputSpec(TraitedSpec):
out_file = File(argstr="%s", desc="output preprocessed image series")
out_grad_mrtrix = File(
argstr="%s", desc="preprocessed gradient file in mrtrix3 format"
"grad.b",
argstr="%s",
usedefault=True,
desc="preprocessed gradient file in mrtrix3 format",
)
out_fsl_bvec = File(
"dwi.bvecs",
"grad.bvecs",
argstr="%s",
usedefault=True,
desc="exported fsl gradient bvec file",
)
out_fsl_bval = File(
"dwi.bvals",
"grad.bvals",
argstr="%s",
usedefault=True,
desc="exported fsl gradient bval file",
Expand All @@ -344,7 +362,8 @@ class DWIPreproc(MRTrix3Base):
>>> preproc.inputs.in_file = 'dwi.mif'
>>> preproc.inputs.rpe_options = '-rpe_none'
>>> preproc.inputs.out_file = "preproc.mif"
>>> preproc.inputs.grad_file = "dwi.b"
>>> preproc.inputs.eddy_options = '"--slm=linear --repol"'
>>> preproc.inputs.export_grad_mrtrix = True # export final gradient table in MRtrix format
>>> preproc.inputs.ro_time = 0.165240 # 'TotalReadoutTime' in BIDS JSON metadata files
>>> preproc.inputs.pe_dir = 'j' # 'PhaseEncodingDirection' in BIDS JSON metadata files
>>> preproc.cmdline
Expand Down