Skip to content

Commit 735c712

Browse files
committed
fixed some bugs in the interface to dwifslpreproc
1 parent b410d08 commit 735c712

File tree

1 file changed

+87
-23
lines changed

1 file changed

+87
-23
lines changed

nipype/interfaces/mrtrix3/preprocess.py

Lines changed: 87 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,26 @@
55
import os.path as op
66

77
from ..base import (
8-
CommandLineInputSpec,
98
CommandLine,
10-
traits,
11-
TraitedSpec,
9+
CommandLineInputSpec,
10+
Directory,
1211
File,
13-
isdefined,
14-
Undefined,
1512
InputMultiObject,
13+
TraitedSpec,
14+
Undefined,
15+
isdefined,
16+
traits,
1617
)
17-
from .base import MRTrix3BaseInputSpec, MRTrix3Base
18+
from .base import MRTrix3Base, MRTrix3BaseInputSpec
1819

1920

2021
class DWIDenoiseInputSpec(MRTrix3BaseInputSpec):
2122
in_file = File(
22-
exists=True, argstr="%s", position=-2, mandatory=True, desc="input DWI image"
23+
exists=True,
24+
argstr="%s",
25+
position=-2,
26+
mandatory=True,
27+
desc="input DWI image",
2328
)
2429
mask = File(exists=True, argstr="-mask %s", position=1, desc="mask image")
2530
extent = traits.Tuple(
@@ -88,7 +93,11 @@ class DWIDenoise(MRTrix3Base):
8893

8994
class MRDeGibbsInputSpec(MRTrix3BaseInputSpec):
9095
in_file = File(
91-
exists=True, argstr="%s", position=-2, mandatory=True, desc="input DWI image"
96+
exists=True,
97+
argstr="%s",
98+
position=-2,
99+
mandatory=True,
100+
desc="input DWI image",
92101
)
93102
axes = traits.ListInt(
94103
default_value=[0, 1],
@@ -177,9 +186,15 @@ class MRDeGibbs(MRTrix3Base):
177186

178187
class DWIBiasCorrectInputSpec(MRTrix3BaseInputSpec):
179188
in_file = File(
180-
exists=True, argstr="%s", position=-2, mandatory=True, desc="input DWI image"
189+
exists=True,
190+
argstr="%s",
191+
position=-2,
192+
mandatory=True,
193+
desc="input DWI image",
194+
)
195+
in_mask = File(
196+
argstr="-mask %s", desc="input mask image for bias field estimation"
181197
)
182-
in_mask = File(argstr="-mask %s", desc="input mask image for bias field estimation")
183198
use_ants = traits.Bool(
184199
argstr="ants",
185200
mandatory=True,
@@ -245,7 +260,11 @@ def _format_arg(self, name, trait_spec, value):
245260

246261
class DWIPreprocInputSpec(MRTrix3BaseInputSpec):
247262
in_file = File(
248-
exists=True, argstr="%s", position=0, mandatory=True, desc="input DWI image"
263+
exists=True,
264+
argstr="%s",
265+
position=0,
266+
mandatory=True,
267+
desc="input DWI image",
249268
)
250269
out_file = File(
251270
"preproc.mif",
@@ -267,7 +286,7 @@ class DWIPreprocInputSpec(MRTrix3BaseInputSpec):
267286
)
268287
pe_dir = traits.Str(
269288
argstr="-pe_dir %s",
270-
mandatory=True,
289+
mandatory=False,
271290
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)",
272291
)
273292
ro_time = traits.Float(
@@ -283,16 +302,42 @@ class DWIPreprocInputSpec(MRTrix3BaseInputSpec):
283302
argstr="-align_seepi",
284303
desc="Achieve alignment between the SE-EPI images used for inhomogeneity field estimation, and the DWIs",
285304
)
286-
eddy_options = traits.Str(
287-
argstr='-eddy_options "%s"',
288-
desc="Manually provide additional command-line options to the eddy command",
305+
json_import = File(
306+
exists=True,
307+
argstr="-json_import %s",
308+
desc="Import image header information from an associated JSON file (may be necessary to determine phase encoding information)",
289309
)
290310
topup_options = traits.Str(
291311
argstr='-topup_options "%s"',
292312
desc="Manually provide additional command-line options to the topup command",
293313
)
314+
eddy_options = traits.Str(
315+
argstr='-eddy_options "%s"',
316+
desc="Manually provide additional command-line options to the eddy command",
317+
)
318+
eddy_mask = File(
319+
exists=True,
320+
argstr="-eddy_mask %s",
321+
desc="Provide a processing mask to use for eddy, instead of having dwifslpreproc generate one internally using dwi2mask",
322+
)
323+
eddy_slspec = File(
324+
exists=True,
325+
argstr="-eddy_slspec %s",
326+
desc="Provide a file containing slice groupings for eddy's slice-to-volume registration",
327+
)
328+
eddyqc_text = Directory(
329+
exists=False,
330+
argstr="-eddyqc_text %s",
331+
desc="Copy the various text-based statistical outputs generated by eddy, and the output of eddy_qc (if installed), into an output directory",
332+
)
333+
eddyqc_all = Directory(
334+
exists=False,
335+
argstr="-eddyqc_all %s",
336+
desc="Copy ALL outputs generated by eddy (including images), and the output of eddy_qc (if installed), into an output directory",
337+
)
294338
export_grad_mrtrix = traits.Bool(
295-
argstr="-export_grad_mrtrix", desc="export new gradient files in mrtrix format"
339+
argstr="-export_grad_mrtrix",
340+
desc="export new gradient files in mrtrix format",
296341
)
297342
export_grad_fsl = traits.Bool(
298343
argstr="-export_grad_fsl", desc="export gradient files in FSL format"
@@ -367,7 +412,9 @@ def _list_outputs(self):
367412
outputs = self.output_spec().get()
368413
outputs["out_file"] = op.abspath(self.inputs.out_file)
369414
if self.inputs.export_grad_mrtrix:
370-
outputs["out_grad_mrtrix"] = op.abspath(self.inputs.out_grad_mrtrix)
415+
outputs["out_grad_mrtrix"] = op.abspath(
416+
self.inputs.out_grad_mrtrix
417+
)
371418
if self.inputs.export_grad_fsl:
372419
outputs["out_fsl_bvec"] = op.abspath(self.inputs.out_grad_fsl[0])
373420
outputs["out_fsl_bval"] = op.abspath(self.inputs.out_grad_fsl[1])
@@ -387,7 +434,11 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec):
387434
desc="response estimation algorithm (multi-tissue)",
388435
)
389436
in_file = File(
390-
exists=True, argstr="%s", position=-5, mandatory=True, desc="input DWI image"
437+
exists=True,
438+
argstr="%s",
439+
position=-5,
440+
mandatory=True,
441+
desc="input DWI image",
391442
)
392443
mtt_file = File(argstr="%s", position=-4, desc="input 5tt image")
393444
wm_file = File(
@@ -397,9 +448,15 @@ class ResponseSDInputSpec(MRTrix3BaseInputSpec):
397448
usedefault=True,
398449
desc="output WM response text file",
399450
)
400-
gm_file = File(argstr="%s", position=-2, desc="output GM response text file")
401-
csf_file = File(argstr="%s", position=-1, desc="output CSF response text file")
402-
in_mask = File(exists=True, argstr="-mask %s", desc="provide initial mask image")
451+
gm_file = File(
452+
argstr="%s", position=-2, desc="output GM response text file"
453+
)
454+
csf_file = File(
455+
argstr="%s", position=-1, desc="output CSF response text file"
456+
)
457+
in_mask = File(
458+
exists=True, argstr="-mask %s", desc="provide initial mask image"
459+
)
403460
max_sh = InputMultiObject(
404461
traits.Int,
405462
argstr="-lmax %s",
@@ -511,10 +568,17 @@ class ReplaceFSwithFIRSTInputSpec(CommandLineInputSpec):
511568
desc="input anatomical image",
512569
)
513570
in_t1w = File(
514-
exists=True, argstr="%s", mandatory=True, position=-3, desc="input T1 image"
571+
exists=True,
572+
argstr="%s",
573+
mandatory=True,
574+
position=-3,
575+
desc="input T1 image",
515576
)
516577
in_config = File(
517-
exists=True, argstr="%s", position=-2, desc="connectome configuration file"
578+
exists=True,
579+
argstr="%s",
580+
position=-2,
581+
desc="connectome configuration file",
518582
)
519583

520584
out_file = File(

0 commit comments

Comments
 (0)