Skip to content

Commit 9b5371f

Browse files
author
bpinsard
committed
resume overwrite cmdline
1 parent fbe75cf commit 9b5371f

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

nipype/interfaces/base.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,16 +1377,13 @@ def _run_interface(self, runtime, correct_return_codes=[0]):
13771377
setattr(runtime, 'command_path', cmd_path)
13781378
setattr(runtime, 'dependencies', get_dependencies(executable_name,
13791379
runtime.environ))
1380-
runtime = self._run_command(runtime,output=self.inputs.terminal_output)
1380+
runtime = run_command(runtime, output=self.inputs.terminal_output)
13811381
if runtime.returncode is None or \
13821382
runtime.returncode not in correct_return_codes:
13831383
self.raise_exception(runtime)
13841384

13851385
return runtime
13861386

1387-
def _run_command(self, runtime, output):
1388-
return run_command(runtime, output=output)
1389-
13901387
def _exists_in_path(self, cmd, environ):
13911388
'''
13921389
Based on a code snippet from

nipype/interfaces/freesurfer/preprocess.py

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,14 @@ def _list_outputs(self):
748748
outputs['subjects_dir'] = subjects_dir
749749
return outputs
750750

751-
def _resume_cmdline(self):
751+
752+
def cmdline(self):
753+
subjects_dir = self.inputs.subjects_dir
754+
if not isdefined(subjects_dir):
755+
subjects_dir = self._gen_subjects_dir()
756+
if not os.path.isdir(
757+
os.path.join(subjects_dir,self.inputs.subject_id,'mri')):
758+
return super(ReconAll, self).cmdline
752759
self._check_mandatory_inputs()
753760
skip = ['T1_files']
754761
subjects_dir = self.inputs.subjects_dir
@@ -770,20 +777,10 @@ def _resume_cmdline(self):
770777
self.inputs.directive = directive
771778
allargs = self._parse_inputs(skip=skip)
772779
allargs.insert(0, self.cmd)
773-
return ' '.join(allargs)
780+
cmd = ' '.join(allargs)
781+
iflogger.info('resume recon-all : %s'%cmd)
782+
return cmd
774783

775-
def _run_command(self, runtime, output):
776-
if isdefined(self.inputs.subjects_dir):
777-
subjects_dir = self.inputs.subjects_dir
778-
else:
779-
subjects_dir = self._gen_subjects_dir()
780-
if os.path.isdir(os.path.join(subjects_dir,
781-
self.inputs.subject_id,'mri')):
782-
setattr(runtime, 'cmdline', self._resume_cmdline())
783-
iflogger.info('resume recon-all : %s'%runtime.cmdline)
784-
runtime = run_command(runtime, output=self.inputs.terminal_output)
785-
return super(ReconAll,self)._run_command(runtime, output)
786-
787784

788785
class BBRegisterInputSpec(FSTraitedSpec):
789786
subject_id = traits.Str(argstr='--s %s',

nipype/interfaces/freesurfer/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ class ExtractMainComponent(CommandLine):
10481048
>>> from nipype.interfaces.freesurfer import ExtractMainComponent
10491049
>>> mcmp = ExtractMainComponent(in_file='lh.white')
10501050
>>> mcmp.cmdline
1051-
'mris_extract_main_component lh.white'
1051+
'mris_extract_main_component lh.white lh.white_maincmp'
10521052
10531053
"""
10541054

0 commit comments

Comments
 (0)