@@ -1021,6 +1021,64 @@ def _gen_filename(self, name):
1021
1021
return self ._get_outfile ()
1022
1022
return None
1023
1023
1024
+ class Surface2VolTransformInputSpec (FSTraitedSpec ):
1025
+ source_file = File (exists = True , argstr = '--surfval %s' ,
1026
+ copyfile = False , mandatory = True ,
1027
+ desc = 'This is the source of the surface values' )
1028
+ hemi = traits .Str (argstr = '--hemi %s' ,desc = 'hemisphere of data' )
1029
+ transformed_file = File (desc = 'Output volume' , argstr = '--outvol %s' , genfile = True )
1030
+ reg_file = File (exists = True , argstr = '--volreg %s' ,
1031
+ mandatory = True ,
1032
+ desc = 'tkRAS-to-tkRAS matrix (tkregister2 format)' )
1033
+ template_file = File (exists = True , argstr = '--template %s' ,
1034
+ desc = 'Output template volume' )
1035
+ mkmask = traits .Bool (desc = 'make a mask instead of loading surfval' , argstr = '--mkmask' )
1036
+ vertexvol_file = File (desc = 'vertex map volume path id' , argstr = '--vtxvol %s' , genfile = True )
1037
+ surf_file = File (exists = True , argstr = '--surf %s' ,desc = 'surfname (default is white)' )
1038
+ projfrac_file = File (exists = True , argstr = '--projfrac %s' ,desc = 'thickness fraction' )
1039
+ subjects_dir = traits .Str (argstr = '--sd %s' ,desc = 'freesurfer subjects directory defaults to $SUBJECTS_DIR' )
1040
+ identity = traits .Str (argstr = '--identity %s' ,desc = 'use identity (must supply subject name)' )
1041
+
1042
+ class Surface2VolTransformOutputSpec (TraitedSpec ):
1043
+ transformed_file = File (exists = True , desc = 'Path to output file if used normally' )
1044
+ vertexvol_file = File (desc = 'vertex map volume path id. Optional' )
1045
+
1046
+ class Surface2VolTransform (FSCommand ):
1047
+ """Use FreeSurfer mri_surf2vol to apply a transform.
1048
+
1049
+ Examples
1050
+ --------
1051
+
1052
+ >>> from nipype.interfaces.freesurfer import Surface2VolTransform
1053
+ >>> xfm2vol = Surface2VolTransform()
1054
+ >>> xfm2vol.inputs.source_file = 'surface.nii'
1055
+ >>> xfm2vol.inputs.reg_file = 'register.dat'
1056
+ >>> xfm2vol.inputs.hemi = 'lh'
1057
+ >>> xfm2vol.cmdline
1058
+ 'mri_surf2vol --volreg register.dat --surfval structural.nii --hemi lh'
1059
+
1060
+ """
1061
+
1062
+ _cmd = 'mri_surf2vol'
1063
+ input_spec = Surface2VolTransformInputSpec
1064
+ output_spec = Surface2VolTransformOutputSpec
1065
+
1066
+ def _get_outfile (self ):
1067
+ outfile = self .inputs .transformed_file
1068
+ if not isdefined (outfile ):
1069
+ outfile = self ._gen_fname (self .inputs .source_file ,
1070
+ suffix = '_xfm2vol' )
1071
+ return outfile
1072
+
1073
+ def _list_outputs (self ):
1074
+ outputs = self .output_spec ().get ()
1075
+ outputs ['transformed_file' ] = self ._get_outfile ()
1076
+ return outputs
1077
+
1078
+ def _gen_filename (self , name ):
1079
+ if name == 'transformed_file' :
1080
+ return self ._get_outfile ()
1081
+ return None
1024
1082
1025
1083
class SmoothInputSpec (FSTraitedSpec ):
1026
1084
in_file = File (exists = True , desc = 'source volume' ,
0 commit comments