-
Notifications
You must be signed in to change notification settings - Fork 532
FIX: Reuse _gen_filename logic in ants.LaplacianThickness #2734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Any chance of a test? |
oh, there are real tests for the interfaces? ;) what would be the best example to follow? |
Can't we just use class LaplacianThicknessInputSpec(ANTSCommandInputSpec):
input_wm = File(
argstr='%s',
mandatory=True,
copyfile=True,
desc='white matter segmentation image',
position=1)
input_gm = File(
argstr='%s',
mandatory=True,
copyfile=True,
desc='gray matter segmentation image',
position=2)
output_image = File(
desc='name of output file',
argstr='%s',
position=3,
name_source=['input_wm'],
name_template='%s_thickness',
keep_extension=True,
hash_files=False)
smooth_param = traits.Float(argstr='smoothparam=%d', desc='', position=4)
prior_thickness = traits.Float(
argstr='priorthickval=%d', desc='', position=5)
dT = traits.Float(argstr='dT=%d', desc='', position=6)
sulcus_prior = traits.Bool(argstr='use-sulcus-prior', desc='', position=7)
opt_tolerance = traits.Float(
argstr='optional-laplacian-tolerance=%d', desc='', position=8)
class LaplacianThicknessOutputSpec(TraitedSpec):
output_image = File(exists=True, desc='Cortical thickness')
class LaplacianThickness(ANTSCommand):
"""Calculates the cortical thickness from an anatomical image
Examples
--------
>>> from nipype.interfaces.ants import LaplacianThickness
>>> cort_thick = LaplacianThickness()
>>> cort_thick.inputs.input_wm = 'white_matter.nii.gz'
>>> cort_thick.inputs.input_gm = 'gray_matter.nii.gz'
>>> cort_thick.cmdline
'LaplacianThickness white_matter.nii.gz gray_matter.nii.gz white_matter_thickness.nii.gz'
>>> cort_thick.inputs.output_image = 'output_thickness.nii.gz'
>>> cort_thick.cmdline
'LaplacianThickness white_matter.nii.gz gray_matter.nii.gz output_thickness.nii.gz'
"""
_cmd = 'LaplacianThickness'
input_spec = LaplacianThicknessInputSpec
output_spec = LaplacianThicknessOutputSpec (and both EDITED: added a doctest (hopefully to cover @effigies' request) |
👍 to @oesteban's suggestion, including doctest. Consistency with the post-run outputs should already be tested in a more generic context (hopefully with a cheap interface). |
Guys, I am not sure if I am to do anything, or may be this could get merged and then altogether or instead be replaced with @oesteban 's version? |
I'm happy with whatever you prefer. Or if you want me to push to this branch. I just would like to see that we abandon gen_filename and genfile at some point in time 👍 |
@oesteban We can move to |
Without this fix it
output_name
is not provided (Closes genfile'ed output name "is not remembered" to be used later (in self.aggregate_outputs)? #2733)