@@ -60,7 +60,7 @@ class SliceTimingInputSpec(SPMCommandInputSpec):
60
60
class SliceTimingOutputSpec (TraitedSpec ):
61
61
timecorrected_files = OutputMultiPath (
62
62
traits .Either (traits .List (File (exists = True )), File (exists = True )),
63
- desc = 'slice time corrected files' )
63
+ desc = 'slice time corrected files' )
64
64
65
65
66
66
class SliceTiming (SPMCommand ):
@@ -366,8 +366,8 @@ def _list_outputs(self):
366
366
if isdefined (self .inputs .apply_to_files ):
367
367
outputs ['coregistered_files' ] = self .inputs .apply_to_files
368
368
outputs ['coregistered_source' ] = self .inputs .source
369
- elif (self .inputs .jobtype == "write"
370
- or self .inputs .jobtype == "estwrite" ):
369
+ elif (self .inputs .jobtype == "write" or
370
+ self .inputs .jobtype == "estwrite" ):
371
371
if isdefined (self .inputs .apply_to_files ):
372
372
outputs ['coregistered_files' ] = []
373
373
for imgf in filename_to_list (self .inputs .apply_to_files ):
@@ -522,8 +522,8 @@ def _list_outputs(self):
522
522
outputs ['normalized_files' ] = self .inputs .apply_to_files
523
523
outputs ['normalized_source' ] = self .inputs .source
524
524
elif 'write' in self .inputs .jobtype :
525
- if (isdefined (self .inputs .write_preserve )
526
- and self .inputs .write_preserve ):
525
+ if (isdefined (self .inputs .write_preserve ) and
526
+ self .inputs .write_preserve ):
527
527
prefixNorm = '' .join (['m' , self .inputs .out_prefix ])
528
528
else :
529
529
prefixNorm = self .inputs .out_prefix
@@ -607,9 +607,10 @@ class Normalize12InputSpec(SPMCommandInputSpec):
607
607
608
608
class Normalize12OutputSpec (TraitedSpec ):
609
609
deformation_field = OutputMultiPath (File (exists = True ),
610
- desc = ('NIfTI file containing 3 deformation '
611
- 'fields for the deformation in '
612
- 'x, y and z dimension' ))
610
+ desc = ('NIfTI file containing 3 '
611
+ 'deformation fields for the '
612
+ 'deformation in x, y and z '
613
+ 'dimension' ))
613
614
normalized_image = OutputMultiPath (File (exists = True ),
614
615
desc = ('Normalized file that needed to '
615
616
'be aligned' ))
@@ -708,9 +709,11 @@ def _list_outputs(self):
708
709
709
710
710
711
class SegmentInputSpec (SPMCommandInputSpec ):
711
- data = InputMultiPath (File (exists = True ), field = 'data' , desc = 'one scan per subject' ,
712
+ data = InputMultiPath (File (exists = True ), field = 'data' ,
713
+ desc = 'one scan per subject' ,
712
714
copyfile = False , mandatory = True )
713
- gm_output_type = traits .List (traits .Bool (), minlen = 3 , maxlen = 3 , field = 'output.GM' ,
715
+ gm_output_type = traits .List (traits .Bool (), minlen = 3 , maxlen = 3 ,
716
+ field = 'output.GM' ,
714
717
desc = """Options to produce grey matter images: c1*.img, wc1*.img and mwc1*.img.
715
718
None: [False,False,False],
716
719
Native Space: [False,False,True],
@@ -720,7 +723,8 @@ class SegmentInputSpec(SPMCommandInputSpec):
720
723
Native + Modulated Normalised: [True,False,True],
721
724
Native + Modulated + Unmodulated: [True,True,True],
722
725
Modulated + Unmodulated Normalised: [True,True,False]""" )
723
- wm_output_type = traits .List (traits .Bool (), minlen = 3 , maxlen = 3 , field = 'output.WM' ,
726
+ wm_output_type = traits .List (traits .Bool (), minlen = 3 , maxlen = 3 ,
727
+ field = 'output.WM' ,
724
728
desc = """Options to produce white matter images: c2*.img, wc2*.img and mwc2*.img.
725
729
None: [False,False,False],
726
730
Native Space: [False,False,True],
@@ -742,38 +746,53 @@ class SegmentInputSpec(SPMCommandInputSpec):
742
746
Modulated + Unmodulated Normalised: [True,True,False]""" )
743
747
save_bias_corrected = traits .Bool (field = 'output.biascor' ,
744
748
desc = 'True/False produce a bias corrected image' )
745
- clean_masks = traits .Enum ('no' , 'light' , 'thorough' , field = 'output.cleanup' ,
746
- desc = "clean using estimated brain mask ('no','light','thorough')" )
749
+ clean_masks = traits .Enum ('no' , 'light' , 'thorough' ,
750
+ field = 'output.cleanup' ,
751
+ desc = ("clean using estimated brain mask "
752
+ "('no','light','thorough')" ))
747
753
tissue_prob_maps = traits .List (File (exists = True ), field = 'opts.tpm' ,
748
- desc = 'list of gray, white & csf prob. (opt,)' )
754
+ desc = ('list of gray, white & csf prob. '
755
+ '(opt,)' ))
749
756
gaussians_per_class = traits .List (traits .Int (), field = 'opts.ngaus' ,
750
- desc = 'num Gaussians capture intensity distribution' )
751
- affine_regularization = traits .Enum ('mni' , 'eastern' , 'subj' , 'none' , '' , field = 'opts.regtype' ,
752
- desc = 'Possible options: "mni", "eastern", "subj", "none" (no reguralisation), "" (no affine registration)' )
757
+ desc = ('num Gaussians capture intensity '
758
+ 'distribution' ))
759
+ affine_regularization = traits .Enum ('mni' , 'eastern' , 'subj' , 'none' , '' ,
760
+ field = 'opts.regtype' ,
761
+ desc = ('Possible options: "mni", '
762
+ '"eastern", "subj", "none" '
763
+ '(no reguralisation), "" '
764
+ '(no affine registration)' ))
753
765
warping_regularization = traits .Float (field = 'opts.warpreg' ,
754
- desc = 'Controls balance between parameters and data' )
755
- warp_frequency_cutoff = traits .Float (field = 'opts.warpco' , desc = 'Cutoff of DCT bases' )
756
- bias_regularization = traits .Enum (0 , 0.00001 , 0.0001 , 0.001 , 0.01 , 0.1 , 1 , 10 , field = 'opts.biasreg' ,
766
+ desc = ('Controls balance between '
767
+ 'parameters and data' ))
768
+ warp_frequency_cutoff = traits .Float (field = 'opts.warpco' ,
769
+ desc = 'Cutoff of DCT bases' )
770
+ bias_regularization = traits .Enum (0 , 0.00001 , 0.0001 , 0.001 ,
771
+ 0.01 , 0.1 , 1 , 10 , field = 'opts.biasreg' ,
757
772
desc = 'no(0) - extremely heavy (10)' )
758
773
bias_fwhm = traits .Enum (30 , 40 , 50 , 60 , 70 , 80 , 90 , 100 , 110 , 120 , 130 ,
759
774
'Inf' , field = 'opts.biasfwhm' ,
760
775
desc = 'FWHM of Gaussian smoothness of bias' )
761
776
sampling_distance = traits .Float (field = 'opts.samp' ,
762
- desc = 'Sampling distance on data for parameter estimation' )
777
+ desc = ('Sampling distance on data for '
778
+ 'parameter estimation' ))
763
779
mask_image = File (exists = True , field = 'opts.msk' ,
764
780
desc = 'Binary image to restrict parameter estimation ' )
765
781
766
782
767
783
class SegmentOutputSpec (TraitedSpec ):
768
784
native_gm_image = File (desc = 'native space grey probability map' )
769
785
normalized_gm_image = File (desc = 'normalized grey probability map' ,)
770
- modulated_gm_image = File (desc = 'modulated, normalized grey probability map' )
786
+ modulated_gm_image = File (desc = ('modulated, normalized grey '
787
+ 'probability map' ))
771
788
native_wm_image = File (desc = 'native space white probability map' )
772
789
normalized_wm_image = File (desc = 'normalized white probability map' )
773
- modulated_wm_image = File (desc = 'modulated, normalized white probability map' )
790
+ modulated_wm_image = File (desc = ('modulated, normalized white '
791
+ 'probability map' ))
774
792
native_csf_image = File (desc = 'native space csf probability map' )
775
793
normalized_csf_image = File (desc = 'normalized csf probability map' )
776
- modulated_csf_image = File (desc = 'modulated, normalized csf probability map' )
794
+ modulated_csf_image = File (desc = ('modulated, normalized csf '
795
+ 'probability map' ))
777
796
modulated_input_image = File (deprecated = '0.10' ,
778
797
new_name = 'bias_corrected_image' ,
779
798
desc = 'bias-corrected version of input image' )
@@ -874,31 +893,44 @@ class NewSegmentInputSpec(SPMCommandInputSpec):
874
893
- which maps to save [Native, DARTEL] - a tuple of two boolean values
875
894
- which maps to save [Unmodulated, Modulated] - a tuple of two boolean values""" ,
876
895
field = 'tissue' )
877
- affine_regularization = traits .Enum ('mni' , 'eastern' , 'subj' , 'none' , field = 'warp.affreg' ,
896
+ affine_regularization = traits .Enum ('mni' , 'eastern' , 'subj' , 'none' ,
897
+ field = 'warp.affreg' ,
878
898
desc = 'mni, eastern, subj, none ' )
879
899
warping_regularization = traits .Float (field = 'warp.reg' ,
880
- desc = 'Aproximate distance between sampling points.' )
900
+ desc = ('Aproximate distance between '
901
+ 'sampling points.' ))
881
902
sampling_distance = traits .Float (field = 'warp.samp' ,
882
- desc = 'Sampling distance on data for parameter estimation' )
883
- write_deformation_fields = traits .List (traits .Bool (), minlen = 2 , maxlen = 2 , field = 'warp.write' ,
884
- desc = "Which deformation fields to write:[Inverse, Forward]" )
903
+ desc = ('Sampling distance on data for '
904
+ 'parameter estimation' ))
905
+ write_deformation_fields = traits .List (traits .Bool (), minlen = 2 , maxlen = 2 ,
906
+ field = 'warp.write' ,
907
+ desc = ("Which deformation fields to "
908
+ "write:[Inverse, Forward]" ))
885
909
886
910
887
911
class NewSegmentOutputSpec (TraitedSpec ):
888
- native_class_images = traits .List (traits .List (File (exists = True )), desc = 'native space probability maps' )
889
- dartel_input_images = traits .List (traits .List (File (exists = True )), desc = 'dartel imported class images' )
890
- normalized_class_images = traits .List (traits .List (File (exists = True )), desc = 'normalized class images' )
891
- modulated_class_images = traits .List (traits .List (File (exists = True )), desc = 'modulated+normalized class images' )
892
- transformation_mat = OutputMultiPath (File (exists = True ), desc = 'Normalization transformation' )
893
- bias_corrected_images = OutputMultiPath (File (exists = True ), desc = 'bias corrected images' )
894
- bias_field_images = OutputMultiPath (File (exists = True ), desc = 'bias field images' )
912
+ native_class_images = traits .List (traits .List (File (exists = True )),
913
+ desc = 'native space probability maps' )
914
+ dartel_input_images = traits .List (traits .List (File (exists = True )),
915
+ desc = 'dartel imported class images' )
916
+ normalized_class_images = traits .List (traits .List (File (exists = True )),
917
+ desc = 'normalized class images' )
918
+ modulated_class_images = traits .List (traits .List (File (exists = True )),
919
+ desc = ('modulated+normalized class '
920
+ 'images' ))
921
+ transformation_mat = OutputMultiPath (File (exists = True ),
922
+ desc = 'Normalization transformation' )
923
+ bias_corrected_images = OutputMultiPath (File (exists = True ),
924
+ desc = 'bias corrected images' )
925
+ bias_field_images = OutputMultiPath (File (exists = True ),
926
+ desc = 'bias field images' )
895
927
forward_deformation_field = OutputMultiPath (File (exists = True ))
896
928
inverse_deformation_field = OutputMultiPath (File (exists = True ))
897
929
898
930
899
931
class NewSegment (SPMCommand ):
900
- """Use spm_preproc8 (New Segment) to separate structural images into different
901
- tissue classes. Supports multiple modalities.
932
+ """Use spm_preproc8 (New Segment) to separate structural images into
933
+ different tissue classes. Supports multiple modalities.
902
934
903
935
NOTE: This interface currently supports single channel input only
904
936
@@ -959,14 +991,18 @@ def _format_arg(self, opt, spec, val):
959
991
new_tissues = []
960
992
for tissue in val :
961
993
new_tissue = {}
962
- new_tissue ['tpm' ] = np .array ([',' .join ([tissue [0 ][0 ], str (tissue [0 ][1 ])])], dtype = object )
994
+ new_tissue ['tpm' ] = np .array ([',' .join ([tissue [0 ][0 ],
995
+ str (tissue [0 ][1 ])])],
996
+ dtype = object )
963
997
new_tissue ['ngaus' ] = tissue [1 ]
964
998
new_tissue ['native' ] = [int (tissue [2 ][0 ]), int (tissue [2 ][1 ])]
965
999
new_tissue ['warped' ] = [int (tissue [3 ][0 ]), int (tissue [3 ][1 ])]
966
1000
new_tissues .append (new_tissue )
967
1001
return new_tissues
968
1002
elif opt == 'write_deformation_fields' :
969
- return super (NewSegment , self )._format_arg (opt , spec , [int (val [0 ]), int (val [1 ])])
1003
+ return super (NewSegment , self )._format_arg (opt , spec ,
1004
+ [int (val [0 ]),
1005
+ int (val [1 ])])
970
1006
else :
971
1007
return super (NewSegment , self )._format_arg (opt , spec , val )
972
1008
@@ -1080,14 +1116,16 @@ def _list_outputs(self):
1080
1116
outputs ['smoothed_files' ] = []
1081
1117
1082
1118
for imgf in filename_to_list (self .inputs .in_files ):
1083
- outputs ['smoothed_files' ].append (fname_presuffix (imgf , prefix = self .inputs .out_prefix ))
1119
+ outputs ['smoothed_files' ].append (
1120
+ fname_presuffix (imgf , prefix = self .inputs .out_prefix ))
1084
1121
return outputs
1085
1122
1086
1123
1087
1124
class DARTELInputSpec (SPMCommandInputSpec ):
1088
1125
image_files = traits .List (traits .List (File (exists = True )),
1089
1126
desc = "A list of files to be segmented" ,
1090
- field = 'warp.images' , copyfile = False , mandatory = True )
1127
+ field = 'warp.images' , copyfile = False ,
1128
+ mandatory = True )
1091
1129
template_prefix = traits .Str ('Template' , usedefault = True ,
1092
1130
field = 'warp.settings.template' ,
1093
1131
desc = 'Prefix for template' )
@@ -1101,8 +1139,8 @@ class DARTELInputSpec(SPMCommandInputSpec):
1101
1139
traits .Enum (1 , 2 , 4 , 8 , 16 ,
1102
1140
32 , 64 , 128 ,
1103
1141
256 , 512 ),
1104
- traits .Enum (0 , 0.5 , 1 , 2 , 4 ,
1105
- 8 , 16 , 32 )),
1142
+ traits .Enum (0 , 0.5 , 1 , 2 ,
1143
+ 4 , 8 , 16 , 32 )),
1106
1144
minlen = 3 ,
1107
1145
maxlen = 12 ,
1108
1146
field = 'warp.settings.param' ,
@@ -1124,8 +1162,11 @@ class DARTELInputSpec(SPMCommandInputSpec):
1124
1162
1125
1163
class DARTELOutputSpec (TraitedSpec ):
1126
1164
final_template_file = File (exists = True , desc = 'final DARTEL template' )
1127
- template_files = traits .List (File (exists = True ), desc = 'Templates from different stages of iteration' )
1128
- dartel_flow_fields = traits .List (File (exists = True ), desc = 'DARTEL flow fields' )
1165
+ template_files = traits .List (File (exists = True ),
1166
+ desc = ('Templates from different stages of '
1167
+ 'iteration' ))
1168
+ dartel_flow_fields = traits .List (File (exists = True ),
1169
+ desc = 'DARTEL flow fields' )
1129
1170
1130
1171
1131
1172
class DARTEL (SPMCommand ):
@@ -1193,7 +1234,8 @@ def _list_outputs(self):
1193
1234
class DARTELNorm2MNIInputSpec (SPMCommandInputSpec ):
1194
1235
template_file = File (exists = True ,
1195
1236
desc = "DARTEL template" ,
1196
- field = 'mni_norm.template' , copyfile = False , mandatory = True )
1237
+ field = 'mni_norm.template' , copyfile = False ,
1238
+ mandatory = True )
1197
1239
flowfield_files = InputMultiPath (File (exists = True ),
1198
1240
desc = "DARTEL flow fields u_rc1*" ,
1199
1241
field = 'mni_norm.data.subjs.flowfields' ,
@@ -1210,15 +1252,19 @@ class DARTELNorm2MNIInputSpec(SPMCommandInputSpec):
1210
1252
desc = "Voxel sizes for output file" ,
1211
1253
field = 'mni_norm.bb' )
1212
1254
modulate = traits .Bool (field = 'mni_norm.preserve' ,
1213
- desc = "Modulate out images - no modulation preserves concentrations" )
1255
+ desc = ("Modulate out images - no modulation "
1256
+ "preserves concentrations" ))
1214
1257
fwhm = traits .Either (traits .List (traits .Float (), minlen = 3 , maxlen = 3 ),
1215
1258
traits .Float (), field = 'mni_norm.fwhm' ,
1216
1259
desc = '3-list of fwhm for each dimension' )
1217
1260
1218
1261
1219
1262
class DARTELNorm2MNIOutputSpec (TraitedSpec ):
1220
- normalized_files = OutputMultiPath (File (exists = True ), desc = 'Normalized files in MNI space' )
1221
- normalization_parameter_file = File (exists = True , desc = 'Transform parameters to MNI space' )
1263
+ normalized_files = OutputMultiPath (File (exists = True ),
1264
+ desc = 'Normalized files in MNI space' )
1265
+ normalization_parameter_file = File (exists = True ,
1266
+ desc = ('Transform parameters to MNI '
1267
+ 'space' ))
1222
1268
1223
1269
1224
1270
class DARTELNorm2MNI (SPMCommand ):
@@ -1354,7 +1400,8 @@ def _list_outputs(self):
1354
1400
1355
1401
1356
1402
class ApplyDeformationFieldInputSpec (SPMCommandInputSpec ):
1357
- in_files = InputMultiPath (File (exists = True ), mandatory = True , field = 'fnames' )
1403
+ in_files = InputMultiPath (File (exists = True ), mandatory = True ,
1404
+ field = 'fnames' )
1358
1405
deformation_field = File (exists = True , mandatory = True , field = 'comp{1}.def' )
1359
1406
reference_volume = File (exists = True , mandatory = True ,
1360
1407
field = 'comp{2}.id.space' )
@@ -1511,7 +1558,8 @@ class VBMSegmentOuputSpec(TraitedSpec):
1511
1558
normalized_class_images = traits .List (traits .List (File (exists = True )),
1512
1559
desc = 'normalized class images' )
1513
1560
modulated_class_images = traits .List (traits .List (File (exists = True )),
1514
- desc = 'modulated+normalized class images' )
1561
+ desc = ('modulated+normalized class '
1562
+ 'images' ))
1515
1563
transformation_mat = OutputMultiPath (File (exists = True ),
1516
1564
desc = 'Normalization transformation' )
1517
1565
0 commit comments