1
+ """This script provides interfaces for BrainSuite command line tools.
2
+ Please see brainsuite.org for more information.
3
+
4
+ Author: Jason Wong
5
+ """
6
+
1
7
import os
2
8
import re as regex
3
9
@@ -85,18 +91,12 @@ def _gen_filename(self, name):
85
91
if isdefined (inputs [name ]):
86
92
return os .path .abspath (inputs [name ])
87
93
88
- genfiles = {'outputMRIVolume' : '.bse.nii.gz' ,
94
+ fileToSuffixMap = {'outputMRIVolume' : '.bse.nii.gz' ,
89
95
'outputMaskFile' : '.mask.nii.gz'
90
96
}
91
97
92
- if name in genfiles :
93
- return getFileName (self .inputs .inputMRIFile , genfiles [name ])
94
-
95
- '''if name == 'outputMRIVolume':
96
- return getFileName(self.inputs.inputMRIFile, name, '.nii.gz')
97
- if name == 'outputMaskFile':
98
- return getFileName(self.inputs.inputMRIFile, name, '.nii.gz')
99
- '''
98
+ if name in fileToSuffixMap :
99
+ return getFileName (self .inputs .inputMRIFile , fileToSuffixMap [name ])
100
100
101
101
return None
102
102
@@ -201,13 +201,9 @@ def _gen_filename(self, name):
201
201
if isdefined (inputs [name ]):
202
202
return os .path .abspath (inputs [name ])
203
203
204
- genfiles = {'outputMRIVolume' : '.bfc.nii.gz' }
205
- if name in genfiles :
206
- return getFileName (self .inputs .inputMRIFile , genfiles [name ])
207
-
208
- '''if name == 'outputMRIVolume':
209
- return getFileName(self.inputs.inputMRIFile, name, '.nii.gz')
210
- '''
204
+ fileToSuffixMap = {'outputMRIVolume' : '.bfc.nii.gz' }
205
+ if name in fileToSuffixMap :
206
+ return getFileName (self .inputs .inputMRIFile , fileToSuffixMap [name ])
211
207
212
208
return None
213
209
@@ -271,14 +267,11 @@ def _gen_filename(self, name):
271
267
if isdefined (inputs [name ]):
272
268
return os .path .abspath (inputs [name ])
273
269
274
- genfiles = {'outputLabelFile' : '.pvc.label.nii.gz' ,
270
+ fileToSuffixMap = {'outputLabelFile' : '.pvc.label.nii.gz' ,
275
271
'outputTissueFractionFile' : '.pvc.frac.nii.gz'
276
272
}
277
- if name in genfiles :
278
- return getFileName (self .inputs .inputMRIFile , genfiles [name ])
279
- '''
280
- if name == 'outputLabelFile' or name == 'outputTissueFractionFile':
281
- return getFileName(self.inputs.inputMRIFile, name, '.nii.gz')'''
273
+ if name in fileToSuffixMap :
274
+ return getFileName (self .inputs .inputMRIFile , fileToSuffixMap [name ])
282
275
283
276
return None
284
277
@@ -359,16 +352,13 @@ def _gen_filename(self, name):
359
352
if isdefined (inputs [name ]):
360
353
return os .path .abspath (inputs [name ])
361
354
362
- genfiles = {'outputCerebrumMaskFile' : '.cerebrum.mask.nii.gz' ,
355
+ fileToSuffixMap = {'outputCerebrumMaskFile' : '.cerebrum.mask.nii.gz' ,
363
356
'outputLabelVolumeFile' : '.hemi.label.nii.gz' ,
364
357
'outputWarpTransformFile' : '.warp' ,
365
358
'outputAffineTransformFile' : '.air'
366
359
}
367
- if name in genfiles :
368
- return getFileName (self .inputs .inputMRIFile , genfiles [name ])
369
- '''
370
- if name == 'outputCerebrumMaskFile' or name == 'outputLabelVolumeFile':
371
- return getFileName(self.inputs.inputMRIFile, name, '.nii.gz')'''
360
+ if name in fileToSuffixMap :
361
+ return getFileName (self .inputs .inputMRIFile , fileToSuffixMap [name ])
372
362
373
363
return None
374
364
@@ -811,20 +801,14 @@ def _gen_filename(self, name):
811
801
if isdefined (inputs [name ]):
812
802
return os .path .abspath (inputs [name ])
813
803
814
- genfiles = {
804
+ fileToSuffixMap = {
815
805
'outputLeftHemisphere' : '.left.inner.cortex.dfs' ,
816
806
'outputLeftPialHemisphere' : '.left.pial.cortex.dfs' ,
817
807
'outputRightHemisphere' : '.right.inner.cortex.dfs' ,
818
808
'outputRightPialHemisphere' : '.right.pial.cortex.dfs'
819
809
}
820
- if name in genfiles :
821
- return getFileName (self .inputs .inputSurfaceFile , genfiles [name ])
822
- '''
823
- if (name == 'outputLeftHemisphere'
824
- or name == 'outputRightHemisphere'
825
- or name == 'outputLeftPialHemisphere'
826
- or name == 'outputRightPialHemisphere'):
827
- return getFileName(self.inputs.inputSurfaceFile, name, '.dfs')'''
810
+ if name in fileToSuffixMap :
811
+ return getFileName (self .inputs .inputSurfaceFile , fileToSuffixMap [name ])
828
812
829
813
return None
830
814
@@ -1010,6 +994,10 @@ class SVRegInputSpec(CommandLineInputSpec):
1010
994
desc = 'If multiple CPUs are present on the system, the code will try to use '
1011
995
'multithreading to make the execution fast.'
1012
996
)
997
+ useSingleThreading = traits .Bool (
998
+ argstr = '\' -U\' ' ,
999
+ desc = 'Use single threaded mode.'
1000
+ )
1013
1001
1014
1002
class SVReg (CommandLine ):
1015
1003
"""
@@ -1031,6 +1019,7 @@ class SVReg(CommandLine):
1031
1019
>>> svreg.inputs. keepIntermediates = True
1032
1020
>>> svreg.inputs.verbosity2 = True
1033
1021
>>> svreg.inputs.displayTimestamps = True
1022
+ >>> svreg.inputs.useSingleThreading = True
1034
1023
>>> results = svreg.run() #doctest: +SKIP
1035
1024
1036
1025
@@ -1040,6 +1029,8 @@ class SVReg(CommandLine):
1040
1029
_cmd = 'svreg.sh'
1041
1030
1042
1031
def _format_arg (self , name , spec , value ):
1032
+ if name == 'subjectFilePrefix' or name == 'atlasFilePrefix' or name == 'curveMatchingInstructions' :
1033
+ return spec .argstr % os .path .expanduser (value )
1043
1034
if name == 'dataSinkDelay' :
1044
1035
return spec .argstr % ''
1045
1036
return super (SVReg , self )._format_arg (name , spec , value )
@@ -1156,10 +1147,9 @@ class BDPInputSpec(CommandLineInputSpec):
1156
1147
'The derived generalized-FA (GFA) maps are also saved in the output '
1157
1148
'directory. '
1158
1149
)
1159
- estimateODF_Both = traits .Bool (
1160
- argstr = '--odf' ,
1161
- desc = 'Same as setting both estimateODF_FRT and estimateODF_FRACT to true. Estimates ODFs using both '
1162
- 'FRT and FRACT. '
1150
+ estimateODF_3DShore = traits .Float (
1151
+ argstr = '--3dshore --diffusion_time_ms %f' ,
1152
+ desc = 'Estimates ODFs using 3Dshore. Pass in diffusion time, in ms'
1163
1153
)
1164
1154
odfLambta = traits .Bool (
1165
1155
argstr = '--odf-lambda <L>' ,
@@ -1529,8 +1519,8 @@ class BDP(CommandLine):
1529
1519
BrainSuite Diffusion Pipeline (BDP) enables fusion of diffusion and
1530
1520
structural MRI information for advanced image and connectivity analysis.
1531
1521
It provides various methods for distortion correction, co-registration,
1532
- diffusion modeling (DTI and ODF) and basic ROI-wise statistic. BDP is
1533
- lexible and diverse tool which supports wide variety of diffusion
1522
+ diffusion modeling (DTI and ODF) and basic ROI-wise statistic. BDP is a
1523
+ flexible and diverse tool which supports wide variety of diffusion
1534
1524
datasets.
1535
1525
For more information, please see:
1536
1526
@@ -1559,7 +1549,38 @@ def _format_arg(self, name, spec, value):
1559
1549
return spec .argstr % ''
1560
1550
return super (BDP , self )._format_arg (name , spec , value )
1561
1551
1552
+
1553
+ class ThicknessPVCInputSpec (CommandLineInputSpec ):
1554
+ subjectFilePrefix = traits .Str (
1555
+ argstr = '%s' , mandatory = True ,
1556
+ desc = 'Absolute path and filename prefix of the subject data'
1557
+ )
1562
1558
1559
+ class ThicknessPVC (CommandLine ):
1560
+ """
1561
+ ThicknessPVC computes cortical thickness using partial tissue fractions.
1562
+ This thickness measure is then transferred to the atlas surface to
1563
+ facilitate population studies. It also stores the computed thickness into
1564
+ separate hemisphere files and subject thickness mapped to the atlas
1565
+ hemisphere surfaces. ThicknessPVC is not run through the main SVReg
1566
+ sequence, and should be used after executing the BrainSuite and SVReg
1567
+ sequence.
1568
+ For more informaction, please see:
1569
+
1570
+ http://brainsuite.org/processing/svreg/svreg_modules/
1571
+
1572
+ Examples
1573
+ --------
1574
+
1575
+ >>> from nipype.interfaces import brainsuite
1576
+ >>> thicknessPVC = brainsuite.ThicknessPVC()
1577
+ >>> thicknessPVC.inputs.subjectFilePrefix = 'home/user/btestsubject/testsubject'
1578
+ >>> results = thicknessPVC.run() #doctest: +SKIP
1579
+
1580
+ """
1581
+
1582
+ input_spec = ThicknessPVCInputSpec
1583
+ _cmd = 'thicknessPVC.sh'
1563
1584
1564
1585
1565
1586
# used to generate file names for outputs
@@ -1579,4 +1600,4 @@ def l_outputs(self):
1579
1600
if not name is None :
1580
1601
outputs [key ] = name
1581
1602
1582
- return outputs
1603
+ return outputs
0 commit comments