Skip to content

Commit

Permalink
Merge pull request #179 from oesteban/fix/178-tpm-label-order
Browse files Browse the repository at this point in the history
FIX: Make TPMs label ordering in ``io_spec.json`` consistent with workflow
  • Loading branch information
oesteban authored Apr 17, 2020
2 parents 076bda9 + 80a99d3 commit aa72658
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion smriprep/data/io_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"tpms": {
"datatype": "anat",
"label": [ "CSF", "WM", "GM"],
"label": [ "CSF", "GM", "WM"],
"suffix": "probseg"
}
},
Expand Down
1 change: 0 additions & 1 deletion smriprep/workflows/anatomical.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ def init_anat_preproc_wf(

anat_reports_wf.inputs.inputnode.source_file = fix_multi_T1w_source_name(
[existing_derivatives['t1w_preproc']])
anat_reports_wf.inputs.seg_rpt.colors = ['b', 'magenta']

stdselect = pe.Node(KeySelect(
fields=['std_preproc', 'std_mask'], keys=templates),
Expand Down
12 changes: 9 additions & 3 deletions smriprep/workflows/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

from ..interfaces import DerivativesDataSink

FSL_FAST_TISSUE_ORDER = ("CSF", "GM", "WM")


def init_anat_reports_wf(freesurfer, reportlets_dir,
name='anat_reports_wf'):
Expand All @@ -27,7 +29,7 @@ def init_anat_reports_wf(freesurfer, reportlets_dir,
inputnode = pe.Node(niu.IdentityInterface(fields=inputfields),
name='inputnode')

seg_rpt = pe.Node(ROIsPlot(colors=['magenta', 'b'], levels=[1.5, 2.5]),
seg_rpt = pe.Node(ROIsPlot(colors=['b', 'magenta'], levels=[1.5, 2.5]),
name='seg_rpt')

t1w_conform_check = pe.Node(niu.Function(
Expand Down Expand Up @@ -101,7 +103,7 @@ def init_anat_reports_wf(freesurfer, reportlets_dir,


def init_anat_derivatives_wf(bids_root, freesurfer, num_t1w, output_dir,
name='anat_derivatives_wf'):
name='anat_derivatives_wf', tpm_labels=FSL_FAST_TISSUE_ORDER):
"""Set up a battery of datasinks to store derivatives in the right location."""
workflow = Workflow(name=name)

Expand Down Expand Up @@ -165,7 +167,11 @@ def init_anat_derivatives_wf(bids_root, freesurfer, num_t1w, output_dir,
DerivativesDataSink(base_directory=output_dir, suffix='probseg',
compress=True),
name='ds_std_tpms', run_without_submitting=True)
ds_std_tpms.inputs.extra_values = ['label-CSF', 'label-GM', 'label-WM']

# CRITICAL: the sequence of labels here (CSF-GM-WM) is that of the output of FSL-FAST
# (intensity mean, per tissue). This order HAS to be matched also by the ``tpms``
# output in the data/io_spec.json file.
ds_std_tpms.inputs.extra_values = [f"label-{l}" for l in tpm_labels]

# Transforms
ds_t1w_tpl_inv_warp = pe.Node(
Expand Down

0 comments on commit aa72658

Please sign in to comment.