Skip to content

Commit 01b84a9

Browse files
author
David Ellis
committed
ENH: Removes the relabels hypointensities for 5.3.
1 parent 6c9886f commit 01b84a9

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

nipype/interfaces/freesurfer/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2839,7 +2839,12 @@ def run(self, **inputs):
28392839
def _format_arg(self, name, spec, value):
28402840
if name == 'aseg':
28412841
# aseg does not take a full filename
2842-
return spec.argstr % os.path.basename(value).replace('.mgz', '')
2842+
basename = os.path.basename(value).replace('.mgz', '')
2843+
if basename != 'aseg':
2844+
return spec.argstr % basename
2845+
else:
2846+
# aseg.mgz is the default
2847+
return
28432848
elif name == 'out_file':
28442849
return spec.argstr % os.path.abspath(value)
28452850

nipype/workflows/smri/freesurfer/autorecon3.py

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -550,14 +550,6 @@ def create_AutoRecon3(name="AutoRecon3", qcache=False, plugin_args=None,
550550
#End hemisphere2 workflow
551551

552552

553-
# Relabel Hypointensities
554-
relabel_hypos = pe.Node(RelabelHypointensities(), name="Relabel_Hypointensities")
555-
relabel_hypos.inputs.out_file = 'aseg.presurf.hypos.mgz'
556-
ar3_wf.connect([(inputspec, relabel_hypos, [('aseg_presurf', 'aseg'),
557-
('lh_white', 'lh_white'),
558-
('rh_white', 'rh_white'),
559-
])])
560-
561553
# APARC to ASEG
562554
# Adds information from the ribbon into the aseg.mgz (volume parcellation).
563555
aparc_2_aseg = pe.Node(Aparc2Aseg(), name="Aparc2Aseg")
@@ -578,9 +570,17 @@ def create_AutoRecon3(name="AutoRecon3", qcache=False, plugin_args=None,
578570
(volume_mask, aparc_2_aseg, [('rh_ribbon', 'rh_ribbon'),
579571
('lh_ribbon', 'lh_ribbon'),
580572
('out_ribbon', 'ribbon'),
581-
]),
582-
(relabel_hypos, aparc_2_aseg, [('out_file', 'aseg')])
583-
])
573+
])])
574+
if fsvernum < 6:
575+
ar3_wf.connect([(inputspec, aparc_2_aseg, [('aseg_presurf', 'aseg')])])
576+
else:
577+
# Relabel Hypointensities
578+
relabel_hypos = pe.Node(RelabelHypointensities(), name="Relabel_Hypointensities")
579+
relabel_hypos.inputs.out_file = 'aseg.presurf.hypos.mgz'
580+
ar3_wf.connect([(inputspec, relabel_hypos, [('aseg_presurf', 'aseg'),
581+
('lh_white', 'lh_white'),
582+
('rh_white', 'rh_white')])])
583+
ar3_wf.connect([(relabel_hypos, aparc_2_aseg, [('out_file', 'aseg')])])
584584

585585
aparc_2_aseg_2009 = pe.Node(Aparc2Aseg(), name="Aparc2Aseg_2009")
586586
aparc_2_aseg_2009.inputs.volmask = True
@@ -601,14 +601,12 @@ def create_AutoRecon3(name="AutoRecon3", qcache=False, plugin_args=None,
601601
(volume_mask, aparc_2_aseg_2009, [('rh_ribbon', 'rh_ribbon'),
602602
('lh_ribbon',
603603
'lh_ribbon'),
604-
('out_ribbon', 'ribbon'),
605-
]),
606-
(relabel_hypos, aparc_2_aseg_2009, [('out_file', 'aseg')])
607-
])
604+
('out_ribbon', 'ribbon')])])
608605

609606
if fsvernum > 6:
610607
apas_2_aseg = pe.Node(Apas2Aseg(), name="Apas_2_Aseg")
611-
ar3_wf.connect([(aparc_2_aseg, apas_2_aseg, [('out_file', 'in_file')])])
608+
ar3_wf.connect([(aparc_2_aseg, apas_2_aseg, [('out_file', 'in_file')]),
609+
(relabel_hypos, aparc_2_aseg_2009, [('out_file', 'aseg')])])
612610
else:
613611
# aseg.mgz gets edited in place, so we'll copy and pass it to the
614612
# outputspec once aparc_2_aseg has completed
@@ -702,8 +700,7 @@ def out_aseg(in_aparcaseg, in_aseg, out_file):
702700
('out_ribbon', 'ribbon'),
703701
]),
704702
(apas_2_aseg, wm_parcellation, [('out_file', 'aseg')]),
705-
(aparc_2_aseg, wm_parcellation, [('out_file', 'ctxseg')])
706-
])
703+
(aparc_2_aseg, wm_parcellation, [('out_file', 'ctxseg')])])
707704

708705
if fsvernum < 6:
709706
ar3_wf.connect([(inputspec, wm_parcellation, [('filled', 'filled')])])
@@ -745,7 +742,6 @@ def out_aseg(in_aparcaseg, in_aseg, out_file):
745742
ar3_wf.connect(inputspec, 'aseg_presurf', wm_segstats, 'aseg')
746743

747744

748-
749745
# add brodman area maps to the workflow
750746
ba_WF, ba_outputs = create_ba_maps_wf(th3=th3, exvivo=exvivo,
751747
entorhinal=entorhinal)
@@ -937,11 +933,12 @@ def out_aseg(in_aparcaseg, in_aseg, out_file):
937933
(segstats, outputspec, [('summary_file', 'aseg_stats')]),
938934
(aparc_2_aseg_2009, outputspec, [('out_file', 'aparc_a2009s_aseg')]),
939935
(aparc_2_aseg, outputspec, [('out_file', 'aparc_aseg')]),
940-
(relabel_hypos, outputspec, [('out_file', 'aseg_presurf_hypos')]),
941936
(volume_mask, outputspec, [('out_ribbon', 'ribbon'),
942937
('lh_ribbon', 'lh_ribbon'),
943-
('rh_ribbon', 'rh_ribbon')]),
944-
])
938+
('rh_ribbon', 'rh_ribbon')])])
939+
if fsvernum < 6:
940+
ar3_wf.connect([(relabel_hypos, outputspec, [('out_file', 'aseg_presurf_hypos')])])
941+
945942

946943
for i, outputs in enumerate([hemi_outputs1, hemi_outputs2]):
947944
if i == 0:

0 commit comments

Comments
 (0)