@@ -861,6 +861,63 @@ def _gen_filename(self, name):
861
861
return self ._get_outfile ()
862
862
return None
863
863
864
+ class Surface2VolTransformInputSpec (FSTraitedSpec ):
865
+ source_file = File (exists = True , argstr = '--surfval %s' ,
866
+ copyfile = False , mandatory = True ,
867
+ desc = 'This is the source of the surface values' )
868
+ hemi = traits .Str (argstr = '--hemi %s' ,desc = 'hemisphere of data' )
869
+ transformed_file = File (desc = 'Output volume' , argstr = '--outvol %s' , genfile = True )
870
+ reg_file = File (exists = True , argstr = '--volreg %s' ,
871
+ mandatory = True ,
872
+ desc = 'tkRAS-to-tkRAS matrix (tkregister2 format)' )
873
+ template_file = File (exists = True , argstr = '--template %s' ,
874
+ desc = 'Output template volume' )
875
+ mkmask = traits .Bool (desc = 'make a mask instead of loading surfval' , argstr = '--mkmask' )
876
+ vertexvol_file = File (desc = 'vertex map volume path id' , argstr = '--vtxvol %s' , genfile = True )
877
+ surf_file = File (exists = True , argstr = '--surf %s' ,desc = 'surfname (default is white)' )
878
+ projfrac_file = File (exists = True , argstr = '--projfrac %s' ,desc = 'thickness fraction' )
879
+ subjects_dir = traits .Str (argstr = '--sd %s' ,desc = 'freesurfer subjects directory defaults to $SUBJECTS_DIR' )
880
+
881
+ class Surface2VolTransformOutputSpec (TraitedSpec ):
882
+ transformed_file = File (exists = True , desc = 'Path to output file if used normally' )
883
+ vertexvol_file = File (desc = 'vertex map volume path id. Optional' )
884
+
885
+ class Surface2VolTransform (FSCommand ):
886
+ """Use FreeSurfer mri_surf2vol to apply a transform.
887
+
888
+ Examples
889
+ --------
890
+
891
+ >>> from nipype.interfaces.freesurfer import Surface2VolTransform
892
+ >>> xfm2vol = Surface2VolTransform()
893
+ >>> xfm2vol.inputs.source_file = 'surface.nii'
894
+ >>> xfm2vol.inputs.reg_file = 'register.dat'
895
+ >>> xfm2vol.inputs.hemi = 'lh'
896
+ >>> xfm2vol.cmdline
897
+ 'mri_surf2vol --volreg register.dat --surfval structural.nii --hemi lh'
898
+
899
+ """
900
+
901
+ _cmd = 'mri_surf2vol'
902
+ input_spec = Surface2VolTransformInputSpec
903
+ output_spec = Surface2VolTransformOutputSpec
904
+
905
+ def _get_outfile (self ):
906
+ outfile = self .inputs .transformed_file
907
+ if not isdefined (outfile ):
908
+ outfile = self ._gen_fname (self .inputs .source_file ,
909
+ suffix = '_xfm2vol' )
910
+ return outfile
911
+
912
+ def _list_outputs (self ):
913
+ outputs = self .output_spec ().get ()
914
+ outputs ['transformed_file' ] = self ._get_outfile ()
915
+ return outputs
916
+
917
+ def _gen_filename (self , name ):
918
+ if name == 'transformed_file' :
919
+ return self ._get_outfile ()
920
+ return None
864
921
865
922
class SmoothInputSpec (FSTraitedSpec ):
866
923
in_file = File (exists = True , desc = 'source volume' ,
0 commit comments