@@ -923,6 +923,80 @@ def _gen_outfilename(self):
923
923
_ , name , ext = split_filename (self .inputs .in_file )
924
924
return name + ext + '_' + str (self .inputs .label_value )
925
925
926
+
927
+ class MRIPretessInputSpec (FSTraitedSpec ):
928
+ in_filled = File (exists = True , mandatory = True , position = - 4 , argstr = '%s' ,
929
+ desc = ('filled volume, usually wm.mgz' ))
930
+ label = traits .Either (traits .Str ('wm' ), traits .Int (1 ), argstr = '%s' , default = 'wm' ,
931
+ mandatory = True , usedefault = True , position = - 3 ,
932
+ desc = ('label to be picked up, can be a Freesurfer\' s string like '
933
+ '\' wm\' or a label value (e.g. 127 for rh or 255 for lh)' ))
934
+ in_norm = File (exists = True , mandatory = True , position = - 2 , argstr = '%s' ,
935
+ desc = ('the normalized, brain-extracted T1w image. Usually norm.mgz' ))
936
+ out_file = File (position = - 1 , argstr = '%s' , genfile = True ,
937
+ desc = ('the output file after mri_pretess.' ))
938
+
939
+
940
+ nocorners = traits .Bool (False , argstr = '-nocorners' , desc = ('do not remove corner configurations'
941
+ ' in addition to edge ones.' ))
942
+ keep = traits .Bool (False , argstr = '-keep' , desc = ('keep WM edits' ))
943
+ test = traits .Bool (False , argstr = '-test' , desc = ('adds a voxel that should be removed by '
944
+ 'mri_pretess. The value of the voxel is set to that of an ON-edited WM, '
945
+ 'so it should be kept with -keep. The output will NOT be saved.' ))
946
+
947
+ class MRIPretessOutputSpec (TraitedSpec ):
948
+ """
949
+ Uses Freesurfer's mri_tessellate to create surfaces by tessellating a given input volume
950
+ """
951
+ out_file = File (exists = True , desc = 'output file after mri_pretess' )
952
+
953
+
954
+ class MRIPretess (FSCommand ):
955
+ """
956
+ Uses Freesurfer's mri_pretess to prepare volumes to be tessellated.
957
+
958
+ Description
959
+ -----------
960
+
961
+ Changes white matter (WM) segmentation so that the neighbors of all
962
+ voxels labeled as WM have a face in common - no edges or corners
963
+ allowed.
964
+
965
+ Example
966
+ -------
967
+
968
+ >>> import nipype.interfaces.freesurfer as fs
969
+ >>> pretess = fs.MRIPretess()
970
+ >>> pretess.inputs.in_filled = 'wm.mgz'
971
+ >>> pretess.inputs.in_norm = 'norm.mgz'
972
+ >>> pretess.inputs.nocorners = True
973
+ >>> pretess.cmdline
974
+ 'mri_pretess -nocorners wm.mgz wm norm.mgz wm_pretesswm.mgz'
975
+ >>> pretess.run() # doctest: +SKIP
976
+ """
977
+ _cmd = 'mri_pretess'
978
+ input_spec = MRIPretessInputSpec
979
+ output_spec = MRIPretessOutputSpec
980
+
981
+ def _list_outputs (self ):
982
+ outputs = self .output_spec ().get ()
983
+ outputs ['out_file' ] = os .path .abspath (self ._gen_outfilename ())
984
+ return outputs
985
+
986
+ def _gen_filename (self , name ):
987
+ if name is 'out_file' :
988
+ return self ._gen_outfilename ()
989
+ else :
990
+ return None
991
+
992
+ def _gen_outfilename (self ):
993
+ if isdefined (self .inputs .out_file ):
994
+ return self .inputs .out_file
995
+ else :
996
+ _ , name , ext = split_filename (self .inputs .in_filled )
997
+ return name + '_pretess' + str (self .inputs .label ) + ext
998
+
999
+
926
1000
class MRIMarchingCubesInputSpec (FSTraitedSpec ):
927
1001
"""
928
1002
Uses Freesurfer's mri_mc to create surfaces by tessellating a given input volume
0 commit comments