Skip to content

Commit 9abafec

Browse files
authored
Merge pull request #2176 from Gilles86/lta_convert
ENH: --out_itk option for LTAConvert
2 parents 32e724c + 8495a87 commit 9abafec

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

.zenodo.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,11 @@
523523
"affiliation": "University of Amsterdam",
524524
"name": "Lukas Snoek",
525525
"orcid": "0000-0001-8972-204X"
526+
},
527+
{
528+
"affiliation": "Vrije Universiteit, Amsterdam",
529+
"name": "Gilles de Hollander",
530+
"orcid": "0000-0003-1988-5091"
526531
}
527532
],
528533
"keywords": [

nipype/interfaces/freesurfer/tests/test_auto_LTAConvert.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,27 @@ def test_LTAConvert_inputs():
1414
),
1515
in_fsl=dict(argstr='--infsl %s',
1616
mandatory=True,
17-
xor=('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg'),
17+
xor=('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg', 'in_itk'),
18+
),
19+
in_itk=dict(argstr='--initk %s',
20+
mandatory=True,
21+
xor=('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg', 'in_itk'),
1822
),
1923
in_lta=dict(argstr='--inlta %s',
2024
mandatory=True,
21-
xor=('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg'),
25+
xor=('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg', 'in_itk'),
2226
),
2327
in_mni=dict(argstr='--inmni %s',
2428
mandatory=True,
25-
xor=('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg'),
29+
xor=('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg', 'in_itk'),
2630
),
2731
in_niftyreg=dict(argstr='--inniftyreg %s',
2832
mandatory=True,
29-
xor=('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg'),
33+
xor=('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg', 'in_itk'),
3034
),
3135
in_reg=dict(argstr='--inreg %s',
3236
mandatory=True,
33-
xor=('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg'),
37+
xor=('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg', 'in_itk'),
3438
),
3539
invert=dict(argstr='--invert',
3640
),
@@ -39,6 +43,8 @@ def test_LTAConvert_inputs():
3943
),
4044
out_fsl=dict(argstr='--outfsl %s',
4145
),
46+
out_itk=dict(argstr='--outitk %s',
47+
),
4248
out_lta=dict(argstr='--outlta %s',
4349
),
4450
out_mni=dict(argstr='--outmni %s',
@@ -63,6 +69,7 @@ def test_LTAConvert_inputs():
6369

6470
def test_LTAConvert_outputs():
6571
output_map = dict(out_fsl=dict(),
72+
out_itk=dict(),
6673
out_lta=dict(),
6774
out_mni=dict(),
6875
out_reg=dict(),

nipype/interfaces/freesurfer/utils.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3084,7 +3084,7 @@ def _normalize_filenames(self):
30843084

30853085
class LTAConvertInputSpec(CommandLineInputSpec):
30863086
# Inputs
3087-
_in_xor = ('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg')
3087+
_in_xor = ('in_lta', 'in_fsl', 'in_mni', 'in_reg', 'in_niftyreg', 'in_itk')
30883088
in_lta = traits.Either(
30893089
File(exists=True), 'identity.nofile', argstr='--inlta %s',
30903090
mandatory=True, xor=_in_xor, desc='input transform of LTA type')
@@ -3100,6 +3100,9 @@ class LTAConvertInputSpec(CommandLineInputSpec):
31003100
in_niftyreg = File(
31013101
exists=True, argstr='--inniftyreg %s', mandatory=True, xor=_in_xor,
31023102
desc='input transform of Nifty Reg type (inverse RAS2RAS)')
3103+
in_itk = File(
3104+
exists=True, argstr='--initk %s', mandatory=True, xor=_in_xor,
3105+
desc='input transform of ITK type')
31033106
# Outputs
31043107
out_lta = traits.Either(
31053108
traits.Bool, File, argstr='--outlta %s',
@@ -3110,6 +3113,8 @@ class LTAConvertInputSpec(CommandLineInputSpec):
31103113
desc='output transform in MNI/XFM format')
31113114
out_reg = traits.Either(traits.Bool, File, argstr='--outreg %s',
31123115
desc='output transform in reg dat format')
3116+
out_itk = traits.Either(traits.Bool, File, argstr='--outitk %s',
3117+
desc='output transform in ITK format')
31133118
# Optional flags
31143119
invert = traits.Bool(argstr='--invert')
31153120
ltavox2vox = traits.Bool(argstr='--ltavox2vox', requires=['out_lta'])
@@ -3124,6 +3129,7 @@ class LTAConvertOutputSpec(TraitedSpec):
31243129
out_fsl = File(exists=True, desc='output transform in FSL format')
31253130
out_mni = File(exists=True, desc='output transform in MNI/XFM format')
31263131
out_reg = File(exists=True, desc='output transform in reg dat format')
3132+
out_itk = File(exists=True, desc='output transform in ITK format')
31273133

31283134

31293135
class LTAConvert(CommandLine):
@@ -3146,7 +3152,8 @@ def _format_arg(self, name, spec, value):
31463152
def _list_outputs(self):
31473153
outputs = self.output_spec().get()
31483154
for name, default in (('out_lta', 'out.lta'), ('out_fsl', 'out.mat'),
3149-
('out_mni', 'out.xfm'), ('out_reg', 'out.dat')):
3155+
('out_mni', 'out.xfm'), ('out_reg', 'out.dat'),
3156+
('out_itk', 'out.txt')):
31503157
attr = getattr(self.inputs, name)
31513158
if attr:
31523159
fname = default if attr is True else attr

0 commit comments

Comments
 (0)