Skip to content

Commit 4ed50ce

Browse files
committed
Merge pull request #635 from poldrack/master
try to determine output dir from fsf file
2 parents 8fea0b0 + f75555e commit 4ed50ce

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

nipype/interfaces/fsl/model.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,16 +384,26 @@ class FEAT(FSLCommand):
384384
def _list_outputs(self):
385385
outputs = self._outputs().get()
386386
is_ica = False
387+
outputs['feat_dir']=None
387388
with open(self.inputs.fsf_file, 'rt') as fp:
388389
text = fp.read()
389390
if "set fmri(inmelodic) 1" in text:
390391
is_ica = True
391-
392-
if is_ica:
393-
outputs['feat_dir'] = glob(os.path.join(os.getcwd(), '*ica'))[0]
394-
else:
395-
outputs['feat_dir'] = glob(os.path.join(os.getcwd(), '*feat'))[0]
396-
392+
for line in text.split('\n'):
393+
if line.find("set fmri(outputdir)")>-1:
394+
try:
395+
outputdir_spec=line.split('"')[-2]
396+
if os.path.exists(outputdir_spec):
397+
outputs['feat_dir']=outputdir_spec
398+
399+
except:
400+
pass
401+
if not outputs['feat_dir']:
402+
if is_ica:
403+
outputs['feat_dir'] = glob(os.path.join(os.getcwd(), '*ica'))[0]
404+
else:
405+
outputs['feat_dir'] = glob(os.path.join(os.getcwd(), '*feat'))[0]
406+
print 'Outputs from FEATmodel:',outputs
397407
return outputs
398408

399409

nipype/workflows/dmri/fsl/dti.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,7 @@ def create_susceptibility_correct_pipeline(name="susceptibility_correct", fieldm
521521

522522
# fugue -i %s -w %s --loadshift=%s --mask=%s % ( mag_name, magfw_name,
523523
# vsmmag_name, mask_name ), log ) # Forward Map
524-
vsm_fwd = pe.Node(interface=fsl.FUGUE(
525-
save_warped=True), name="vsm_fwd")
524+
vsm_fwd = pe.Node(interface=fsl.FUGUE(), name="vsm_fwd")
526525
vsm_reg = pe.Node(interface=fsl.FLIRT(bins=256, cost='corratio', dof=6, interp='spline', searchr_x=[
527526
-10, 10], searchr_y=[-10, 10], searchr_z=[-10, 10]), name="vsm_registration")
528527
# 'flirt -in %s -ref %s -out %s -init %s -applyxfm' % ( vsmmag_name, ref_epi, vsmmag_name, magfw_mat_out )

0 commit comments

Comments
 (0)