Skip to content

Commit 05a8b0f

Browse files
authored
FIX: Clean up generated boilerplate (#200)
* FIX: Segmentation boilerplate * FIX: Add infantFS boilerplate / bibliography entry
1 parent bb28cd1 commit 05a8b0f

File tree

4 files changed

+39
-8
lines changed

4 files changed

+39
-8
lines changed

nibabies/data/boilerplate.bib

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,3 +379,16 @@ @article{uncinfant
379379
title = {Infant Brain Atlases from Neonates to 1- and 2-Year-Olds},
380380
journal = {{PLoS} {ONE}}
381381
}
382+
383+
@article{infantfs,
384+
doi = {10.1016/j.neuroimage.2020.116946},
385+
url = {https://doi.org/10.1016%2Fj.neuroimage.2020.116946},
386+
year = 2020,
387+
month = {sep},
388+
publisher = {Elsevier {BV}},
389+
volume = {218},
390+
pages = {116946},
391+
author = {Lilla Zöllei and Juan Eugenio Iglesias and Yangming Ou and P. Ellen Grant and Bruce Fischl},
392+
title = {Infant {FreeSurfer}: An automated segmentation and surface extraction pipeline for T1-weighted neuroimaging data of infants 0{\textendash}2 years},
393+
journal = {{NeuroImage}}
394+
}

nibabies/workflows/anatomical/base.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,6 @@ def init_infant_anat_wf(
165165
"""
166166
)
167167

168-
desc += """\
169-
Brain tissue segmentation of cerebrospinal fluid (CSF),
170-
white-matter (WM) and gray-matter (GM) was performed on
171-
the brain-extracted T1w using ANTs JointFusion, distributed with ANTs {ants_ver}.
172-
"""
173-
174168
wf.__desc__ = desc.format(
175169
ants_ver=ANTsInfo.version() or "(version unknown)",
176170
skullstrip_tpl=skull_strip_template.fullname,

nibabies/workflows/anatomical/segmentation.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,19 @@ def init_anat_segmentations_wf(
5252
name="outputnode",
5353
)
5454

55+
wf.__desc__ = """Brain tissue segmentation of cerebrospinal fluid (CSF),
56+
white-matter (WM) and gray-matter (GM) was performed on """
57+
5558
# Coerce segmentation labels to BIDS
5659
lut_anat_dseg = pe.Node(niu.Function(function=_apply_bids_lut), name="lut_anat_dseg")
5760

5861
if not any((precomp_aseg, template_dir)):
62+
from nipype.interfaces.fsl.base import Info as FSLInfo
63+
64+
wf.__desc__ += (
65+
f"the brain-extracted T1w using FSL FAST {FSLInfo.version() or '(version unknown)'}."
66+
)
67+
5968
# Use FSL FAST for segmentations
6069
anat_dseg = pe.Node(
6170
fsl.FAST(segments=True, no_bias=True, probability_maps=True),
@@ -81,7 +90,13 @@ def init_anat_segmentations_wf(
8190
return wf
8291

8392
# Joint Label Fusion
84-
if template_dir:
93+
elif template_dir:
94+
from nipype.interfaces.ants.base import Info as ANTsInfo
95+
96+
wf.__desc__ += (
97+
"the brain-extracted T1w using ANTs JointFusion, distributed with ANTs "
98+
f"{ANTsInfo.version() or '(version unknown)'}."
99+
)
85100
tmpl_anats, tmpl_segs = _parse_segmentation_atlases(anat_modality, template_dir)
86101

87102
# register to templates
@@ -145,6 +160,7 @@ def init_anat_segmentations_wf(
145160
# fmt:on
146161

147162
elif precomp_aseg:
163+
wf.__desc__ += "a pre-computed segmentation."
148164
from niworkflows.interfaces.header import ValidateImage
149165

150166
inputnode.inputs.anat_aseg = precomp_aseg

nibabies/workflows/anatomical/surfaces.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212

1313
def init_infant_surface_recon_wf(*, age_months, use_aseg=False, name="infant_surface_recon_wf"):
14-
wf = pe.Workflow(name=name)
14+
from niworkflows.engine.workflows import LiterateWorkflow
15+
16+
wf = LiterateWorkflow(name=name)
1517
inputnode = pe.Node(
1618
niu.IdentityInterface(
1719
fields=[
@@ -41,6 +43,12 @@ def init_infant_surface_recon_wf(*, age_months, use_aseg=False, name="infant_sur
4143
name="outputnode",
4244
)
4345

46+
wf.__desc__ = f"""\
47+
Brain surfaces were reconstructed using `infant_recon_all` [FreeSurfer
48+
{fs.Info().looseversion() or "<ver>"}, RRID:SCR_001847, @infantfs],
49+
leveraging the masked, preprocessed T1w and anatomical segmentation.
50+
"""
51+
4452
gen_recon_outdir = pe.Node(niu.Function(function=_gen_recon_dir), name="gen_recon_outdir")
4553

4654
# inject the intensity-normalized skull-stripped t1w from the brain extraction workflow

0 commit comments

Comments
 (0)