Skip to content

Commit 765f62b

Browse files
authored
Merge pull request #41 from mgxd/rel/0.0.3
REL: 0.0.3
2 parents b5d16d3 + cf5e4ee commit 765f62b

File tree

6 files changed

+103
-12
lines changed

6 files changed

+103
-12
lines changed

CHANGES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
## Changelog
22

3+
0.0.3 (March 17, 2021)
4+
-----------------------
5+
- Adds functional processing to the workflow
6+
- minus SDC and fine-grain subcortical CIFTI generation
7+
- Revision of T1w/T2w templates when multiple runs are detected
8+
- Modularization of T1w-T2w coregistration, with increased robustness
9+
- Removed of UNCInfant for a default output space
10+
311
0.0.2 (Feb 18, 2021)
412
--------------------
513
- Improved robustness of structural coregistration

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,13 @@ RUN python -c "from matplotlib import font_manager" && \
205205
RUN pip install --no-cache-dir templateflow && \
206206
rm -rf $HOME/.cache/pip
207207

208-
RUN python -c "from templateflow import api as tfapi; \
209-
tfapi.get('MNIInfant', cohort=1); \
210-
tfapi.get('UNCInfant', cohort=1);"
211-
212208
WORKDIR /src
213209
COPY . nibabies
214210
WORKDIR /src/nibabies
215211

212+
# fetch the necessary templateflow files
213+
RUN python scripts/fetch_templates.py
214+
216215
RUN pip install --no-cache-dir -e .[all] && \
217216
rm -rf $HOME/.cache/pip
218217

nibabies/workflows/anatomical/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ def init_infant_anat_wf(
7474
surfaces
7575
GIFTI surfaces (gray/white boundary, midthickness, pial, inflated)
7676
"""
77-
from nipype.interfaces.base import Undefined
7877
from nipype.interfaces.ants.base import Info as ANTsInfo
7978
from smriprep.workflows.outputs import init_anat_derivatives_wf
8079

nibabies/workflows/bold/confounds.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ def init_bold_confs_wf(
218218
ACompCor(components_file='acompcor.tsv', header_prefix='a_comp_cor_', pre_filter='cosine',
219219
save_pre_filter=True, save_metadata=True, mask_names=['CSF', 'WM', 'combined'],
220220
merge_method='none', failure_mode='NaN'),
221-
name="acompcor", mem_gb=8, nprocs=6) # TODO: Lessen expensive restrictions
221+
name="acompcor", mem_gb=mem_gb, n_procs=6 # TODO: Lessen expensive restrictions
222+
)
222223

223224
tcompcor = pe.Node(
224225
TCompCor(components_file='tcompcor.tsv', header_prefix='t_comp_cor_', pre_filter='cosine',
@@ -245,8 +246,10 @@ def init_bold_confs_wf(
245246
]
246247
merge_rois = pe.Node(niu.Merge(3, ravel_inputs=True), name='merge_rois',
247248
run_without_submitting=True)
248-
signals = pe.Node(SignalExtraction(class_labels=signals_class_labels),
249-
name="signals", mem_gb=8, n_procs=6) # TODO: Lessen expensive restrictions
249+
signals = pe.Node(
250+
SignalExtraction(class_labels=signals_class_labels),
251+
name="signals", mem_gb=mem_gb, n_procs=6 # TODO: Lessen expensive restrictions
252+
)
250253

251254
# Arrange confounds
252255
add_dvars_header = pe.Node(
@@ -293,8 +296,10 @@ def init_bold_confs_wf(
293296
# Generate reportlet (ROIs)
294297
mrg_compcor = pe.Node(niu.Merge(2, ravel_inputs=True),
295298
name='mrg_compcor', run_without_submitting=True)
296-
rois_plot = pe.Node(ROIsPlot(colors=['b', 'magenta'], generate_report=True),
297-
name='rois_plot', mem_gb=4) # TODO: Lessen expensive restrictions
299+
rois_plot = pe.Node(
300+
ROIsPlot(colors=['b', 'magenta'], generate_report=True),
301+
name='rois_plot', mem_gb=mem_gb, n_procs=6 # 4 TODO: Lessen expensive restrictions
302+
)
298303

299304
ds_report_bold_rois = pe.Node(
300305
DerivativesDataSink(desc='rois', datatype="figures", dismiss_entities=("echo",)),
@@ -453,7 +458,6 @@ def init_carpetplot_wf(mem_gb, metadata, cifti_output, name="bold_carpet_wf"):
453458
454459
"""
455460
from niworkflows.engine.workflows import LiterateWorkflow as Workflow
456-
from niworkflows.interfaces.fixes import FixHeaderApplyTransforms as ApplyTransforms
457461

458462
inputnode = pe.Node(niu.IdentityInterface(
459463
fields=['bold', 'bold_mask', 'confounds_file',

nibabies/workflows/bold/resampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def init_bold_std_trans_wf(
339339
name='bold_to_std_transform', mem_gb=mem_gb * 3 * omp_nthreads, n_procs=omp_nthreads)
340340

341341
merge = pe.Node(Merge(compress=use_compression), name='merge',
342-
mem_gb=3) # TODO: Lessen expensive restrictions
342+
mem_gb=mem_gb * 3) # TODO: Lessen expensive restrictions
343343

344344
# Generate a reference on the target standard space
345345
# TODO: Replace with masking interface?

scripts/fetch_templates.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env python
2+
3+
"Pre-emptive caching of commonly used TemplateFlow templates"
4+
import templateflow.api as tf
5+
6+
7+
def fetch_MNI6():
8+
"""
9+
Expected templates:
10+
11+
tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-01_T1w.nii.gz
12+
tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_T1w.nii.gz
13+
tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-01_desc-brain_mask.nii.gz
14+
tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_desc-brain_mask.nii.gz
15+
tpl-MNI152NLin6Asym/tpl-MNI152NLin6Asym_res-02_atlas-HCP_dseg.nii.gz
16+
"""
17+
template = 'MNI152NLin6Asym'
18+
19+
tf.get(template, resolution=(1, 2), desc=None, suffix='T1w')
20+
tf.get(template, resolution=(1, 2), desc='brain', suffix='mask')
21+
# CIFTI
22+
tf.get(template, resolution=2, atlas='HCP', suffix='dseg')
23+
24+
25+
def fetch_UNCInfant():
26+
"""
27+
Expected templates:
28+
29+
tpl-UNCInfant/cohort-1/tpl-UNCInfant_cohort-1_T1w.nii.gz
30+
tpl-UNCInfant/cohort-1/tpl-UNCInfant_cohort-1_label-brain_probseg.nii.gz
31+
tpl-UNCInfant/cohort-1/tpl-UNCInfant_cohort-1_label-brain_mask.nii.gz
32+
tpl-UNCInfant/cohort-1/tpl-UNCInfant_cohort-1_label-BrainCerebellumExtraction_mask.nii.gz
33+
"""
34+
template = "UNCInfant"
35+
36+
tf.get(template, cohort=1, desc=None, suffix='T1w')
37+
tf.get(template, cohort=1, label='brain', suffix='probseg')
38+
tf.get(template, cohort=1, label='brain', suffix='mask')
39+
tf.get(template, cohort=1, label='BrainCerebellumExtraction', suffix='mask')
40+
41+
42+
def fetch_fsaverage():
43+
"""
44+
Expected templates:
45+
46+
tpl-fsaverage/tpl-fsaverage_hemi-L_den-164k_desc-std_sphere.surf.gii
47+
tpl-fsaverage/tpl-fsaverage_hemi-R_den-164k_desc-std_sphere.surf.gii
48+
tpl-fsaverage/tpl-fsaverage_hemi-L_den-164k_desc-vaavg_midthickness.shape.gii
49+
tpl-fsaverage/tpl-fsaverage_hemi-R_den-164k_desc-vaavg_midthickness.shape.gii
50+
"""
51+
template = 'fsaverage'
52+
53+
tf.get(template, density='164k', desc='std', suffix='sphere')
54+
tf.get(template, density='164k', desc='vaavg', suffix='midthickness')
55+
56+
57+
def fetch_fsLR():
58+
"""
59+
Expected templates:
60+
61+
tpl-fsLR/tpl-fsLR_hemi-L_den-32k_desc-nomedialwall_dparc.label.gii
62+
tpl-fsLR/tpl-fsLR_hemi-L_den-32k_desc-vaavg_midthickness.shape.gii
63+
tpl-fsLR/tpl-fsLR_hemi-L_den-32k_sphere.surf.gii
64+
tpl-fsLR/tpl-fsLR_hemi-R_den-32k_desc-nomedialwall_dparc.label.gii
65+
tpl-fsLR/tpl-fsLR_hemi-R_den-32k_desc-vaavg_midthickness.shape.gii
66+
tpl-fsLR/tpl-fsLR_hemi-R_den-32k_sphere.surf.gii
67+
tpl-fsLR/tpl-fsLR_space-fsaverage_hemi-L_den-32k_sphere.surf.gii
68+
tpl-fsLR/tpl-fsLR_space-fsaverage_hemi-R_den-32k_sphere.surf.gii
69+
"""
70+
tf.get('fsLR', density='32k')
71+
72+
73+
def main():
74+
fetch_MNI6()
75+
fetch_UNCInfant()
76+
fetch_fsaverage()
77+
fetch_fsLR()
78+
79+
80+
if __name__ == "__main__":
81+
main()

0 commit comments

Comments
 (0)