Skip to content

Commit d409f1c

Browse files
committed
Merge pull request #1 from satra/antsct
Antsct
2 parents 3c7fe61 + ed15c70 commit d409f1c

29 files changed

+918
-366
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ python:
44
- 2.7
55
# Setup anaconda
66
before_install:
7-
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then wget http://repo.continuum.io/miniconda/Miniconda-3.0.0-Linux-x86_64.sh -O miniconda.sh; else wget http://repo.continuum.io/miniconda/Miniconda3-3.0.0-Linux-x86_64.sh -O miniconda.sh; fi
7+
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh; else wget http://repo.continuum.io/miniconda/Miniconda3-3.6.0-Linux-x86_64.sh -O miniconda.sh; fi
88
- chmod +x miniconda.sh
99
- ./miniconda.sh -b
1010
- export PATH=/home/travis/miniconda/bin:$PATH

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Next Release
22
============
33

4+
* ENH: New FSL interfaces: WarpPoints, WarpPointsToStd.
45
* ENH: New Freesurfer interface: MRIPretess
56
* ENH: New miscelaneous interface: AddCSVRow
67
* ENH: FUGUE interface has been refactored to use the name_template system, 3 examples

nipype/interfaces/afni/tests/test_auto_Volreg.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ 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+
),
3540
out_file=dict(argstr='-prefix %s',
3641
name_source='in_file',
3742
name_template='%s_volreg',
@@ -57,6 +62,7 @@ def test_Volreg_inputs():
5762
def test_Volreg_outputs():
5863
output_map = dict(md1d_file=dict(),
5964
oned_file=dict(),
65+
oned_matrix_save=dict(),
6066
out_file=dict(),
6167
)
6268
outputs = Volreg.output_spec()

nipype/interfaces/ants/segmentation.py

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,7 @@ class antsCorticalThicknessInputSpec(ANTSCommandInputSpec):
319319
desc=('Prefix that is prepended to all output'
320320
' files (default = antsCT_)'))
321321
image_suffix=traits.Str('nii.gz', desc=('any of standard ITK formats,'
322-
' nii.gz is default'), mandatory = False, argstr='-s %s',
323-
usedefault=True)
322+
' nii.gz is default'), argstr='-s %s', usedefault=True)
324323
t1_registration_template = File(exists=True,
325324
desc = ('Anatomical *intensity* template'
326325
'(assumed to be skull-stripped). A common'
@@ -330,56 +329,54 @@ class antsCorticalThicknessInputSpec(ANTSCommandInputSpec):
330329
argstr='-t %s',
331330
mandatory=True)
332331
extraction_registration_mask=File(exists=True, argstr='-f %s',
333-
mandatory=False, desc='Mask (defined in the template'
334-
'space) used during registration for brain extraction.')
335-
keep_temporary_files=traits.Int(argstrr='-k %d',
336-
desc='Keep brain extraction/segmentation'
337-
'warps, etc (default = 0).', mandatory=False)
332+
desc=('Mask (defined in the template space) used during'
333+
' registration for brain extraction.'))
334+
keep_temporary_files=traits.Int(argstr='-k %d',
335+
desc='Keep brain extraction/segmentation warps, etc (default = 0).')
338336
max_iterations=traits.Int(argstr='-i %d',
339337
desc='ANTS registration max iterations'
340-
'(default = 100x100x70x20)', mandatory=False)
341-
prior_segmentation_weight=traits.Float(mandatory=False, argstr='-w %f',
338+
'(default = 100x100x70x20)')
339+
prior_segmentation_weight=traits.Float(argstr='-w %f',
342340
desc='Atropos spatial prior *probability* weight for'
343341
'the segmentation')
344-
segmentation_iterations=traits.Int(argstr='-n %d', mandatory=False,
342+
segmentation_iterations=traits.Int(argstr='-n %d',
345343
desc='N4 -> Atropos -> N4 iterations during segmentation'
346344
'(default = 3)')
347-
posterior_formulation=traits.Str(argstr='-b %s', mandatory=False,
345+
posterior_formulation=traits.Str(argstr='-b %s',
348346
desc=('Atropos posterior formulation and whether or not'
349347
'to use mixture model proportions.'
350348
'''e.g 'Socrates[1]' (default) or 'Aristotle[1]'.'''
351349
'Choose the latter if you'
352350
'want use the distance priors (see also the -l option'
353351
'for label propagation control).'))
354352
use_floatingpoint_precision=traits.Enum(0, 1, argstr='-j %d',
355-
mandatory=False,
356353
desc='Use floating point precision in registrations (default = 0)')
357-
use_random_seeding=traits.Enum(0, 1, argstr='-u %d', mandatory=False,
358-
desc='Use random number generated from system clock in Atropos'
359-
'(default = 1)')
360-
b_spline_smoothing=traits.Bool(argst='-v', mandatory=False,
361-
desc='Use B-spline SyN for registrations and B-spline'
362-
'exponential mapping in DiReCT.')
363-
cortical_label_image=File(exists=True, mandatory=False,
354+
use_random_seeding=traits.Enum(0, 1, argstr='-u %d',
355+
desc=('Use random number generated from system clock in Atropos'
356+
'(default = 1)'))
357+
b_spline_smoothing=traits.Bool(argstr='-v',
358+
desc=('Use B-spline SyN for registrations and B-spline'
359+
'exponential mapping in DiReCT.'))
360+
cortical_label_image=File(exists=True,
364361
desc='Cortical ROI labels to use as a prior for ATITH.')
365-
label_propagation=traits.Str(argstr='-l %s', mandatory=False,
366-
desc='Incorporate a distance prior one the posterior formulation. Should be'
362+
label_propagation=traits.Str(argstr='-l %s',
363+
desc=('Incorporate a distance prior one the posterior formulation. Should be'
367364
'''of the form 'label[lambda,boundaryProbability]' where label'''
368365
'is a value of 1,2,3,... denoting label ID. The label'
369366
'probability for anything outside the current label'
370367
' = boundaryProbability * exp( -lambda * distanceFromBoundary )'
371368
'Intuitively, smaller lambda values will increase the spatial capture'
372369
'range of the distance prior. To apply to all label values, simply omit'
373-
'specifying the label, i.e. -l [lambda,boundaryProbability].')
374-
quick_registration=traits.Bool(argstr='-q 1', mandatory=False,
375-
desc='If = 1, use antsRegistrationSyNQuick.sh as the basis for registration'
370+
'specifying the label, i.e. -l [lambda,boundaryProbability].'))
371+
quick_registration=traits.Bool(argstr='-q 1',
372+
desc=('If = 1, use antsRegistrationSyNQuick.sh as the basis for registration'
376373
'during brain extraction, brain segmentation, and'
377374
'(optional) normalization to a template.'
378-
'Otherwise use antsRegistrationSyN.sh (default = 0).')
379-
debug=traits.Bool(argstr='-z 1', mandatory=False,
380-
desc='If > 0, runs a faster version of the script.'
375+
'Otherwise use antsRegistrationSyN.sh (default = 0).'))
376+
debug=traits.Bool(argstr='-z 1',
377+
desc=('If > 0, runs a faster version of the script.'
381378
'Only for testing. Implies -u 0.'
382-
'Requires single thread computation for complete reproducibility.')
379+
'Requires single thread computation for complete reproducibility.'))
383380

384381
class antsCorticalThicknessoutputSpec(TraitedSpec):
385382
BrainExtractionMask=File(exists=True,
@@ -450,6 +447,7 @@ def _format_arg(self, opt, spec, val):
450447
retval += ext
451448
return retval
452449
return super(ANTSCommand, self)._format_arg(opt, spec, val)
450+
453451
def _run_interface(self, runtime):
454452
priors_directory = os.path.join(os.getcwd(), "priors")
455453
if not os.path.exists(priors_directory):

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/elastix/registration.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# @Author: oesteban - code@oscaresteban.es
77
# @Date: 2014-06-02 12:06:50
88
# @Last Modified by: oesteban
9-
# @Last Modified time: 2014-06-17 10:19:23
9+
# @Last Modified time: 2014-09-01 21:03:57
1010
"""
1111
Interfaces to perform image registrations and to apply the resulting
1212
displacement maps to images and points.
@@ -18,8 +18,6 @@
1818

1919
from ..base import (CommandLine, CommandLineInputSpec, isdefined,
2020
TraitedSpec, File, traits, InputMultiPath)
21-
22-
2321
from base import ElastixBaseInputSpec
2422

2523
from ... import logging
@@ -31,10 +29,8 @@ class RegistrationInputSpec(ElastixBaseInputSpec):
3129
desc='fixed image')
3230
moving_image = File(exists=True, mandatory=True, argstr='-m %s',
3331
desc='moving image')
34-
3532
parameters = InputMultiPath(File(exists=True), mandatory=True, argstr='-p %s...',
3633
desc='parameter file, elastix handles 1 or more -p')
37-
3834
fixed_mask = File(exists=True, argstr='-fMask %s', desc='mask for fixed image')
3935
moving_mask = File(exists=True, argstr='-mMask %s', desc='mask for moving image')
4036
initial_transform = File(exists=True, argstr='-t0 %s',
@@ -51,7 +47,8 @@ class RegistrationOutputSpec(TraitedSpec):
5147

5248

5349
class Registration(CommandLine):
54-
"""Elastix nonlinear registration interface
50+
"""
51+
Elastix nonlinear registration interface
5552
5653
Example
5754
-------
@@ -63,6 +60,8 @@ class Registration(CommandLine):
6360
>>> reg.inputs.parameters = ['elastix.txt']
6461
>>> reg.cmdline
6562
'elastix -f fixed1.nii -m moving1.nii -out ./ -p elastix.txt'
63+
64+
6665
"""
6766

6867
_cmd = 'elastix'
@@ -140,17 +139,21 @@ class ApplyWarpOutputSpec(TraitedSpec):
140139
warped_file = File(desc='input moving image warped to fixed image')
141140

142141
class ApplyWarp(CommandLine):
143-
"""Use `transformix` to apply a transform on an input image.
142+
"""
143+
Use ``transformix`` to apply a transform on an input image.
144144
The transform is specified in the transform-parameter file.
145145
146-
Example::
146+
Example
147+
-------
147148
148149
>>> from nipype.interfaces.elastix import ApplyWarp
149150
>>> reg = ApplyWarp()
150151
>>> reg.inputs.moving_image = 'moving1.nii'
151152
>>> reg.inputs.transform_file = 'TransformParameters.0.txt'
152153
>>> reg.cmdline
153154
'transformix -in moving1.nii -out ./ -tp TransformParameters.0.txt'
155+
156+
154157
"""
155158

156159
_cmd = 'transformix'
@@ -170,22 +173,26 @@ class AnalyzeWarpInputSpec(ElastixBaseInputSpec):
170173

171174

172175
class AnalyzeWarpOutputSpec(TraitedSpec):
173-
disp_field = File(exists=True, desc='displacements field')
174-
jacdet_map = File(exists=True, desc='det(Jacobian) map')
175-
jacmat_map = File(exists=True, desc='Jacobian matrix map')
176+
disp_field = File(desc='displacements field')
177+
jacdet_map = File(desc='det(Jacobian) map')
178+
jacmat_map = File(desc='Jacobian matrix map')
176179

177180
class AnalyzeWarp(CommandLine):
178-
"""Use `transformix` to get details from the input transform (generate
181+
"""
182+
Use transformix to get details from the input transform (generate
179183
the corresponding deformation field, generate the determinant of the
180184
Jacobian map or the Jacobian map itself)
181185
182-
Example::
186+
Example
187+
-------
183188
184189
>>> from nipype.interfaces.elastix import AnalyzeWarp
185190
>>> reg = AnalyzeWarp()
186191
>>> reg.inputs.transform_file = 'TransformParameters.0.txt'
187192
>>> reg.cmdline
188193
'transformix -def all -jac all -jacmat all -out ./ -tp TransformParameters.0.txt'
194+
195+
189196
"""
190197

191198
_cmd = 'transformix -def all -jac all -jacmat all'
@@ -213,17 +220,20 @@ class PointsWarpOutputSpec(TraitedSpec):
213220
warped_file = File(desc='input points displaced in fixed image domain')
214221

215222
class PointsWarp(CommandLine):
216-
"""Use `transformix` to apply a transform on an input point set.
223+
"""Use ``transformix`` to apply a transform on an input point set.
217224
The transform is specified in the transform-parameter file.
218225
219-
Example::
226+
Example
227+
-------
220228
221229
>>> from nipype.interfaces.elastix import PointsWarp
222230
>>> reg = PointsWarp()
223231
>>> reg.inputs.points_file = 'surf1.vtk'
224232
>>> reg.inputs.transform_file = 'TransformParameters.0.txt'
225233
>>> reg.cmdline
226234
'transformix -out ./ -def surf1.vtk -tp TransformParameters.0.txt'
235+
236+
227237
"""
228238

229239
_cmd = 'transformix'

nipype/interfaces/elastix/utils.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# @Author: oesteban - code@oscaresteban.es
77
# @Date: 2014-06-17 10:17:07
88
# @Last Modified by: oesteban
9-
# @Last Modified time: 2014-06-27 10:25:36
9+
# @Last Modified time: 2014-09-01 21:05:33
1010
"""
1111
Generic interfaces to manipulate registration parameters files, including
1212
transform files (to configure warpings)
@@ -51,14 +51,17 @@ class EditTransform(BaseInterface):
5151
"""
5252
Manipulates an existing transform file generated with elastix
5353
54-
Example::
54+
Example
55+
-------
5556
5657
>>> from nipype.interfaces.elastix import EditTransform
5758
>>> tfm = EditTransform()
5859
>>> tfm.inputs.transform_file = 'TransformParameters.0.txt'
5960
>>> tfm.inputs.reference_image = 'fixed1.nii'
6061
>>> tfm.inputs.output_type = 'unsigned char'
6162
>>> tfm.run() # doctest: +SKIP
63+
64+
6265
"""
6366

6467
input_spec = EditTransformInputSpec

nipype/interfaces/fsl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
ImageStats, FilterRegressor, Overlay, Slicer,
1717
PlotTimeSeries, PlotMotionParams, ConvertXFM,
1818
SwapDimensions, PowerSpectrum, Reorient2Std,
19-
Complex, InvWarp, WarpUtils, ConvertWarp)
19+
Complex, InvWarp, WarpUtils, ConvertWarp, WarpPoints, WarpPointsToStd)
2020

2121
from .epi import (PrepareFieldmap, TOPUP, ApplyTOPUP, Eddy, EPIDeWarp,
2222
SigLoss, EddyCorrect)

0 commit comments

Comments
 (0)