From f00ae36fca08b97975dfe3fc594065049039ee56 Mon Sep 17 00:00:00 2001 From: David Ellis Date: Mon, 16 May 2016 09:35:49 -0500 Subject: [PATCH] FIX: Fixes createTemplate function --- nipype/workflows/smri/freesurfer/autorecon1.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nipype/workflows/smri/freesurfer/autorecon1.py b/nipype/workflows/smri/freesurfer/autorecon1.py index 84fa6780ce..ddff03a64b 100644 --- a/nipype/workflows/smri/freesurfer/autorecon1.py +++ b/nipype/workflows/smri/freesurfer/autorecon1.py @@ -167,6 +167,7 @@ def createTemplate(in_files, out_file): import os import shutil if len(in_files) == 1: + # if only 1 T1 scan given, no need to run RobustTemplate print("WARNING: only one run found. This is OK, but motion correction " + "cannot be performed on one run, so I'll copy the run to rawavg " + "and continue.") @@ -175,7 +176,7 @@ def createTemplate(in_files, out_file): transforms = None else: from nipype.interfaces.freesurfer import RobustTemplate - # if multiple T1 scans are given + # if multiple T1 scans are given run RobustTemplate intensity_scales = [os.path.basename(f.replace('.mgz', '-iscale.txt')) for f in in_files] transforms = [os.path.basename(f.replace('.mgz', '.lta')) for f in in_files] robtemp = RobustTemplate() @@ -190,10 +191,11 @@ def createTemplate(in_files, out_file): robtemp.inputs.transform_outputs = transforms robtemp.inputs.subsample_threshold = 200 robtemp.inputs.intensity_scaling = True - robtemp.run() - intensity_scales = [os.path.abspath(f) for f in robtemp.outputs.scaled_intensity_outputs] - transforms = [os.path.abspath(f) for f in robtemp.outputs.transform_outputs] - out_file = robtemp.outputs.out_file + robtemp_result = robtemp.run() + # collect the outputs from RobustTemplate + out_file = robtemp_result.outputs.out_file + intensity_scales = [os.path.abspath(f) for f in robtemp_result.outputs.scaled_intensity_outputs] + transforms = [os.path.abspath(f) for f in robtemp_result.outputs.transform_outputs] out_file = os.path.abspath(out_file) return out_file, intensity_scales, transforms