Skip to content

Commit 56d5058

Browse files
committed
Updates to BrainSuite interfaces. Add BDP, SVReg, and ThicknessPVC interfaces. Ran make specs, and make-check-before-commit.
1 parent 2cd0deb commit 56d5058

File tree

6 files changed

+264
-34
lines changed

6 files changed

+264
-34
lines changed

nipype/interfaces/brainsuite/brainsuite.py

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,14 @@ def _gen_filename(self, name):
9090
inputs = self.inputs.get()
9191
if isdefined(inputs[name]):
9292
return os.path.abspath(inputs[name])
93-
93+
9494
fileToSuffixMap = {'outputMRIVolume' : '.bse.nii.gz',
9595
'outputMaskFile' : '.mask.nii.gz'
9696
}
97-
97+
9898
if name in fileToSuffixMap:
9999
return getFileName(self.inputs.inputMRIFile, fileToSuffixMap[name])
100-
100+
101101
return None
102102

103103
def _list_outputs(self):
@@ -125,7 +125,7 @@ class BfcInputSpec(CommandLineInputSpec):
125125
splineLambda = traits.Float(
126126
desc='spline stiffness weighting parameter', argstr='-w %f')
127127
histogramType = traits.Enum(
128-
'ellipse', 'block', desc='Options for type of histogram\nellipse: use ellipsoid for ROI histogram\nblock :use block for ROI histogram',
128+
'ellipse', 'block', desc='Options for type of histogram\nellipse: use ellipsoid for ROI histogram\nblock :use block for ROI histogram',
129129
argstr='%s')
130130
iterativeMode = traits.Bool(
131131
desc='iterative mode (overrides -r, -s, -c, -w settings)', argstr='--iterate')
@@ -200,11 +200,11 @@ def _gen_filename(self, name):
200200
inputs = self.inputs.get()
201201
if isdefined(inputs[name]):
202202
return os.path.abspath(inputs[name])
203-
203+
204204
fileToSuffixMap = {'outputMRIVolume': '.bfc.nii.gz'}
205205
if name in fileToSuffixMap:
206206
return getFileName(self.inputs.inputMRIFile, fileToSuffixMap[name])
207-
207+
208208
return None
209209

210210
def _format_arg(self, name, spec, value):
@@ -351,7 +351,7 @@ def _gen_filename(self, name):
351351
inputs = self.inputs.get()
352352
if isdefined(inputs[name]):
353353
return os.path.abspath(inputs[name])
354-
354+
355355
fileToSuffixMap = {'outputCerebrumMaskFile' : '.cerebrum.mask.nii.gz',
356356
'outputLabelVolumeFile' : '.hemi.label.nii.gz',
357357
'outputWarpTransformFile' : '.warp',
@@ -881,18 +881,18 @@ def _gen_filename(self, name):
881881
def _list_outputs(self):
882882
return l_outputs(self)
883883

884-
885-
884+
885+
886886
class SVRegInputSpec(CommandLineInputSpec):
887887
subjectFilePrefix = traits.Str(
888-
argstr='\'%s\'', mandatory=True, position=0,
888+
argstr='\'%s\'', mandatory=True, position=0,
889889
desc='Absolute path and filename prefix of the subjects output from BrainSuite '
890890
'Cortical Surface Extraction Sequence'
891891
)
892892
dataSinkDelay = traits.List(
893-
str, argstr='%s',
893+
str, argstr='%s',
894894
desc='Connect datasink out_file to dataSinkDelay to delay execution of SVReg '
895-
'until dataSink has finished sinking CSE outputs.'
895+
'until dataSink has finished sinking CSE outputs.'
896896
'For use with parallel processing workflows including Brainsuites Cortical '
897897
'Surface Extraction sequence (SVReg requires certain files from Brainsuite '
898898
'CSE, which must all be in the pathway specified by subjectFilePrefix. see '
@@ -998,16 +998,16 @@ class SVRegInputSpec(CommandLineInputSpec):
998998
argstr='\'-U\'',
999999
desc='Use single threaded mode.'
10001000
)
1001-
1001+
10021002
class SVReg(CommandLine):
10031003
"""
10041004
surface and volume registration (svreg)
10051005
This program registers a subject's BrainSuite-processed volume and surfaces
10061006
to an atlas, allowing for automatic labelling of volume and surface ROIs.
1007-
1007+
10081008
For more information, please see:
10091009
http://brainsuite.org/processing/svreg/usage/
1010-
1010+
10111011
Examples
10121012
--------
10131013
@@ -1022,12 +1022,12 @@ class SVReg(CommandLine):
10221022
>>> svreg.inputs.useSingleThreading = True
10231023
>>> results = svreg.run() #doctest: +SKIP
10241024
1025-
1025+
10261026
"""
1027-
1027+
10281028
input_spec = SVRegInputSpec
10291029
_cmd = 'svreg.sh'
1030-
1030+
10311031
def _format_arg(self, name, spec, value):
10321032
if name == 'subjectFilePrefix' or name == 'atlasFilePrefix' or name == 'curveMatchingInstructions':
10331033
return spec.argstr % os.path.expanduser(value)
@@ -1086,7 +1086,7 @@ class BDPInputSpec(CommandLineInputSpec):
10861086
'usually has an extension of .bvec '
10871087
)
10881088
dataSinkDelay = traits.List(
1089-
str, argstr='%s',
1089+
str, argstr='%s',
10901090
desc='For use in parallel processing workflows including Brainsuite Cortical '
10911091
'Surface Extraction sequence. Connect datasink out_file to dataSinkDelay '
10921092
'to delay execution of BDP until dataSink has finished sinking outputs. '
@@ -1513,7 +1513,7 @@ class BDPInputSpec(CommandLineInputSpec):
15131513
'on machines with a low amount of memory. This may result in an '
15141514
'out-of-memory error when BDP cannot allocate sufficient memory. '
15151515
)
1516-
1516+
15171517
class BDP(CommandLine):
15181518
"""
15191519
BrainSuite Diffusion Pipeline (BDP) enables fusion of diffusion and
@@ -1523,7 +1523,7 @@ class BDP(CommandLine):
15231523
flexible and diverse tool which supports wide variety of diffusion
15241524
datasets.
15251525
For more information, please see:
1526-
1526+
15271527
http://brainsuite.org/processing/diffusion/
15281528
15291529
Examples
@@ -1535,13 +1535,13 @@ class BDP(CommandLine):
15351535
>>> bdp.inputs.inputDiffusionData = '/directory/subdir/prefix.dwi.nii.gz'
15361536
>>> bdp.inputs.BVecBValPair = ['/directory/subdir/prefix.dwi.bvec', '/directory/subdir/prefix.dwi.bval']
15371537
>>> results = bdp.run() #doctest: +SKIP
1538-
1539-
1538+
1539+
15401540
"""
15411541

15421542
input_spec = BDPInputSpec
15431543
_cmd = 'bdp.sh'
1544-
1544+
15451545
def _format_arg(self, name, spec, value):
15461546
if name == 'BVecBValPair':
15471547
return spec.argstr % (value[0], value[1])
@@ -1555,30 +1555,30 @@ class ThicknessPVCInputSpec(CommandLineInputSpec):
15551555
argstr='%s', mandatory=True,
15561556
desc='Absolute path and filename prefix of the subject data'
15571557
)
1558-
1558+
15591559
class ThicknessPVC(CommandLine):
15601560
"""
15611561
ThicknessPVC computes cortical thickness using partial tissue fractions.
1562-
This thickness measure is then transferred to the atlas surface to
1562+
This thickness measure is then transferred to the atlas surface to
15631563
facilitate population studies. It also stores the computed thickness into
15641564
separate hemisphere files and subject thickness mapped to the atlas
15651565
hemisphere surfaces. ThicknessPVC is not run through the main SVReg
1566-
sequence, and should be used after executing the BrainSuite and SVReg
1566+
sequence, and should be used after executing the BrainSuite and SVReg
15671567
sequence.
15681568
For more informaction, please see:
1569-
1569+
15701570
http://brainsuite.org/processing/svreg/svreg_modules/
1571-
1571+
15721572
Examples
15731573
--------
1574-
1574+
15751575
>>> from nipype.interfaces import brainsuite
15761576
>>> thicknessPVC = brainsuite.ThicknessPVC()
15771577
>>> thicknessPVC.inputs.subjectFilePrefix = 'home/user/btestsubject/testsubject'
15781578
>>> results = thicknessPVC.run() #doctest: +SKIP
1579-
1579+
15801580
"""
1581-
1581+
15821582
input_spec = ThicknessPVCInputSpec
15831583
_cmd = 'thicknessPVC.sh'
15841584

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
2+
from ....testing import assert_equal
3+
from ..brainsuite import BDP
4+
5+
6+
def test_BDP_inputs():
7+
input_map = dict(BVecBValPair=dict(argstr='--bvec %s --bval %s',
8+
mandatory=True,
9+
position=-1,
10+
xor=['bMatrixFile'],
11+
),
12+
args=dict(argstr='%s',
13+
),
14+
bMatrixFile=dict(argstr='--bmat %s',
15+
mandatory=True,
16+
position=-1,
17+
xor=['BVecBValPair'],
18+
),
19+
bValRatioThreshold=dict(argstr='--bval-ratio-threshold %f',
20+
),
21+
bfcFile=dict(argstr='%s',
22+
mandatory=True,
23+
position=0,
24+
xor=['noStructuralRegistration'],
25+
),
26+
customDiffusionLabel=dict(argstr='--custom-diffusion-label %s',
27+
),
28+
customLabelXML=dict(argstr='--custom-label-xml %s',
29+
),
30+
customT1Label=dict(argstr='--custom-t1-label %s',
31+
),
32+
dataSinkDelay=dict(argstr='%s',
33+
),
34+
dcorrRegMeasure=dict(argstr='--dcorr-reg-method %s',
35+
),
36+
dcorrWeight=dict(argstr='--dcorr-regularization-wt %f',
37+
),
38+
dwiMask=dict(argstr='--dwi-mask %s',
39+
),
40+
echoSpacing=dict(argstr='--echo-spacing=%f',
41+
),
42+
environ=dict(nohash=True,
43+
usedefault=True,
44+
),
45+
estimateODF_3DShore=dict(argstr='--3dshore --diffusion_time_ms %f',
46+
),
47+
estimateODF_FRACT=dict(argstr='--FRACT',
48+
),
49+
estimateODF_FRT=dict(argstr='--FRT',
50+
),
51+
estimateTensors=dict(argstr='--tensors',
52+
),
53+
fieldmapCorrection=dict(argstr='--fieldmap-correction %s',
54+
requires=['echoSpacing'],
55+
),
56+
fieldmapCorrectionMethod=dict(argstr='--fieldmap-correction-method %s',
57+
xor=['skipIntensityCorr'],
58+
),
59+
fieldmapSmooth=dict(argstr='--fieldmap-smooth3=%f',
60+
),
61+
flagConfigFile=dict(argstr='--flag-conf-file %s',
62+
),
63+
forcePartialROIStats=dict(argstr='--force-partial-roi-stats',
64+
),
65+
generateStats=dict(argstr='--generate-stats',
66+
),
67+
ignoreFieldmapFOV=dict(argstr='--ignore-fieldmap-fov',
68+
),
69+
ignoreMemory=dict(argstr='--ignore-memory',
70+
),
71+
ignore_exception=dict(nohash=True,
72+
usedefault=True,
73+
),
74+
inputDiffusionData=dict(argstr='--nii %s',
75+
mandatory=True,
76+
position=-2,
77+
),
78+
lowMemory=dict(argstr='--low-memory',
79+
),
80+
noStructuralRegistration=dict(argstr='--no-structural-registration',
81+
mandatory=True,
82+
position=0,
83+
xor=['bfcFile'],
84+
),
85+
odfLambta=dict(argstr='--odf-lambda <L>',
86+
),
87+
onlyStats=dict(argstr='--generate-only-stats',
88+
),
89+
outPrefix=dict(argstr='--output-fileprefix %s',
90+
),
91+
outputDiffusionCoordinates=dict(argstr='--output-diffusion-coordinate',
92+
),
93+
outputSubdir=dict(argstr='--output-subdir %s',
94+
),
95+
phaseEncodingDirection=dict(argstr='--dir=%s',
96+
),
97+
rigidRegMeasure=dict(argstr='--rigid-reg-measure %s',
98+
),
99+
skipDistortionCorr=dict(argstr='--no-distortion-correction',
100+
),
101+
skipIntensityCorr=dict(argstr='--no-intensity-correction',
102+
xor=['fieldmapCorrectionMethod'],
103+
),
104+
skipNonuniformityCorr=dict(argstr='--no-nonuniformity-correction',
105+
),
106+
t1Mask=dict(argstr='--t1-mask %s',
107+
),
108+
terminal_output=dict(nohash=True,
109+
),
110+
threads=dict(argstr='--threads=%d',
111+
),
112+
transformDataOnly=dict(argstr='--transform-data-only',
113+
),
114+
transformDiffusionSurface=dict(argstr='--transform-diffusion-surface %s',
115+
),
116+
transformDiffusionVolume=dict(argstr='--transform-diffusion-volume %s',
117+
),
118+
transformInterpolation=dict(argstr='--transform-interpolation %s',
119+
),
120+
transformT1Surface=dict(argstr='--transform-t1-surface %s',
121+
),
122+
transformT1Volume=dict(argstr='--transform-t1-volume %s',
123+
),
124+
)
125+
inputs = BDP.input_spec()
126+
127+
for key, metadata in list(input_map.items()):
128+
for metakey, value in list(metadata.items()):
129+
yield assert_equal, getattr(inputs.traits()[key], metakey), value
130+

nipype/interfaces/brainsuite/tests/test_auto_Bse.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def test_Bse_inputs():
4646
hash_files=False,
4747
),
4848
outputMaskFile=dict(argstr='--mask %s',
49+
genfile=True,
4950
hash_files=False,
5051
),
5152
radius=dict(argstr='-r %f',

nipype/interfaces/brainsuite/tests/test_auto_Cerebro.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ def test_Cerebro_inputs():
3131
linearConvergence=dict(argstr='--linconv %f',
3232
),
3333
outputAffineTransformFile=dict(argstr='--air %s',
34+
genfile=True,
3435
),
3536
outputCerebrumMaskFile=dict(argstr='-o %s',
3637
genfile=True,
3738
),
38-
outputLabelMaskFile=dict(argstr='-l %s',
39+
outputLabelVolumeFile=dict(argstr='-l %s',
3940
genfile=True,
4041
),
4142
outputWarpTransformFile=dict(argstr='--warp %s',
43+
genfile=True,
4244
),
4345
tempDirectory=dict(argstr='--tempdir %s',
4446
),
@@ -65,7 +67,7 @@ def test_Cerebro_inputs():
6567
def test_Cerebro_outputs():
6668
output_map = dict(outputAffineTransformFile=dict(),
6769
outputCerebrumMaskFile=dict(),
68-
outputLabelMaskFile=dict(),
70+
outputLabelVolumeFile=dict(),
6971
outputWarpTransformFile=dict(),
7072
)
7173
outputs = Cerebro.output_spec()

0 commit comments

Comments
 (0)