Skip to content

Commit 1fa7be4

Browse files
committed
add mri_surf2vol wrap
1 parent a3b778b commit 1fa7be4

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

nipype/interfaces/afni/preprocess.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ class AutoTcorrelateInputSpec(AFNICommandInputSpec):
318318
argstr="-mask %s")
319319
mask_only_targets = traits.Bool(desc="use mask only on targets voxels",
320320
argstr="-mask_only_targets")
321+
mask_source = File(exists=True, desc="mask of voxels as source", argstr="-mask_source %s")
321322

322323
out_file = File("%s_similarity_matrix.1D", desc='output image file name',
323324
argstr='-prefix %s', name_source="in_file", usedefault=True)

nipype/interfaces/freesurfer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from .base import Info, FSCommand
66
from .preprocess import (ParseDICOMDir, UnpackSDICOMDir, MRIConvert, Resample,
7-
ReconAll, BBRegister, ApplyVolTransform, Smooth,
7+
ReconAll, BBRegister, ApplyVolTransform, Surface2VolTransform, Smooth,
88
DICOMConvert, RobustRegister, FitMSParams,
99
SynthesizeFLASH)
1010
from .model import (MRISPreproc, GLMFit, OneSampleTTest, Binarize, Concatenate,

nipype/interfaces/freesurfer/preprocess.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,63 @@ def _gen_filename(self, name):
861861
return self._get_outfile()
862862
return None
863863

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
864921

865922
class SmoothInputSpec(FSTraitedSpec):
866923
in_file = File(exists=True, desc='source volume',

0 commit comments

Comments
 (0)