25
25
from ..base import (OutputMultiPath , TraitedSpec , isdefined ,
26
26
traits , InputMultiPath , File )
27
27
from .base import (SPMCommand , scans_for_fname , func_is_3d ,
28
- scans_for_fnames , SPMCommandInputSpec )
28
+ scans_for_fnames , SPMCommandInputSpec , ImageFileSPM )
29
29
30
30
__docformat__ = 'restructuredtext'
31
31
32
32
33
+
33
34
class SliceTimingInputSpec (SPMCommandInputSpec ):
34
- in_files = InputMultiPath (traits .Either (traits .List (File (exists = True )),
35
- File (exists = True )), field = 'scans' ,
35
+ in_files = InputMultiPath (traits .Either (traits .List (ImageFileSPM (
36
+ exists = True )),
37
+ ImageFileSPM (exists = True )),
38
+ field = 'scans' ,
36
39
desc = 'list of filenames to apply slice timing' ,
37
40
mandatory = True , copyfile = False )
38
41
num_slices = traits .Int (field = 'nslices' ,
@@ -116,8 +119,9 @@ def _list_outputs(self):
116
119
117
120
118
121
class RealignInputSpec (SPMCommandInputSpec ):
119
- in_files = InputMultiPath (traits .Either (traits .List (File (exists = True )),
120
- File (exists = True )), field = 'data' ,
122
+ in_files = InputMultiPath (traits .Either (traits .List (
123
+ ImageFileSPM (exists = True )),
124
+ ImageFileSPM (exists = True )), field = 'data' ,
121
125
mandatory = True , copyfile = True ,
122
126
desc = 'list of filenames to realign' )
123
127
jobtype = traits .Enum ('estwrite' , 'estimate' , 'write' ,
@@ -270,11 +274,12 @@ def _list_outputs(self):
270
274
271
275
272
276
class CoregisterInputSpec (SPMCommandInputSpec ):
273
- target = File (exists = True , field = 'ref' , mandatory = True ,
274
- desc = 'reference file to register to' , copyfile = False )
275
- source = InputMultiPath (File (exists = True ), field = 'source' ,
276
- desc = 'file to register to target' , copyfile = True ,
277
- mandatory = True )
277
+ target = ImageFileSPM (exists = True , mandatory = True ,
278
+ field = 'ref' , desc = 'reference file to register to' ,
279
+ copyfile = False )
280
+ source = InputMultiPath (ImageFileSPM (exists = True ),
281
+ field = 'source' , desc = 'file to register to target' ,
282
+ copyfile = True , mandatory = True )
278
283
jobtype = traits .Enum ('estwrite' , 'estimate' , 'write' ,
279
284
desc = 'one of: estimate, write, estwrite' ,
280
285
usedefault = True )
@@ -392,9 +397,9 @@ class NormalizeInputSpec(SPMCommandInputSpec):
392
397
desc = 'template file to normalize to' ,
393
398
mandatory = True , xor = ['parameter_file' ],
394
399
copyfile = False )
395
- source = InputMultiPath (File (exists = True ), field = 'subj.source' ,
400
+ source = InputMultiPath (ImageFileSPM (exists = True ),
401
+ field = 'subj.source' , xor = ['parameter_file' ],
396
402
desc = 'file to normalize to template' ,
397
- xor = ['parameter_file' ],
398
403
mandatory = True , copyfile = True )
399
404
jobtype = traits .Enum ('estwrite' , 'est' , 'write' , usedefault = True ,
400
405
desc = 'Estimate, Write or do both' )
@@ -555,22 +560,22 @@ def _list_outputs(self):
555
560
556
561
557
562
class Normalize12InputSpec (SPMCommandInputSpec ):
558
- image_to_align = File (exists = True , field = 'subj.vol' ,
563
+ image_to_align = ImageFileSPM (exists = True , field = 'subj.vol' ,
559
564
desc = ('file to estimate normalization parameters '
560
565
'with' ),
561
566
xor = ['deformation_file' ],
562
567
mandatory = True , copyfile = True )
563
568
apply_to_files = InputMultiPath (
564
- traits .Either (File (exists = True ), traits .List (File (exists = True ))),
569
+ traits .Either (ImageFileSPM (exists = True ),
570
+ traits .List (ImageFileSPM (exists = True ))),
565
571
field = 'subj.resample' ,
566
572
desc = 'files to apply transformation to' ,
567
573
copyfile = True )
568
- deformation_file = File (field = 'subj.def' , mandatory = True ,
569
- xor = ['image_to_align' , 'tpm' ],
574
+ deformation_file = ImageFileSPM (field = 'subj.def' , mandatory = True ,
575
+ xor = ['image_to_align' , 'tpm' ], copyfile = False ,
570
576
desc = ('file y_*.nii containing 3 deformation '
571
577
'fields for the deformation in x, y and z '
572
- 'dimension' ),
573
- copyfile = False )
578
+ 'dimension' ))
574
579
jobtype = traits .Enum ('estwrite' , 'est' , 'write' , usedefault = True ,
575
580
desc = 'Estimate, Write or do Both' )
576
581
bias_regularization = traits .Enum (0 , 0.00001 , 0.0001 , 0.001 , 0.01 , 0.1 , 1 ,
@@ -721,7 +726,7 @@ def _list_outputs(self):
721
726
722
727
723
728
class SegmentInputSpec (SPMCommandInputSpec ):
724
- data = InputMultiPath (File (exists = True ), field = 'data' ,
729
+ data = InputMultiPath (ImageFileSPM (exists = True ), field = 'data' ,
725
730
desc = 'one scan per subject' ,
726
731
copyfile = False , mandatory = True )
727
732
gm_output_type = traits .List (traits .Bool (), minlen = 3 , maxlen = 3 ,
@@ -890,10 +895,9 @@ def _list_outputs(self):
890
895
891
896
892
897
class NewSegmentInputSpec (SPMCommandInputSpec ):
893
- channel_files = InputMultiPath (File (exists = True ),
898
+ channel_files = InputMultiPath (ImageFileSPM (exists = True ), mandatory = True ,
894
899
desc = "A list of files to be segmented" ,
895
- field = 'channel' , copyfile = False ,
896
- mandatory = True )
900
+ field = 'channel' , copyfile = False )
897
901
channel_info = traits .Tuple (traits .Float (), traits .Float (),
898
902
traits .Tuple (traits .Bool , traits .Bool ),
899
903
desc = """A tuple with the following fields:
@@ -902,7 +906,7 @@ class NewSegmentInputSpec(SPMCommandInputSpec):
902
906
- which maps to save (Corrected, Field) - a tuple of two boolean values""" ,
903
907
field = 'channel' )
904
908
tissues = traits .List (
905
- traits .Tuple (traits .Tuple (File (exists = True ), traits .Int ()),
909
+ traits .Tuple (traits .Tuple (ImageFileSPM (exists = True ),traits .Int ()),
906
910
traits .Int (), traits .Tuple (traits .Bool , traits .Bool ),
907
911
traits .Tuple (traits .Bool , traits .Bool )),
908
912
desc = """A list of tuples (one per tissue) with the following fields:
@@ -1093,8 +1097,8 @@ def _list_outputs(self):
1093
1097
1094
1098
1095
1099
class SmoothInputSpec (SPMCommandInputSpec ):
1096
- in_files = InputMultiPath (File (exists = True ), field = 'data' ,
1097
- desc = 'list of files to smooth' ,
1100
+ in_files = InputMultiPath (ImageFileSPM (exists = True ),
1101
+ field = 'data' , desc = 'list of files to smooth' ,
1098
1102
mandatory = True , copyfile = False )
1099
1103
fwhm = traits .Either (traits .List (traits .Float (), minlen = 3 , maxlen = 3 ),
1100
1104
traits .Float (), field = 'fwhm' ,
@@ -1156,7 +1160,7 @@ def _list_outputs(self):
1156
1160
1157
1161
1158
1162
class DARTELInputSpec (SPMCommandInputSpec ):
1159
- image_files = traits .List (traits .List (File (exists = True )),
1163
+ image_files = traits .List (traits .List (ImageFileSPM (exists = True )),
1160
1164
desc = "A list of files to be segmented" ,
1161
1165
field = 'warp.images' , copyfile = False ,
1162
1166
mandatory = True )
@@ -1272,15 +1276,12 @@ def _list_outputs(self):
1272
1276
1273
1277
1274
1278
class DARTELNorm2MNIInputSpec (SPMCommandInputSpec ):
1275
- template_file = File (exists = True ,
1276
- desc = "DARTEL template" ,
1277
- field = 'mni_norm.template' , copyfile = False ,
1278
- mandatory = True )
1279
- flowfield_files = InputMultiPath (File (exists = True ),
1279
+ template_file = ImageFileSPM (exists = True , copyfile = False , mandatory = True ,
1280
+ desc = "DARTEL template" , field = 'mni_norm.template' )
1281
+ flowfield_files = InputMultiPath (ImageFileSPM (exists = True ), mandatory = True ,
1280
1282
desc = "DARTEL flow fields u_rc1*" ,
1281
- field = 'mni_norm.data.subjs.flowfields' ,
1282
- mandatory = True )
1283
- apply_to_files = InputMultiPath (File (exists = True ),
1283
+ field = 'mni_norm.data.subjs.flowfields' )
1284
+ apply_to_files = InputMultiPath (ImageFileSPM (exists = True ),
1284
1285
desc = "Files to apply the transform to" ,
1285
1286
field = 'mni_norm.data.subjs.images' ,
1286
1287
mandatory = True , copyfile = False )
@@ -1370,14 +1371,12 @@ def _list_outputs(self):
1370
1371
1371
1372
1372
1373
class CreateWarpedInputSpec (SPMCommandInputSpec ):
1373
- image_files = InputMultiPath (File (exists = True ),
1374
+ image_files = InputMultiPath (ImageFileSPM (exists = True ), mandatory = True ,
1374
1375
desc = "A list of files to be warped" ,
1375
- field = 'crt_warped.images' , copyfile = False ,
1376
- mandatory = True )
1377
- flowfield_files = InputMultiPath (File (exists = True ),
1376
+ field = 'crt_warped.images' , copyfile = False )
1377
+ flowfield_files = InputMultiPath (ImageFileSPM (exists = True ), copyfile = False ,
1378
1378
desc = "DARTEL flow fields u_rc1*" ,
1379
1379
field = 'crt_warped.flowfields' ,
1380
- copyfile = False ,
1381
1380
mandatory = True )
1382
1381
iterations = traits .Range (low = 0 , high = 9 ,
1383
1382
desc = ("The number of iterations: log2(number of "
@@ -1440,10 +1439,10 @@ def _list_outputs(self):
1440
1439
1441
1440
1442
1441
class ApplyDeformationFieldInputSpec (SPMCommandInputSpec ):
1443
- in_files = InputMultiPath (File (exists = True ), mandatory = True ,
1444
- field = 'fnames' )
1442
+ in_files = InputMultiPath (ImageFileSPM (exists = True ),
1443
+ mandatory = True , field = 'fnames' )
1445
1444
deformation_field = File (exists = True , mandatory = True , field = 'comp{1}.def' )
1446
- reference_volume = File (exists = True , mandatory = True ,
1445
+ reference_volume = ImageFileSPM (exists = True , mandatory = True ,
1447
1446
field = 'comp{2}.id.space' )
1448
1447
interp = traits .Range (low = 0 , high = 7 , field = 'interp' ,
1449
1448
desc = 'degree of b-spline used for interpolation' )
@@ -1486,13 +1485,12 @@ def _list_outputs(self):
1486
1485
class VBMSegmentInputSpec (SPMCommandInputSpec ):
1487
1486
1488
1487
in_files = InputMultiPath (
1489
- File (exists = True ),
1488
+ ImageFileSPM (exists = True ),
1490
1489
desc = "A list of files to be segmented" ,
1491
1490
field = 'estwrite.data' , copyfile = False , mandatory = True )
1492
1491
1493
- tissues = File (
1494
- exists = True , field = 'estwrite.tpm' ,
1495
- desc = 'tissue probability map' )
1492
+ tissues = ImageFileSPM (
1493
+ exists = True , field = 'estwrite.tpm' , desc = 'tissue probability map' )
1496
1494
gaussians_per_class = traits .Tuple (
1497
1495
(2 , 2 , 2 , 3 , 4 , 2 ), * ([traits .Int ()] * 6 ),
1498
1496
usedefault = True ,
@@ -1518,7 +1516,7 @@ class VBMSegmentInputSpec(SPMCommandInputSpec):
1518
1516
1519
1517
spatial_normalization = traits .Enum (
1520
1518
'high' , 'low' , usedefault = True ,)
1521
- dartel_template = File (
1519
+ dartel_template = ImageFileSPM (
1522
1520
exists = True ,
1523
1521
field = 'estwrite.extopts.dartelwarp.normhigh.darteltpm' )
1524
1522
use_sanlm_denoising_filter = traits .Range (
0 commit comments