Skip to content

FIX: Fixes createTemplate function #1475

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

Merged
merged 1 commit into from
May 17, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions nipype/workflows/smri/freesurfer/autorecon1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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()
Expand All @@ -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

Expand Down