Skip to content

Commit f29fda1

Browse files
committed
antsCorticalThickness interface + example data for testing
1 parent 4b97b0b commit f29fda1

26 files changed

+86
-163
lines changed

nipype/interfaces/afni/tests/test_auto_Volreg.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ def test_Volreg_inputs():
3232
name_source='in_file',
3333
name_template='%s.1D',
3434
),
35-
oned_matrix_save=dict(argstr='-1Dmatrix_save %s',
36-
keep_extension=True,
37-
name_source='in_file',
38-
name_template='%s.aff12.1D',
39-
),
4035
out_file=dict(argstr='-prefix %s',
4136
name_source='in_file',
4237
name_template='%s_volreg',
@@ -62,7 +57,6 @@ def test_Volreg_inputs():
6257
def test_Volreg_outputs():
6358
output_map = dict(md1d_file=dict(),
6459
oned_file=dict(),
65-
oned_matrix_save=dict(),
6660
out_file=dict(),
6761
)
6862
outputs = Volreg.output_spec()

nipype/interfaces/ants/segmentation.py

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ class antsCorticalThicknessInputSpec(ANTSCommandInputSpec):
295295
dimension=traits.Enum(3, 2, argstr= '-d %d', usedefault=True,
296296
desc='image dimension (2 or 3)')
297297
anatomical_image=File(exists=True,
298-
argstr='-a %s',
298+
argstr='-a %s',
299299
desc='Structural *intensity* image, typically T1.'
300300
'If more than one anatomical image is specified,'
301301
'subsequently specified images are used during the'
@@ -308,41 +308,43 @@ class antsCorticalThicknessInputSpec(ANTSCommandInputSpec):
308308
argstr='-e %s',
309309
desc='Anatomical *intensity* template (possibly created using a'
310310
'population data set with buildtemplateparallel.sh in ANTs).'
311-
'This template is *not* skull-stripped.')
311+
'This template is *not* skull-stripped.',
312+
mandatory=True)
312313
brain_probability_mask=File(exists=True,
313314
argstr='-m %s', desc='brain probability mask in template space',
314-
mandatory=True, copyfile=False)
315+
copyfile=False, mandatory=True)
315316
segmentation_priors = InputMultiPath(File(exists=True),
316-
argstr='-p %s')
317+
argstr='-p %s', mandatory=True)
317318
out_prefix = traits.Str('antsCT_', argstr='-o %s', usedefault=True,
318319
desc=('Prefix that is prepended to all output'
319320
' files (default = antsCT_)'))
320321
image_suffix=traits.Str('nii.gz', desc=('any of standard ITK formats,'
321-
' nii.gz is default'), mandatory = False, argstr='-s %s',
322+
' nii.gz is default'), mandatory = False, argstr='-s %s',
322323
usedefault=True)
323-
t1_registration_template = File(exists=True,
324+
t1_registration_template = File(exists=True,
324325
desc = ('Anatomical *intensity* template'
325-
'(assumed to be skull-stripped). A common'
326+
'(assumed to be skull-stripped). A common'
326327
'case would be where this would be the same'
327328
'template as specified in the -e option which'
328329
'is not skull stripped.'),
329-
mandatory=True, argstr='-t %s')
330+
argstr='-t %s',
331+
mandatory=True)
330332
extraction_registration_mask=File(exists=True, argstr='-f %s',
331333
mandatory=False, desc='Mask (defined in the template'
332334
'space) used during registration for brain extraction.')
333-
keep_temporary_files=traits.Int(argstrr='-k %d',
335+
keep_temporary_files=traits.Int(argstrr='-k %d',
334336
desc='Keep brain extraction/segmentation'
335337
'warps, etc (default = 0).', mandatory=False)
336-
max_iterations=traits.Int(argstr='-i %d',
337-
desc='ANTS registration max iterations'
338+
max_iterations=traits.Int(argstr='-i %d',
339+
desc='ANTS registration max iterations'
338340
'(default = 100x100x70x20)', mandatory=False)
339341
prior_segmentation_weight=traits.Float(mandatory=False, argstr='-w %f',
340342
desc='Atropos spatial prior *probability* weight for'
341343
'the segmentation')
342344
segmentation_iterations=traits.Int(argstr='-n %d', mandatory=False,
343345
desc='N4 -> Atropos -> N4 iterations during segmentation'
344346
'(default = 3)')
345-
posterior_formulation=traits.Str(argstr='-b %s', mandatory=False,
347+
posterior_formulation=traits.Str(argstr='-b %s', mandatory=False,
346348
desc=('Atropos posterior formulation and whether or not'
347349
'to use mixture model proportions.'
348350
'''e.g 'Socrates[1]' (default) or 'Aristotle[1]'.'''
@@ -363,7 +365,7 @@ class antsCorticalThicknessInputSpec(ANTSCommandInputSpec):
363365
label_propagation=traits.Str(argstr='-l %s', mandatory=False,
364366
desc='Incorporate a distance prior one the posterior formulation. Should be'
365367
'''of the form 'label[lambda,boundaryProbability]' where label'''
366-
'is a value of 1,2,3,... denoting label ID. The label'
368+
'is a value of 1,2,3,... denoting label ID. The label'
367369
'probability for anything outside the current label'
368370
' = boundaryProbability * exp( -lambda * distanceFromBoundary )'
369371
'Intuitively, smaller lambda values will increase the spatial capture'
@@ -372,7 +374,7 @@ class antsCorticalThicknessInputSpec(ANTSCommandInputSpec):
372374
quick_registration=traits.Bool(argstr='-q 1', mandatory=False,
373375
desc='If = 1, use antsRegistrationSyNQuick.sh as the basis for registration'
374376
'during brain extraction, brain segmentation, and'
375-
'(optional) normalization to a template.'
377+
'(optional) normalization to a template.'
376378
'Otherwise use antsRegistrationSyN.sh (default = 0).')
377379
debug=traits.Bool(argstr='-z 1', mandatory=False,
378380
desc='If > 0, runs a faster version of the script.'
@@ -412,17 +414,17 @@ class antsCorticalThickness(ANTSCommand):
412414
Examples
413415
--------
414416
>>> from nipype.interfaces.ants.segmentation import antsCorticalThickness
415-
>>> corticalthickness = anstCorticalThickness()
417+
>>> corticalthickness = antsCorticalThickness()
416418
>>> corticalthickness.inputs.dimension = 3
417419
>>> corticalthickness.inputs.anatomical_image ='T1.nii.gz'
418420
>>> corticalthickness.inputs.brain_template = 'study_template.nii.gz'
419421
>>> corticalthickness.inputs.brain_probability_mask ='ProbabilityMaskOfStudyTemplate.nii.gz'
420-
>>> corticalthickness.inputs.segmentation_priors =['CSF.nii.gz','WM.nii.gz','GM.nii.gz','DEEP_GM.nii.gz']
422+
>>> corticalthickness.inputs.segmentation_priors = ['BrainSegmentationPrior01.nii.gz', 'BrainSegmentationPrior02.nii.gz', 'BrainSegmentationPrior03.nii.gz', 'BrainSegmentationPrior04.nii.gz']
421423
>>> corticalthickness.inputs.t1_registration_template = 'brain_study_template.nii.gz'
422424
>>> corticalthickness.cmdline
423-
'antsCorticalThickness.sh -d 3 -a T1.nii.gz -m ProbabilityMaskOfStudyTemplate.nii.gz -e study_template.nii.gz -o antsCT_ -p BrainSegmentationPrior%0d.nii.gz -t brain_study_template.nii.gz'
425+
'antsCorticalThickness.sh -a T1.nii.gz -m ProbabilityMaskOfStudyTemplate.nii.gz -e study_template.nii.gz -d 3 -s nii.gz -o antsCT_ -p BrainSegmentationPrior%02d.nii.gz -t brain_study_template.nii.gz'
424426
"""
425-
427+
426428
input_spec = antsCorticalThicknessInputSpec
427429
output_spec = antsCorticalThicknessoutputSpec
428430
_cmd = 'antsCorticalThickness.sh'
@@ -444,7 +446,7 @@ def _format_arg(self, opt, spec, val):
444446
return retval
445447
if opt == 'segmentation_priors':
446448
_, _, ext = split_filename(self.inputs.segmentation_priors[0])
447-
retval = "-p priors/BrainSegmentationPrior%02d"
449+
retval = "-p BrainSegmentationPrior%02d"
448450
retval += ext
449451
return retval
450452
return super(ANTSCommand, self)._format_arg(opt, spec, val)
@@ -474,7 +476,7 @@ def _list_outputs(self):
474476
self.inputs.image_suffix)
475477
outputs['BrainSegmentationN4'] = os.path.join(os.getcwd(),
476478
self.inputs.out_prefix +
477-
'BrainSegmentation0N4.' +
479+
'BrainSegmentation0N4.' +
478480
self.inputs.image_suffix)
479481
outputs['BrainSegmentationPosteriorsCSF'] = os.path.join(os.getcwd(),
480482
self.inputs.out_prefix +
@@ -496,14 +498,14 @@ def _list_outputs(self):
496498
os.getcwd(),
497499
'TemplateToSubject1GenericAffine.mat')
498500
outputs['TemplateToSubject0Warp'] = os.path.join(os.getcwd(),
499-
self.inputs.out_prefix + 'TemplateToSubject0Warp.'+
501+
self.inputs.out_prefix + 'TemplateToSubject0Warp.'+
500502
self.inputs.image_suffix)
501503
outputs['SubjectToTemplate1Warp'] = os.path.join(os.getcwd(),
502-
self.inputs.out_prefix + 'SubjectToTemplate1Warp' +
504+
self.inputs.out_prefix + 'SubjectToTemplate1Warp' +
503505
self.inputs.image_suffix)
504506
outputs['SubjectToTemplate0GenericAffine'] = os.path.join(os.getcwd(),
505507
self.inputs.out_prefix + 'SubjectToTemplate0GenericAffine.mat')
506-
outputs['TemplateToSubjectLogJacobian'] = os.path.join(os.getcwd(),
508+
outputs['TemplateToSubjectLogJacobian'] = os.path.join(os.getcwd(),
507509
self.inputs.out_prefix + 'subjectToTemplateLogJacobian.'+
508510
self.inputs.image_suffix)
509511
return outputs

nipype/interfaces/camino/tests/test_auto_ProcStreamlines.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,14 @@ def test_ProcStreamlines_inputs():
5656
position=-1,
5757
),
5858
outputacm=dict(argstr='-outputacm',
59-
requires=['outputroot', 'seedfile'],
6059
),
6160
outputcbs=dict(argstr='-outputcbs',
62-
requires=['outputroot', 'targetfile', 'seedfile'],
6361
),
6462
outputcp=dict(argstr='-outputcp',
65-
requires=['outputroot', 'seedfile'],
6663
),
6764
outputroot=dict(argstr='-outputroot %s',
6865
),
6966
outputsc=dict(argstr='-outputsc',
70-
requires=['outputroot', 'seedfile'],
7167
),
7268
outputtracts=dict(argstr='-outputtracts',
7369
),
@@ -107,8 +103,7 @@ def test_ProcStreamlines_inputs():
107103
yield assert_equal, getattr(inputs.traits()[key], metakey), value
108104

109105
def test_ProcStreamlines_outputs():
110-
output_map = dict(outputroot_files=dict(),
111-
proc=dict(),
106+
output_map = dict(proc=dict(),
112107
)
113108
outputs = ProcStreamlines.output_spec()
114109

nipype/interfaces/fsl/tests/test_auto_ApplyTOPUP.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,20 @@ def test_ApplyTOPUP_inputs():
1616
ignore_exception=dict(nohash=True,
1717
usedefault=True,
1818
),
19-
in_files=dict(argstr='--imain=%s',
19+
in_files=dict(argstr='%s',
2020
mandatory=True,
21-
sep=',',
2221
),
23-
in_index=dict(argstr='--inindex=%s',
22+
in_index=dict(argstr='%s',
2423
mandatory=True,
25-
sep=',',
2624
),
27-
in_topup_fieldcoef=dict(argstr='--topup=%s',
28-
copyfile=False,
29-
requires=['in_topup_movpar'],
30-
),
31-
in_topup_movpar=dict(copyfile=False,
32-
requires=['in_topup_fieldcoef'],
25+
in_topup=dict(argstr='--topup=%s',
26+
mandatory=True,
3327
),
3428
interp=dict(argstr='--interp=%s',
3529
),
3630
method=dict(argstr='--method=%s',
3731
),
38-
out_corrected=dict(argstr='--out=%s',
39-
name_source=['in_files'],
40-
name_template='%s_corrected',
32+
out_base=dict(argstr='--out=%s',
4133
),
4234
output_type=dict(),
4335
terminal_output=dict(mandatory=True,

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_Eddy.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ def test_Eddy_inputs():
3333
in_mask=dict(argstr='--mask=%s',
3434
mandatory=True,
3535
),
36-
in_topup_fieldcoef=dict(argstr='--topup=%s',
37-
copyfile=False,
38-
requires=['in_topup_movpar'],
39-
),
40-
in_topup_movpar=dict(copyfile=False,
41-
requires=['in_topup_fieldcoef'],
36+
in_topup=dict(argstr='--topup=%s',
4237
),
4338
method=dict(argstr='--resamp=%s',
4439
),

nipype/interfaces/fsl/tests/test_auto_FIRST.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def test_FIRST_inputs():
1818
usedefault=True,
1919
),
2020
in_file=dict(argstr='-i %s',
21-
copyfile=False,
2221
mandatory=True,
2322
position=-2,
2423
),

nipype/interfaces/fsl/tests/test_auto_FUGUE.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def test_FUGUE_inputs():
2121
fmap_in_file=dict(argstr='--loadfmap=%s',
2222
),
2323
fmap_out_file=dict(argstr='--savefmap=%s',
24+
hash_files=False,
2425
),
2526
forward_warping=dict(usedefault=True,
2627
),
@@ -52,23 +53,21 @@ def test_FUGUE_inputs():
5253
),
5354
phase_conjugate=dict(argstr='--phaseconj',
5455
),
55-
phasemap_in_file=dict(argstr='--phasemap=%s',
56+
phasemap_file=dict(argstr='--phasemap=%s',
5657
),
5758
poly_order=dict(argstr='--poly=%d',
5859
),
59-
save_fmap=dict(xor=['save_unmasked_fmap'],
60-
),
61-
save_shift=dict(xor=['save_unmasked_shift'],
62-
),
60+
save_shift=dict(),
6361
save_unmasked_fmap=dict(argstr='--unmaskfmap',
64-
xor=['save_fmap'],
62+
requires=['fmap_out_file'],
6563
),
6664
save_unmasked_shift=dict(argstr='--unmaskshift',
67-
xor=['save_shift'],
65+
requires=['shift_out_file'],
6866
),
6967
shift_in_file=dict(argstr='--loadshift=%s',
7068
),
7169
shift_out_file=dict(argstr='--saveshift=%s',
70+
hash_files=False,
7271
),
7372
smooth2d=dict(argstr='--smooth2=%.2f',
7473
),
@@ -80,12 +79,11 @@ def test_FUGUE_inputs():
8079
unwarp_direction=dict(argstr='--unwarpdir=%s',
8180
),
8281
unwarped_file=dict(argstr='--unwarp=%s',
83-
requires=['in_file'],
84-
xor=['warped_file'],
82+
genfile=True,
83+
hash_files=False,
8584
),
8685
warped_file=dict(argstr='--warp=%s',
87-
requires=['in_file'],
88-
xor=['unwarped_file'],
86+
hash_files=False,
8987
),
9088
)
9189
inputs = FUGUE.input_spec()

nipype/interfaces/fsl/tests/test_auto_MELODIC.py

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

nipype/interfaces/fsl/tests/test_auto_TOPUP.py

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,8 @@ def test_TOPUP_inputs():
88
config=dict(argstr='--config=%s',
99
usedefault=True,
1010
),
11-
encoding_direction=dict(argstr='--datain=%s',
12-
mandatory=True,
13-
requires=['readout_times'],
14-
xor=['encoding_file'],
15-
),
11+
encoding_direction=dict(),
1612
encoding_file=dict(argstr='--datain=%s',
17-
mandatory=True,
18-
xor=['encoding_direction'],
1913
),
2014
environ=dict(nohash=True,
2115
usedefault=True,
@@ -39,31 +33,15 @@ def test_TOPUP_inputs():
3933
numprec=dict(argstr='--numprec=%s',
4034
),
4135
out_base=dict(argstr='--out=%s',
42-
hash_files=False,
43-
name_source=['in_file'],
44-
name_template='%s_base',
4536
),
4637
out_corrected=dict(argstr='--iout=%s',
47-
hash_files=False,
48-
name_source=['in_file'],
49-
name_template='%s_corrected',
5038
),
5139
out_field=dict(argstr='--fout=%s',
52-
hash_files=False,
53-
name_source=['in_file'],
54-
name_template='%s_field',
5540
),
5641
out_logfile=dict(argstr='--logout=%s',
57-
hash_files=False,
58-
keep_extension=True,
59-
name_source=['in_file'],
60-
name_template='%s_topup.log',
6142
),
6243
output_type=dict(),
63-
readout_times=dict(mandatory=True,
64-
requires=['encoding_direction'],
65-
xor=['encoding_file'],
66-
),
44+
readout_times=dict(),
6745
regrid=dict(argstr='--regrid=%d',
6846
),
6947
scale=dict(argstr='--scale=%d',
@@ -91,6 +69,7 @@ def test_TOPUP_outputs():
9169
out_fieldcoef=dict(),
9270
out_logfile=dict(),
9371
out_movpar=dict(),
72+
out_topup=dict(),
9473
)
9574
outputs = TOPUP.output_spec()
9675

0 commit comments

Comments
 (0)