Skip to content

Commit 7412c81

Browse files
committed
Merge pull request #3 from nipy/master
nipype update
2 parents b4fb54f + e0754aa commit 7412c81

12 files changed

+54
-16
lines changed

nipype/interfaces/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ def _inputs_help(cls):
785785

786786
opthelpstr = ['', '\t[Optional]']
787787
for name, spec in sorted(inputs.traits(transient=None).items()):
788-
if spec in mandatory_items:
788+
if name in mandatory_items:
789789
continue
790790
opthelpstr += cls._get_trait_desc(inputs, name, spec)
791791

nipype/interfaces/camino/convert.py

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
88
"""
99
import os
10+
import glob
1011

1112
from nipype.interfaces.base import (CommandLineInputSpec, CommandLine, traits,
1213
TraitedSpec, File, StdOutCommandLine,
13-
StdOutCommandLineInputSpec, isdefined)
14+
OutputMultiPath, StdOutCommandLineInputSpec,
15+
isdefined)
1416
from nipype.utils.filemanip import split_filename
1517

1618
class Image2VoxelInputSpec(StdOutCommandLineInputSpec):
@@ -226,16 +228,21 @@ class ProcStreamlinesInputSpec(StdOutCommandLineInputSpec):
226228
outputtracts = traits.Bool(argstr='-outputtracts', desc="Output streamlines in raw binary format.")
227229

228230
outputroot = File(exists=False, argstr='-outputroot %s',
229-
desc='root directory for output')
231+
desc='Prepended onto all output file names.')
230232

231233
gzip = traits.Bool(argstr='-gzip', desc="save the output image in gzip format")
232-
outputcp = traits.Bool(argstr='-outputcp', desc="output the connection probability map (Analyze image, float)")
233-
outputsc = traits.Bool(argstr='-outputsc', desc="output the connection probability map (raw streamlines, int)")
234-
outputacm = traits.Bool(argstr='-outputacm', desc="output all tracts in a single connection probability map (Analyze image)")
235-
outputcbs = traits.Bool(argstr='-outputcbs', desc="outputs connectivity-based segmentation maps; requires target outputfile")
234+
outputcp = traits.Bool(argstr='-outputcp', desc="output the connection probability map (Analyze image, float)",
235+
requires=['outputroot','seedfile'])
236+
outputsc = traits.Bool(argstr='-outputsc', desc="output the connection probability map (raw streamlines, int)",
237+
requires=['outputroot','seedfile'])
238+
outputacm = traits.Bool(argstr='-outputacm', desc="output all tracts in a single connection probability map (Analyze image)",
239+
requires=['outputroot','seedfile'])
240+
outputcbs = traits.Bool(argstr='-outputcbs', desc="outputs connectivity-based segmentation maps; requires target outputfile",
241+
requires=['outputroot','targetfile','seedfile'])
236242

237243
class ProcStreamlinesOutputSpec(TraitedSpec):
238244
proc = File(exists=True, desc='Processed Streamlines')
245+
outputroot_files = OutputMultiPath(File(exists=True))
239246

240247
class ProcStreamlines(StdOutCommandLine):
241248
"""
@@ -256,9 +263,33 @@ class ProcStreamlines(StdOutCommandLine):
256263
input_spec=ProcStreamlinesInputSpec
257264
output_spec=ProcStreamlinesOutputSpec
258265

266+
def _format_arg(self, name, spec, value):
267+
if name == 'outputroot':
268+
return spec.argstr % self._get_actual_outputroot(value)
269+
return super(ProcStreamlines, self)._format_arg(name, spec, value)
270+
271+
def _run_interface(self, runtime):
272+
outputroot = self.inputs.outputroot
273+
if isdefined(outputroot):
274+
actual_outputroot = self._get_actual_outputroot(outputroot)
275+
base, filename, ext = split_filename(actual_outputroot)
276+
if not os.path.exists(base):
277+
os.makedirs(base)
278+
new_runtime = super(ProcStreamlines, self)._run_interface(runtime)
279+
self.outputroot_files = glob.glob(os.path.join(os.getcwd(),actual_outputroot+'*'))
280+
return new_runtime
281+
else:
282+
new_runtime = super(ProcStreamlines, self)._run_interface(runtime)
283+
return new_runtime
284+
285+
def _get_actual_outputroot(self, outputroot):
286+
actual_outputroot = os.path.join('procstream_outfiles', outputroot)
287+
return actual_outputroot
288+
259289
def _list_outputs(self):
260290
outputs = self.output_spec().get()
261291
outputs['proc'] = os.path.abspath(self._gen_outfilename())
292+
outputs['outputroot_files'] = self.outputroot_files
262293
return outputs
263294

264295
def _gen_outfilename(self):

nipype/interfaces/camino/tests/test_auto_ProcStreamlines.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,18 @@ def test_ProcStreamlines_inputs():
5656
position=-1,
5757
),
5858
outputacm=dict(argstr='-outputacm',
59+
requires=['outputroot', 'seedfile'],
5960
),
6061
outputcbs=dict(argstr='-outputcbs',
62+
requires=['outputroot', 'targetfile', 'seedfile'],
6163
),
6264
outputcp=dict(argstr='-outputcp',
65+
requires=['outputroot', 'seedfile'],
6366
),
6467
outputroot=dict(argstr='-outputroot %s',
6568
),
6669
outputsc=dict(argstr='-outputsc',
70+
requires=['outputroot', 'seedfile'],
6771
),
6872
outputtracts=dict(argstr='-outputtracts',
6973
),
@@ -103,7 +107,8 @@ def test_ProcStreamlines_inputs():
103107
yield assert_equal, getattr(inputs.traits()[key], metakey), value
104108

105109
def test_ProcStreamlines_outputs():
106-
output_map = dict(proc=dict(),
110+
output_map = dict(outputroot_files=dict(),
111+
proc=dict(),
107112
)
108113
outputs = ProcStreamlines.output_spec()
109114

nipype/interfaces/fsl/dti.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class DTIFitInputSpec(FSLCommandInputSpec):
4646
save_tensor = traits.Bool(desc='save the elements of the tensor',
4747
argstr='--save_tensor')
4848
sse = traits.Bool(desc='output sum of squared errors', argstr='--sse')
49-
cni = File(exists=True, desc='input counfound regressors', argstr='-cni %s')
49+
cni = File(exists=True, desc='input counfound regressors', argstr='--cni=%s')
5050
little_bit = traits.Bool(desc='only process small area of brain',
5151
argstr='--littlebit')
5252

nipype/interfaces/fsl/model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,8 @@ def _list_outputs(self):
12721272
class MELODICInputSpec(FSLCommandInputSpec):
12731273
in_files = InputMultiPath(
12741274
File(exists=True), argstr="-i %s", mandatory=True, position=0,
1275-
desc="input file names (either single file name or a list)")
1275+
desc="input file names (either single file name or a list)",
1276+
sep=",")
12761277
out_dir = Directory(
12771278
argstr="-o %s", desc="output directory name", genfile=True)
12781279
mask = File(exists=True, argstr="-m %s",

nipype/interfaces/fsl/tests/test_auto_DTIFit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_DTIFit_inputs():
1717
mandatory=True,
1818
position=3,
1919
),
20-
cni=dict(argstr='-cni %s',
20+
cni=dict(argstr='--cni=%s',
2121
),
2222
dwi=dict(argstr='-k %s',
2323
mandatory=True,

nipype/interfaces/fsl/tests/test_auto_MELODIC.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def test_MELODIC_inputs():
3232
in_files=dict(argstr='-i %s',
3333
mandatory=True,
3434
position=0,
35+
sep=',',
3536
),
3637
log_power=dict(argstr='--logPower',
3738
),

nipype/interfaces/mrtrix/tests/test_auto_DiffusionTensorStreamlineTrack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_DiffusionTensorStreamlineTrack_inputs():
9494
step_size=dict(argstr='-step %s',
9595
units='mm',
9696
),
97-
stop=dict(argstr='-gzip',
97+
stop=dict(argstr='-stop',
9898
),
9999
terminal_output=dict(mandatory=True,
100100
nohash=True,

nipype/interfaces/mrtrix/tests/test_auto_ProbabilisticSphericallyDeconvolutedStreamlineTrack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def test_ProbabilisticSphericallyDeconvolutedStreamlineTrack_inputs():
9292
step_size=dict(argstr='-step %s',
9393
units='mm',
9494
),
95-
stop=dict(argstr='-gzip',
95+
stop=dict(argstr='-stop',
9696
),
9797
terminal_output=dict(mandatory=True,
9898
nohash=True,

nipype/interfaces/mrtrix/tests/test_auto_SphericallyDeconvolutedStreamlineTrack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_SphericallyDeconvolutedStreamlineTrack_inputs():
9090
step_size=dict(argstr='-step %s',
9191
units='mm',
9292
),
93-
stop=dict(argstr='-gzip',
93+
stop=dict(argstr='-stop',
9494
),
9595
terminal_output=dict(mandatory=True,
9696
nohash=True,

nipype/interfaces/mrtrix/tests/test_auto_StreamlineTrack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_StreamlineTrack_inputs():
9090
step_size=dict(argstr='-step %s',
9191
units='mm',
9292
),
93-
stop=dict(argstr='-gzip',
93+
stop=dict(argstr='-stop',
9494
),
9595
terminal_output=dict(mandatory=True,
9696
nohash=True,

nipype/interfaces/mrtrix/tracking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class StreamlineTrackInputSpec(CommandLineInputSpec):
9999
inputmodel = traits.Enum('DT_STREAM', 'SD_PROB', 'SD_STREAM',
100100
argstr='%s', desc='input model type', usedefault=True, position=-3)
101101

102-
stop = traits.Bool(argstr='-gzip', desc="stop track as soon as it enters any of the include regions.")
102+
stop = traits.Bool(argstr='-stop', desc="stop track as soon as it enters any of the include regions.")
103103
do_not_precompute = traits.Bool(argstr='-noprecomputed', desc="Turns off precomputation of the legendre polynomial values. Warning: this will slow down the algorithm by a factor of approximately 4.")
104104
unidirectional = traits.Bool(argstr='-unidirectional', desc="Track from the seed point in one direction only (default is to track in both directions).")
105105
no_mask_interpolation = traits.Bool(argstr='-nomaskinterp', desc="Turns off trilinear interpolation of mask images.")

0 commit comments

Comments
 (0)