Skip to content
Merged
Prev Previous commit
Next Next commit
Fix MRIsCombine doctest and add necessary test file.
  • Loading branch information
tsalo committed Apr 9, 2017
commit 36fd9c18ed19ad10380be46cff38b7c4325989f2
10 changes: 5 additions & 5 deletions nipype/interfaces/freesurfer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,25 +989,25 @@ class MRIsCombine(FSCommand):
-------

>>> import nipype.interfaces.freesurfer as fs
>>> mris = fs.MRIsConvert()
>>> mris = fs.MRIsCombine()
>>> mris.inputs.in_file1 = 'lh.pial'
>>> mris.inputs.in_file2 = 'rh.pial'
>>> mris.inputs.out_file = 'bh.pial'
>>> mris.inputs.out_file = 'out.stl'
>>> mris.cmdline # doctest: +ALLOW_UNICODE
'mris_convert --combine_surfs lh.pial rh.pial bh.pial'
'mris_convert --combinesurfs lh.pial rh.pial out.stl'
>>> mris.run() # doctest: +SKIP
"""
_cmd = 'mris_convert'
input_spec = MRIsCombineInputSpec
output_spec = MRIsCombineOutputSpec

def _list_outputs(self):
outputs = self.output_spec().get()
if any(self.inputs.out_file.startswith(pre) for pre in ['lh.', 'rh.']):
outputs['out_file'] = self.inputs.out_file
else:
outputs['out_file'] = 'lh.' + self.inputs.out_file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For your doctest example, you're going to get lh.out.stl. Is that what mris_convert produces? And if so, is that the same whether you pass lh.pial or rh.pial as in_file1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I've seen:

  • mris_convert --combinesurfs lh.pial rh.pial out.stl creates lh.out.stl
  • mris_convert --combinesurfs rh.pial lh.pial out.stl creates lh.out.stl
  • mris_convert --combinesurfs rh.pial rh.smoothwm out.stl creates lh.out.stl
  • mris_convert --combinesurfs lh.pial rh.pial rh.out.stl creates rh.out.stl

So it doesn't seem to matter what order you pass in the files or even if both files are from the right hemisphere. As long as the output file doesn't start with lh. or rh., it will prepend lh. to the output filename.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha. That's awful. Can you add a short comment explaining that this is a FreeSurfer behavior you're accommodating?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an explanation to the docstring for _list_outputs in a7bafda. Should be clear now.


return outputs


Expand Down
Empty file added nipype/testing/data/rh.pial
Empty file.