Skip to content

Commit 1437dc4

Browse files
committed
RF: Derive MRIsExpand from FSSurfaceCommand
1 parent d061186 commit 1437dc4

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

nipype/interfaces/freesurfer/base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,19 @@ def _normalize_filenames(self):
216216
def _associated_file(in_file, out_name):
217217
"""Based on MRIsBuildFileName in freesurfer/utils/mrisurf.c
218218
219+
If no path information is provided for out_name, use path and
220+
hemisphere (if also unspecified) from in_file to determine the path
221+
of the associated file.
219222
Use in_file prefix to indicate hemisphere for out_name, rather than
220223
inspecting the surface data structure.
221-
Also, output to in_file's directory if path information not provided
222-
for out_name.
223224
"""
224225
path, base = os.path.split(out_name)
225226
if path == '':
226227
path, in_file = os.path.split(in_file)
227228
hemis = ('lh.', 'rh.')
228229
if in_file[:3] in hemis and base[:3] not in hemis:
229230
base = in_file[:3] + base
230-
return os.path.abspath(os.path.join(path, base))
231+
return os.path.join(path, base)
231232

232233

233234
class FSScriptCommand(FSCommand):

nipype/interfaces/freesurfer/utils.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3037,7 +3037,7 @@ class MRIsExpandOutputSpec(TraitedSpec):
30373037
out_file = File(desc='Output surface file')
30383038

30393039

3040-
class MRIsExpand(FSCommand):
3040+
class MRIsExpand(FSSurfaceCommand):
30413041
"""
30423042
Expands a surface (typically ?h.white) outwards while maintaining
30433043
smoothness and self-intersection constraints.
@@ -3063,7 +3063,9 @@ def _list_outputs(self):
30633063
self.inputs.out_name)
30643064
return outputs
30653065

3066-
def _get_filecopy_info(self):
3066+
def _normalize_filenames(self):
3067+
""" Find full paths for pial, thickness and sphere files for copying
3068+
"""
30673069
in_file = self.inputs.in_file
30683070

30693071
pial = self.inputs.pial
@@ -3079,20 +3081,3 @@ def _get_filecopy_info(self):
30793081
thickness_name)
30803082

30813083
self.inputs.sphere = self._associated_file(in_file, self.inputs.sphere)
3082-
3083-
return super(MRIsExpand, self)._get_filecopy_info()
3084-
3085-
@staticmethod
3086-
def _associated_file(in_file, out_name):
3087-
"""Based on MRIsBuildFileName in freesurfer/utils/mrisurf.c
3088-
3089-
Use file prefix to indicate hemisphere, rather than inspecting the
3090-
surface data structure
3091-
"""
3092-
path, base = os.path.split(out_name)
3093-
if path == '':
3094-
path, in_file = os.path.split(in_file)
3095-
hemis = ('lh.', 'rh.')
3096-
if in_file[:3] in hemis and base[:3] not in hemis:
3097-
base = in_file[:3] + base
3098-
return os.path.join(path, base)

0 commit comments

Comments
 (0)