Skip to content

Commit 2afca1b

Browse files
committed
new naming conventions
1 parent f177e3f commit 2afca1b

18 files changed

+663
-54
lines changed

CHANGES

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
Next Release
22
============
33

4-
* ENH: New miscelaneous interfaces: SplitROIs, MergeROIs to enable parallel processing of very large images.
5-
* ENH: Updated FSL interfaces: BEDPOSTX and XFibres, former interfaces are still available with the prefix `Old`.
4+
* ENH: New miscelaneous interfaces: SplitROIs (mapper), MergeROIs (reducer)
5+
to enable parallel processing of very large images.
6+
* ENH: Updated FSL interfaces: BEDPOSTX and XFibres, former interfaces are still
7+
available with the version suffix: BEDPOSTX4 and XFibres4. Added gpu
8+
versions of BEDPOSTX: BEDPOSTXGPU, BEDPOSTX5GPU, and BEDPOSTX4GPU
69
* ENH: New FSL interface: EpiReg
710
* ENH: New Freesurfer interface: Tkregister2 (for conversion of fsl style matrices to freesurfer format)
811
* ENH: New FSL interfaces: WarpPoints, WarpPointsToStd.

doc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
'numpy_ext.numpydoc',
4040
'matplotlib.sphinxext.plot_directive',
4141
'matplotlib.sphinxext.only_directives',
42-
'matplotlib.sphinxext.ipython_directive',
43-
'ipython_console_highlighting'
42+
'IPython.sphinxext.ipython_directive',
43+
'IPython.sphinxext.ipython_console_highlighting'
4444
]
4545

4646
# Add any paths that contain templates here, relative to this directory.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from nipype.testing import assert_equal
3+
from nipype.algorithms.misc import MergeROIs
4+
5+
def test_MergeROIs_inputs():
6+
input_map = dict(in_files=dict(),
7+
in_index=dict(),
8+
in_reference=dict(),
9+
)
10+
inputs = MergeROIs.input_spec()
11+
12+
for key, metadata in input_map.items():
13+
for metakey, value in metadata.items():
14+
yield assert_equal, getattr(inputs.traits()[key], metakey), value
15+
16+
def test_MergeROIs_outputs():
17+
output_map = dict(merged_file=dict(),
18+
)
19+
outputs = MergeROIs.output_spec()
20+
21+
for key, metadata in output_map.items():
22+
for metakey, value in metadata.items():
23+
yield assert_equal, getattr(outputs.traits()[key], metakey), value
24+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from nipype.testing import assert_equal
3+
from nipype.algorithms.misc import SplitROIs
4+
5+
def test_SplitROIs_inputs():
6+
input_map = dict(in_file=dict(mandatory=True,
7+
),
8+
in_mask=dict(),
9+
roi_size=dict(),
10+
)
11+
inputs = SplitROIs.input_spec()
12+
13+
for key, metadata in input_map.items():
14+
for metakey, value in metadata.items():
15+
yield assert_equal, getattr(inputs.traits()[key], metakey), value
16+
17+
def test_SplitROIs_outputs():
18+
output_map = dict(out_files=dict(),
19+
out_index=dict(),
20+
out_masks=dict(),
21+
)
22+
outputs = SplitROIs.output_spec()
23+
24+
for key, metadata in output_map.items():
25+
for metakey, value in metadata.items():
26+
yield assert_equal, getattr(outputs.traits()[key], metakey), value
27+

nipype/interfaces/dcmstack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class DcmStackInputSpec(NiftiGeneratorBaseInputSpec):
8484
"any default exclude filters")
8585
include_regexes = traits.List(desc="Meta data to include, overriding any "
8686
"exclude filters")
87-
force_read = traits.Bool(True, usedefault=True,
87+
force_read = traits.Bool(True, usedefault=True,
8888
desc=('Force reading files without DICM marker'))
8989

9090

nipype/interfaces/freesurfer/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,7 +1208,7 @@ class Tkregister2OutputSpec(TraitedSpec):
12081208

12091209

12101210
class Tkregister2(FSCommand):
1211-
"""Use tkregister2 without the manual editing stage to convert
1211+
"""Use tkregister2 without the manual editing stage to convert
12121212
FSL-style registration matrix (.mat) to FreeSurfer-style registration matrix (.dat)
12131213
12141214
Examples
@@ -1224,6 +1224,6 @@ class Tkregister2(FSCommand):
12241224
_cmd = "tkregister2"
12251225
input_spec = Tkregister2InputSpec
12261226
output_spec = Tkregister2OutputSpec
1227-
12281227

1229-
1228+
1229+

nipype/interfaces/fsl/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
from .epi import (PrepareFieldmap, TOPUP, ApplyTOPUP, Eddy, EPIDeWarp,
2222
SigLoss, EddyCorrect, EpiReg)
2323

24-
from .dti import (BEDPOSTX, XFibres, DTIFit, ProbTrackX, ProbTrackX2,
24+
from .dti import (BEDPOSTX, BEDPOSTXGPU, XFibres, DTIFit,
25+
ProbTrackX, ProbTrackX2,
2526
VecReg, ProjThresh, FindTheBiggest, DistanceMap,
26-
TractSkeleton, MakeDyadicVectors, OldBEDPOSTX, OldXFibres)
27+
TractSkeleton, MakeDyadicVectors, BEDPOSTX5, XFibres5,
28+
BEDPOSTX4, XFibres4, BEDPOSTX5GPU, BEDPOSTX4GPU)
2729
from .maths import (ChangeDataType, Threshold, MeanImage, ApplyMask,
2830
IsotropicSmooth, TemporalFilter, DilateImage, ErodeImage,
2931
SpatialFilter, UnaryMaths, BinaryMaths, MultiImageMaths)

nipype/interfaces/fsl/dti.py

Lines changed: 63 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import shutil
1717
import warnings
1818

19+
from ... import LooseVersion
1920
from nipype.interfaces.fsl.base import (FSLCommand, FSLCommandInputSpec, Info,
2021
FSLXCommand, FSLXCommandInputSpec,
2122
FSLXCommandOutputSpec)
@@ -100,14 +101,14 @@ def _list_outputs(self):
100101
return outputs
101102

102103

103-
class BEDPOSTXInputSpec(FSLXCommandInputSpec):
104+
class BEDPOSTX5InputSpec(FSLXCommandInputSpec):
104105
out_dir = Directory('.', mandatory=True, desc='output directory',
105106
usedefault=True, position=1, argstr='%s')
106107
gradnonlin = traits.Bool(False, argstr='-g', desc=('consider gradient '
107108
'nonlinearities, default off'))
108109

109110

110-
class BEDPOSTXOutputSpec(FSLXCommandOutputSpec):
111+
class BEDPOSTX5OutputSpec(FSLXCommandOutputSpec):
111112
mean_thsamples = OutputMultiPath(File(), desc=('Mean of '
112113
'distribution on theta'))
113114
mean_phsamples = OutputMultiPath(File(), desc=('Mean of '
@@ -124,7 +125,7 @@ class BEDPOSTXOutputSpec(FSLXCommandOutputSpec):
124125
' estimated fiber orientation'))
125126

126127

127-
class BEDPOSTX(FSLXCommand):
128+
class BEDPOSTX5(FSLXCommand):
128129
"""
129130
BEDPOSTX stands for Bayesian Estimation of Diffusion Parameters Obtained
130131
using Sampling Techniques. The X stands for modelling Crossing Fibres.
@@ -143,7 +144,7 @@ class BEDPOSTX(FSLXCommand):
143144
-------
144145
145146
>>> from nipype.interfaces import fsl
146-
>>> bedp = fsl.BEDPOSTX(bvecs='bvecs', bvals='bvals', dwi='diffusion.nii',
147+
>>> bedp = fsl.BEDPOSTX5(bvecs='bvecs', bvals='bvals', dwi='diffusion.nii',
147148
... mask='mask.nii', n_fibres=1)
148149
>>> bedp.cmdline
149150
'bedpostx . --bvals=bvals --bvecs=bvecs --data=diffusion.nii \
@@ -152,8 +153,8 @@ class BEDPOSTX(FSLXCommand):
152153
"""
153154

154155
_cmd = 'bedpostx'
155-
input_spec = BEDPOSTXInputSpec
156-
output_spec = BEDPOSTXOutputSpec
156+
input_spec = BEDPOSTX5InputSpec
157+
output_spec = BEDPOSTX5OutputSpec
157158
_can_resume = True
158159

159160
def _run_interface(self, runtime):
@@ -179,7 +180,7 @@ def _run_interface(self, runtime):
179180
copyfile(self.inputs.bvecs,
180181
os.path.join(subjectdir, 'bvecs'))
181182

182-
return super(BEDPOSTX, self)._run_interface(runtime)
183+
return super(BEDPOSTX5, self)._run_interface(runtime)
183184

184185
def _list_outputs(self):
185186
outputs = self.output_spec().get()
@@ -209,26 +210,30 @@ def _list_outputs(self):
209210
outputs['dyads_disp'].append(self._gen_fname(('dyads%d'
210211
'_dispersion') % i, cwd=out_dir))
211212

212-
super_out = super(BEDPOSTX, self)._list_outputs()
213+
super_out = super(BEDPOSTX5, self)._list_outputs()
213214

214215
for k, v in super_out.iteritems():
215216
outputs[k] = v
216217

217218
return outputs
218219

219220

220-
class XFibresInputSpec(FSLXCommandInputSpec):
221+
class BEDPOSTX5GPU(BEDPOSTX5):
222+
_cmd = 'bedpostx_gpu'
223+
224+
225+
class XFibres5InputSpec(FSLXCommandInputSpec):
221226
gradnonlin = File(exists=True, argstr='--gradnonlin=%s',
222227
desc='gradient file corresponding to slice')
223228

224229

225-
class XFibres(FSLXCommand):
230+
class XFibres5(FSLXCommand):
226231
"""
227232
Perform model parameters estimation for local (voxelwise) diffusion
228233
parameters
229234
"""
230235
_cmd = 'xfibres'
231-
input_spec = XFibresInputSpec
236+
input_spec = XFibres5InputSpec
232237
output_spec = FSLXCommandOutputSpec
233238

234239

@@ -902,7 +907,7 @@ def _list_outputs(self):
902907
return outputs
903908

904909

905-
class OldXFibresInputSpec(FSLCommandInputSpec):
910+
class XFibres4InputSpec(FSLCommandInputSpec):
906911
dwi = File(exists=True, argstr="--data=%s", mandatory=True)
907912
mask = File(exists=True, argstr="--mask=%s", mandatory=True)
908913
gradnonlin = File(exists=True, argstr="--gradnonlin=%s")
@@ -941,7 +946,7 @@ class OldXFibresInputSpec(FSLCommandInputSpec):
941946
argstr='--forcedir', usedefault=True)
942947

943948

944-
class OldXFibresOutputSpec(TraitedSpec):
949+
class XFibres4OutputSpec(TraitedSpec):
945950
dyads = OutputMultiPath(File(exists=True), desc="Mean of PDD distribution in vector form.")
946951
fsamples = OutputMultiPath(File(exists=True), desc="Samples from the distribution on anisotropic volume fraction")
947952
mean_dsamples = File(exists=True, desc="Mean of distribution on diffusivity d")
@@ -951,22 +956,22 @@ class OldXFibresOutputSpec(TraitedSpec):
951956
thsamples = OutputMultiPath(File(exists=True), desc="Samples from the distribution on theta")
952957

953958

954-
class OldXFibres(FSLCommand):
959+
class XFibres4(FSLCommand):
955960
"""
956961
Perform model parameters estimation for local (voxelwise) diffusion
957962
parameters
958963
959964
.. deprecated:: 0.9.2
960-
Use :class:`.XFibres` instead.
965+
Use :class:`.XFibres5` instead.
961966
962967
963968
"""
964969
_cmd = "xfibres"
965-
input_spec = OldXFibresInputSpec
966-
output_spec = OldXFibresOutputSpec
970+
input_spec = XFibres4InputSpec
971+
output_spec = XFibres4OutputSpec
967972

968973
def _run_interface(self, runtime):
969-
runtime = super(OldXFibres, self)._run_interface(runtime)
974+
runtime = super(XFibres4, self)._run_interface(runtime)
970975
if runtime.stderr:
971976
self.raise_exception(runtime)
972977
return runtime
@@ -992,7 +997,7 @@ def _list_outputs(self):
992997
return outputs
993998

994999

995-
class OldBEDPOSTXInputSpec(FSLCommandInputSpec):
1000+
class BEDPOSTX4InputSpec(FSLCommandInputSpec):
9961001
dwi = File(exists=True, desc='diffusion weighted image data file',
9971002
mandatory=True)
9981003
mask = File(exists=True, desc='bet binary mask file', mandatory=True)
@@ -1017,7 +1022,7 @@ class OldBEDPOSTXInputSpec(FSLCommandInputSpec):
10171022
'hardware/queue (if found)'))
10181023

10191024

1020-
class OldBEDPOSTXOutputSpec(TraitedSpec):
1025+
class BEDPOSTX4OutputSpec(TraitedSpec):
10211026
bpx_out_directory = Directory(exists=True,
10221027
desc='path/name of directory with all ' +
10231028
'bedpostx output files for this subject')
@@ -1044,7 +1049,7 @@ class OldBEDPOSTXOutputSpec(TraitedSpec):
10441049
dyads = traits.List(File(exists=True), desc='a list of path/name of mean of PDD distribution in vector form')
10451050

10461051

1047-
class OldBEDPOSTX(FSLCommand):
1052+
class BEDPOSTX4(FSLCommand):
10481053
"""
10491054
bedpostx has an old interface, implemented here
10501055
@@ -1061,21 +1066,22 @@ class OldBEDPOSTX(FSLCommand):
10611066
-------
10621067
10631068
>>> from nipype.interfaces import fsl
1064-
>>> bedp = fsl.OldBEDPOSTX(bpx_directory='subjdir', bvecs='bvecs', \
1069+
>>> bedp = fsl.BEDPOSTX4(bpx_directory='subjdir', bvecs='bvecs', \
10651070
bvals='bvals', dwi='diffusion.nii', mask='mask.nii', fibres=1)
10661071
>>> bedp.cmdline
10671072
'bedpostx subjdir -n 1'
10681073
10691074
"""
10701075

10711076
_cmd = 'bedpostx'
1072-
input_spec = OldBEDPOSTXInputSpec
1073-
output_spec = OldBEDPOSTXOutputSpec
1077+
input_spec = BEDPOSTX4InputSpec
1078+
output_spec = BEDPOSTX4OutputSpec
10741079
_can_resume = True
10751080

10761081
def __init__(self, **inputs):
1077-
warnings.warn("Deprecated: Please use create_bedpostx_pipeline instead", DeprecationWarning)
1078-
return super(OldBEDPOSTX, self).__init__(**inputs)
1082+
warnings.warn(('Deprecated: Please use BEDPOSTX5 or '
1083+
'create_bedpostx_pipeline instead'), DeprecationWarning)
1084+
return super(BEDPOSTX4, self).__init__(**inputs)
10791085

10801086
def _run_interface(self, runtime):
10811087

@@ -1097,7 +1103,7 @@ def _run_interface(self, runtime):
10971103
shutil.copyfile(self.inputs.bvecs,
10981104
os.path.join(self.inputs.bpx_directory, 'bvecs'))
10991105

1100-
runtime = super(BEDPOSTX, self)._run_interface(runtime)
1106+
runtime = super(BEDPOSTX4, self)._run_interface(runtime)
11011107
if runtime.stderr:
11021108
self.raise_exception(runtime)
11031109
return runtime
@@ -1138,3 +1144,33 @@ def _list_outputs(self):
11381144
suffix='',
11391145
cwd=outputs['bpx_out_directory']))
11401146
return outputs
1147+
1148+
1149+
class BEDPOSTX4GPU(BEDPOSTX4):
1150+
_cmd = 'bedpostx_gpu'
1151+
1152+
1153+
if (Info.version() and
1154+
LooseVersion(Info.version()) >= LooseVersion('5.0.0')):
1155+
CurrentXFibres = XFibres5
1156+
CurrentBEDPOST = BEDPOSTX5
1157+
CurrentBEDPOSTgpu = BEDPOSTX5GPU
1158+
else:
1159+
CurrentXFibres = XFibres4
1160+
CurrentBEDPOST = BEDPOSTX4
1161+
CurrentBEDPOSTgpu = BEDPOSTX4GPU
1162+
1163+
1164+
class XFibres(CurrentXFibres):
1165+
def __init__(self, **inputs):
1166+
return super(XFibres, self).__init__(**inputs)
1167+
1168+
1169+
class BEDPOSTX(CurrentBEDPOST):
1170+
def __init__(self, **inputs):
1171+
return super(BEDPOSTX, self).__init__(**inputs)
1172+
1173+
1174+
class BEDPOSTXGPU(CurrentBEDPOSTgpu):
1175+
def __init__(self, **inputs):
1176+
return super(BEDPOSTXGPU, self).__init__(**inputs)

nipype/interfaces/fsl/epi.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,11 @@ class EpiRegInputSpec(FSLCommandInputSpec):
566566
(use if fmap already registered)')
567567
no_clean = traits.Bool(False, argstr='--noclean',
568568
desc='do not clean up intermediate files')
569-
569+
570570

571571
class EpiRegOutputSpec(TraitedSpec):
572572
out_file = File(exists=True,
573-
desc='unwarped and coregistered epi input')
573+
desc='unwarped and coregistered epi input')
574574
out_1vol = File(exists=True,
575575
desc='unwarped and coregistered single volume')
576576
fmap2str_mat = File(exists=True,
@@ -596,7 +596,7 @@ class EpiRegOutputSpec(TraitedSpec):
596596
class EpiReg(FSLCommand):
597597
"""
598598
599-
Runs FSL epi_reg script for simultaneous coregistration and fieldmap
599+
Runs FSL epi_reg script for simultaneous coregistration and fieldmap
600600
unwarping.
601601
602602
Examples
@@ -618,7 +618,7 @@ class EpiReg(FSLCommand):
618618
--fmapmag=fieldmap_mag.nii --fmapmagbrain=fieldmap_mag_brain.nii --pedir=y \
619619
--epi=epi.nii --t1=T1.nii --t1brain=T1_brain.nii --out=epi2struct'
620620
>>> epireg.run() # doctest: +SKIP
621-
621+
622622
"""
623623
_cmd = 'epi_reg'
624624
input_spec = EpiRegInputSpec

0 commit comments

Comments
 (0)