23
23
from ...utils .filemanip import (fname_presuffix , filename_to_list ,
24
24
list_to_filename , split_filename )
25
25
from ..base import (OutputMultiPath , TraitedSpec , isdefined ,
26
- traits , InputMultiPath , File , ImageFile )
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
34
class SliceTimingInputSpec (SPMCommandInputSpec ):
35
- in_files = InputMultiPath (traits .Either (traits .List (ImageFile (
36
- exists = True ,
37
- compressed = False )),
38
- ImageFile (exists = True ,
39
- compressed = False )),
35
+ in_files = InputMultiPath (traits .Either (traits .List (ImageFileSPM (
36
+ exists = True )),
37
+ ImageFileSPM (exists = True ),
40
38
field = 'scans' ,
41
39
desc = 'list of filenames to apply slice timing' ,
42
40
mandatory = True , copyfile = False )
@@ -121,10 +119,9 @@ def _list_outputs(self):
121
119
122
120
123
121
class RealignInputSpec (SPMCommandInputSpec ):
124
- in_files = InputMultiPath (traits .Either (traits .List (ImageFile (exists = True ,
125
- compressed = False )),
126
- ImageFile (exists = True ,
127
- compressed = False )), field = 'data' ,
122
+ in_files = InputMultiPath (traits .Either (traits .List (
123
+ ImageFileSPM (exists = True )),
124
+ ImageFileSPM (exists = True )), field = 'data' ,
128
125
mandatory = True , copyfile = True ,
129
126
desc = 'list of filenames to realign' )
130
127
jobtype = traits .Enum ('estwrite' , 'estimate' , 'write' ,
@@ -277,10 +274,10 @@ def _list_outputs(self):
277
274
278
275
279
276
class CoregisterInputSpec (SPMCommandInputSpec ):
280
- target = ImageFile (exists = True , compressed = False , mandatory = True ,
277
+ target = ImageFileSPM (exists = True , mandatory = True ,
281
278
field = 'ref' , desc = 'reference file to register to' ,
282
279
copyfile = False )
283
- source = InputMultiPath (ImageFile (exists = True , compressed = False ),
280
+ source = InputMultiPath (ImageFileSPM (exists = True ),
284
281
field = 'source' , desc = 'file to register to target' ,
285
282
copyfile = True , mandatory = True )
286
283
jobtype = traits .Enum ('estwrite' , 'estimate' , 'write' ,
@@ -400,7 +397,7 @@ class NormalizeInputSpec(SPMCommandInputSpec):
400
397
desc = 'template file to normalize to' ,
401
398
mandatory = True , xor = ['parameter_file' ],
402
399
copyfile = False )
403
- source = InputMultiPath (ImageFile (exists = True , compressed = False ),
400
+ source = InputMultiPath (ImageFileSPM (exists = True ),
404
401
field = 'subj.source' , xor = ['parameter_file' ],
405
402
desc = 'file to normalize to template' ,
406
403
mandatory = True , copyfile = True )
@@ -563,23 +560,22 @@ def _list_outputs(self):
563
560
564
561
565
562
class Normalize12InputSpec (SPMCommandInputSpec ):
566
- image_to_align = ImageFile (exists = True , compressed = False , field = 'subj.vol' ,
563
+ image_to_align = ImageFileSPM (exists = True , field = 'subj.vol' ,
567
564
desc = ('file to estimate normalization parameters '
568
565
'with' ),
569
566
xor = ['deformation_file' ],
570
567
mandatory = True , copyfile = True )
571
568
apply_to_files = InputMultiPath (
572
- traits .Either (ImageFile (exists = True , compressed = False ),
573
- traits .List (ImageFile (exists = True , compressed = False ))),
569
+ traits .Either (ImageFileSPM (exists = True ),
570
+ traits .List (ImageFileSPM (exists = True ))),
574
571
field = 'subj.resample' ,
575
572
desc = 'files to apply transformation to' ,
576
573
copyfile = True )
577
- deformation_file = ImageFile (field = 'subj.def' , mandatory = True ,
578
- compressed = False , xor = ['image_to_align' , 'tpm' ],
574
+ deformation_file = ImageFileSPM (field = 'subj.def' , mandatory = True ,
575
+ xor = ['image_to_align' , 'tpm' ], copyfile = False ,
579
576
desc = ('file y_*.nii containing 3 deformation '
580
577
'fields for the deformation in x, y and z '
581
- 'dimension' ),
582
- copyfile = False )
578
+ 'dimension' ))
583
579
jobtype = traits .Enum ('estwrite' , 'est' , 'write' , usedefault = True ,
584
580
desc = 'Estimate, Write or do Both' )
585
581
bias_regularization = traits .Enum (0 , 0.00001 , 0.0001 , 0.001 , 0.01 , 0.1 , 1 ,
@@ -730,7 +726,7 @@ def _list_outputs(self):
730
726
731
727
732
728
class SegmentInputSpec (SPMCommandInputSpec ):
733
- data = InputMultiPath (ImageFile (exists = True , compressed = False ), field = 'data' ,
729
+ data = InputMultiPath (ImageFileSPM (exists = True ), field = 'data' ,
734
730
desc = 'one scan per subject' ,
735
731
copyfile = False , mandatory = True )
736
732
gm_output_type = traits .List (traits .Bool (), minlen = 3 , maxlen = 3 ,
@@ -899,10 +895,9 @@ def _list_outputs(self):
899
895
900
896
901
897
class NewSegmentInputSpec (SPMCommandInputSpec ):
902
- channel_files = InputMultiPath (ImageFile (exists = True , compressed = False ) ,
898
+ channel_files = InputMultiPath (ImageFileSPM (exists = True ), mandatory = True ,
903
899
desc = "A list of files to be segmented" ,
904
- field = 'channel' , copyfile = False ,
905
- mandatory = True )
900
+ field = 'channel' , copyfile = False )
906
901
channel_info = traits .Tuple (traits .Float (), traits .Float (),
907
902
traits .Tuple (traits .Bool , traits .Bool ),
908
903
desc = """A tuple with the following fields:
@@ -911,8 +906,7 @@ class NewSegmentInputSpec(SPMCommandInputSpec):
911
906
- which maps to save (Corrected, Field) - a tuple of two boolean values""" ,
912
907
field = 'channel' )
913
908
tissues = traits .List (
914
- traits .Tuple (traits .Tuple (ImageFile (exists = True , compressed = False ),
915
- traits .Int ()),
909
+ traits .Tuple (traits .Tuple (ImageFileSPM (exists = True ),traits .Int ()),
916
910
traits .Int (), traits .Tuple (traits .Bool , traits .Bool ),
917
911
traits .Tuple (traits .Bool , traits .Bool )),
918
912
desc = """A list of tuples (one per tissue) with the following fields:
@@ -1103,7 +1097,7 @@ def _list_outputs(self):
1103
1097
1104
1098
1105
1099
class SmoothInputSpec (SPMCommandInputSpec ):
1106
- in_files = InputMultiPath (ImageFile (exists = True , compressed = False ),
1100
+ in_files = InputMultiPath (ImageFileSPM (exists = True ),
1107
1101
field = 'data' , desc = 'list of files to smooth' ,
1108
1102
mandatory = True , copyfile = False )
1109
1103
fwhm = traits .Either (traits .List (traits .Float (), minlen = 3 , maxlen = 3 ),
@@ -1166,8 +1160,7 @@ def _list_outputs(self):
1166
1160
1167
1161
1168
1162
class DARTELInputSpec (SPMCommandInputSpec ):
1169
- image_files = traits .List (traits .List (ImageFile (exists = True ,
1170
- compressed = False )),
1163
+ image_files = traits .List (traits .List (ImageFileSPM (exists = True )),
1171
1164
desc = "A list of files to be segmented" ,
1172
1165
field = 'warp.images' , copyfile = False ,
1173
1166
mandatory = True )
@@ -1283,14 +1276,12 @@ def _list_outputs(self):
1283
1276
1284
1277
1285
1278
class DARTELNorm2MNIInputSpec (SPMCommandInputSpec ):
1286
- template_file = ImageFile (exists = True , compressed = False ,
1287
- desc = "DARTEL template" , field = 'mni_norm.template' ,
1288
- copyfile = False , mandatory = True )
1289
- flowfield_files = InputMultiPath (ImageFile (exists = True , compressed = False ),
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 ,
1290
1282
desc = "DARTEL flow fields u_rc1*" ,
1291
- field = 'mni_norm.data.subjs.flowfields' ,
1292
- mandatory = True )
1293
- apply_to_files = InputMultiPath (ImageFile (exists = True , compressed = False ),
1283
+ field = 'mni_norm.data.subjs.flowfields' )
1284
+ apply_to_files = InputMultiPath (ImageFileSPM (exists = True ),
1294
1285
desc = "Files to apply the transform to" ,
1295
1286
field = 'mni_norm.data.subjs.images' ,
1296
1287
mandatory = True , copyfile = False )
@@ -1380,14 +1371,12 @@ def _list_outputs(self):
1380
1371
1381
1372
1382
1373
class CreateWarpedInputSpec (SPMCommandInputSpec ):
1383
- image_files = InputMultiPath (ImageFile (exists = True , compressed = False ) ,
1374
+ image_files = InputMultiPath (ImageFileSPM (exists = True ), mandatory = True ,
1384
1375
desc = "A list of files to be warped" ,
1385
- field = 'crt_warped.images' , copyfile = False ,
1386
- mandatory = True )
1387
- flowfield_files = InputMultiPath (ImageFile (exists = True , compressed = False ),
1376
+ field = 'crt_warped.images' , copyfile = False )
1377
+ flowfield_files = InputMultiPath (ImageFileSPM (exists = True ), copyfile = False ,
1388
1378
desc = "DARTEL flow fields u_rc1*" ,
1389
1379
field = 'crt_warped.flowfields' ,
1390
- copyfile = False ,
1391
1380
mandatory = True )
1392
1381
iterations = traits .Range (low = 0 , high = 9 ,
1393
1382
desc = ("The number of iterations: log2(number of "
@@ -1450,10 +1439,10 @@ def _list_outputs(self):
1450
1439
1451
1440
1452
1441
class ApplyDeformationFieldInputSpec (SPMCommandInputSpec ):
1453
- in_files = InputMultiPath (ImageFile (exists = True , compressed = False ),
1442
+ in_files = InputMultiPath (ImageFileSPM (exists = True ),
1454
1443
mandatory = True , field = 'fnames' )
1455
1444
deformation_field = File (exists = True , mandatory = True , field = 'comp{1}.def' )
1456
- reference_volume = ImageFile (exists = True , mandatory = True , compressed = False ,
1445
+ reference_volume = ImageFileSPM (exists = True , mandatory = True ,
1457
1446
field = 'comp{2}.id.space' )
1458
1447
interp = traits .Range (low = 0 , high = 7 , field = 'interp' ,
1459
1448
desc = 'degree of b-spline used for interpolation' )
@@ -1496,13 +1485,12 @@ def _list_outputs(self):
1496
1485
class VBMSegmentInputSpec (SPMCommandInputSpec ):
1497
1486
1498
1487
in_files = InputMultiPath (
1499
- ImageFile (exists = True , compressed = False ),
1488
+ ImageFileSPM (exists = True ),
1500
1489
desc = "A list of files to be segmented" ,
1501
1490
field = 'estwrite.data' , copyfile = False , mandatory = True )
1502
1491
1503
- tissues = ImageFile (
1504
- exists = True , compressed = False , field = 'estwrite.tpm' ,
1505
- desc = 'tissue probability map' )
1492
+ tissues = ImageFileSPM (
1493
+ exists = True , field = 'estwrite.tpm' , desc = 'tissue probability map' )
1506
1494
gaussians_per_class = traits .Tuple (
1507
1495
(2 , 2 , 2 , 3 , 4 , 2 ), * ([traits .Int ()] * 6 ),
1508
1496
usedefault = True ,
@@ -1528,8 +1516,8 @@ class VBMSegmentInputSpec(SPMCommandInputSpec):
1528
1516
1529
1517
spatial_normalization = traits .Enum (
1530
1518
'high' , 'low' , usedefault = True ,)
1531
- dartel_template = ImageFile (
1532
- exists = True , compressed = False ,
1519
+ dartel_template = ImageFileSPM (
1520
+ exists = True ,
1533
1521
field = 'estwrite.extopts.dartelwarp.normhigh.darteltpm' )
1534
1522
use_sanlm_denoising_filter = traits .Range (
1535
1523
0 , 2 , 2 , usedefault = True , field = 'estwrite.extopts.sanlm' ,
0 commit comments