Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .circleci/ds005_partial_fasttrack_outputs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,28 @@ sub-01/anat/sub-01_hemi-R_desc-preproc_white.surf.gii
sub-01/anat/sub-01_hemi-R_desc-reg_sphere.surf.gii
sub-01/anat/sub-01_hemi-R_space-fsLR_desc-msmsulc_sphere.surf.gii
sub-01/anat/sub-01_hemi-R_space-fsLR_desc-reg_sphere.surf.gii
sub-01/anat/sub-01_space-fsLR_den-91k_desc-preproc_curv.dscalar.nii
sub-01/anat/sub-01_space-fsLR_den-91k_desc-preproc_curv.json
sub-01/anat/sub-01_space-fsLR_den-91k_desc-preproc_sulc.dscalar.nii
sub-01/anat/sub-01_space-fsLR_den-91k_desc-preproc_sulc.json
sub-01/anat/sub-01_space-fsLR_den-91k_desc-preproc_thickness.dscalar.nii
sub-01/anat/sub-01_space-fsLR_den-91k_desc-preproc_thickness.json
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_desc-brain_mask.json
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_desc-preproc_dseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_desc-preproc_T1w.json
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_label-CSF_desc-preproc_probseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_label-GM_desc-preproc_probseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_label-WM_desc-preproc_probseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin6Asym_desc-brain_mask.json
sub-01/anat/sub-01_space-MNI152NLin6Asym_desc-brain_mask.nii.gz
sub-01/anat/sub-01_space-MNI152NLin6Asym_desc-preproc_dseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin6Asym_desc-preproc_T1w.json
sub-01/anat/sub-01_space-MNI152NLin6Asym_desc-preproc_T1w.nii.gz
sub-01/anat/sub-01_space-MNI152NLin6Asym_label-CSF_desc-preproc_probseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin6Asym_label-GM_desc-preproc_probseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin6Asym_label-WM_desc-preproc_probseg.nii.gz
sub-01/fmap
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz
Expand Down
22 changes: 22 additions & 0 deletions .circleci/ds005_partial_outputs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,28 @@ sub-01/anat/sub-01_hemi-R_white.surf.gii
sub-01/anat/sub-01_label-CSF_probseg.nii.gz
sub-01/anat/sub-01_label-GM_probseg.nii.gz
sub-01/anat/sub-01_label-WM_probseg.nii.gz
sub-01/anat/sub-01_space-fsLR_den-91k_curv.dscalar.nii
sub-01/anat/sub-01_space-fsLR_den-91k_curv.json
sub-01/anat/sub-01_space-fsLR_den-91k_sulc.dscalar.nii
sub-01/anat/sub-01_space-fsLR_den-91k_sulc.json
sub-01/anat/sub-01_space-fsLR_den-91k_thickness.dscalar.nii
sub-01/anat/sub-01_space-fsLR_den-91k_thickness.json
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_desc-brain_mask.json
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_desc-preproc_T1w.json
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_dseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin6Asym_desc-brain_mask.json
sub-01/anat/sub-01_space-MNI152NLin6Asym_desc-brain_mask.nii.gz
sub-01/anat/sub-01_space-MNI152NLin6Asym_desc-preproc_T1w.json
sub-01/anat/sub-01_space-MNI152NLin6Asym_desc-preproc_T1w.nii.gz
sub-01/anat/sub-01_space-MNI152NLin6Asym_dseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin6Asym_label-CSF_probseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin6Asym_label-GM_probseg.nii.gz
sub-01/anat/sub-01_space-MNI152NLin6Asym_label-WM_probseg.nii.gz
sub-01/fmap
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz
sub-01/fmap/sub-01_run-02_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz
Expand Down
10 changes: 10 additions & 0 deletions .circleci/ds054_fasttrack_outputs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ logs/CITATION.html
logs/CITATION.md
logs/CITATION.tex
sub-100185
sub-100185/anat
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.json
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.nii.gz
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_desc-preproc_dseg.json
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_desc-preproc_dseg.nii.gz
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_desc-preproc_T1w.json
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_desc-preproc_T1w.nii.gz
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_label-CSF_desc-preproc_probseg.nii.gz
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_label-GM_desc-preproc_probseg.nii.gz
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_label-WM_desc-preproc_probseg.nii.gz
sub-100185/fmap
sub-100185/fmap/sub-100185_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz
sub-100185/fmap/sub-100185_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz
Expand Down
9 changes: 9 additions & 0 deletions .circleci/ds054_outputs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ sub-100185/anat/sub-100185_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5
sub-100185/anat/sub-100185_label-CSF_probseg.nii.gz
sub-100185/anat/sub-100185_label-GM_probseg.nii.gz
sub-100185/anat/sub-100185_label-WM_probseg.nii.gz
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.json
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.nii.gz
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_desc-preproc_T1w.json
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_desc-preproc_T1w.nii.gz
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_dseg.json
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_dseg.nii.gz
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_label-CSF_probseg.nii.gz
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_label-GM_probseg.nii.gz
sub-100185/anat/sub-100185_space-MNI152NLin2009cAsym_res-2_label-WM_probseg.nii.gz
sub-100185/fmap
sub-100185/fmap/sub-100185_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz
sub-100185/fmap/sub-100185_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz
Expand Down
9 changes: 9 additions & 0 deletions .circleci/ds210_fasttrack_outputs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ logs/CITATION.html
logs/CITATION.md
logs/CITATION.tex
sub-02
sub-02/anat
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-brain_mask.json
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-preproc_dseg.nii.gz
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-preproc_T1w.json
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-CSF_desc-preproc_probseg.nii.gz
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-GM_desc-preproc_probseg.nii.gz
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-WM_desc-preproc_probseg.nii.gz
sub-02/fmap
sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz
sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz
Expand Down
8 changes: 8 additions & 0 deletions .circleci/ds210_outputs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ sub-02/anat/sub-02_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5
sub-02/anat/sub-02_label-CSF_probseg.nii.gz
sub-02/anat/sub-02_label-GM_probseg.nii.gz
sub-02/anat/sub-02_label-WM_probseg.nii.gz
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-brain_mask.json
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-preproc_T1w.json
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_dseg.nii.gz
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz
sub-02/anat/sub-02_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz
sub-02/fmap
sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-coeff0_fieldmap.nii.gz
sub-02/fmap/sub-02_run-01_fmapid-auto00000_desc-coeff1_fieldmap.nii.gz
Expand Down
122 changes: 114 additions & 8 deletions fmriprep/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,18 @@ def init_single_subject_wf(subject_id: str):
from niworkflows.utils.misc import fix_multi_T1w_source_name
from niworkflows.utils.spaces import Reference
from smriprep.workflows.anatomical import init_anat_fit_wf
from smriprep.workflows.outputs import init_template_iterator_wf
from smriprep.workflows.outputs import (
init_ds_anat_volumes_wf,
init_ds_grayord_metrics_wf,
init_ds_surface_metrics_wf,
init_template_iterator_wf,
)
from smriprep.workflows.surfaces import (
init_gifti_morphometrics_wf,
init_hcp_morphometrics_wf,
init_morph_grayords_wf,
init_resample_midthickness_wf,
)

from fmriprep.workflows.bold.base import init_bold_wf

Expand Down Expand Up @@ -302,10 +313,14 @@ def init_single_subject_wf(subject_id: str):
run_without_submitting=True,
)

bids_root = str(config.execution.bids_dir)
fmriprep_dir = str(config.execution.fmriprep_dir)
omp_nthreads = config.nipype.omp_nthreads

# Build the workflow
anat_fit_wf = init_anat_fit_wf(
bids_root=str(config.execution.bids_dir),
output_dir=str(config.execution.fmriprep_dir),
bids_root=bids_root,
output_dir=fmriprep_dir,
freesurfer=config.workflow.run_reconall,
hires=config.workflow.hires,
longitudinal=config.workflow.longitudinal,
Expand All @@ -316,7 +331,7 @@ def init_single_subject_wf(subject_id: str):
skull_strip_template=Reference.from_string(config.workflow.skull_strip_template)[0],
spaces=spaces,
precomputed=anatomical_cache,
omp_nthreads=config.nipype.omp_nthreads,
omp_nthreads=omp_nthreads,
sloppy=config.execution.sloppy,
skull_strip_fixed_seed=config.workflow.skull_strip_fixed_seed,
)
Expand Down Expand Up @@ -347,11 +362,30 @@ def init_single_subject_wf(subject_id: str):
if config.workflow.level == "full":
if spaces.cached.get_spaces(nonstandard=False, dim=(3,)):
template_iterator_wf = init_template_iterator_wf(spaces=spaces)
ds_std_volumes_wf = init_ds_anat_volumes_wf(
bids_root=bids_root,
output_dir=fmriprep_dir,
name="ds_std_volumes_wf",
)
workflow.connect([
(anat_fit_wf, template_iterator_wf, [
('outputnode.template', 'inputnode.template'),
('outputnode.anat2std_xfm', 'inputnode.anat2std_xfm'),
]),
(anat_fit_wf, ds_std_volumes_wf, [
('outputnode.t1w_valid_list', 'inputnode.source_files'),
("outputnode.t1w_preproc", "inputnode.t1w_preproc"),
("outputnode.t1w_mask", "inputnode.t1w_mask"),
("outputnode.t1w_dseg", "inputnode.t1w_dseg"),
("outputnode.t1w_tpms", "inputnode.t1w_tpms"),
]),
(template_iterator_wf, ds_std_volumes_wf, [
("outputnode.std_t1w", "inputnode.ref_file"),
("outputnode.anat2std_xfm", "inputnode.anat2std_xfm"),
("outputnode.space", "inputnode.space"),
("outputnode.cohort", "inputnode.cohort"),
("outputnode.resolution", "inputnode.resolution"),
]),
]) # fmt:skip

if 'MNI152NLin2009cAsym' in spaces.get_spaces():
Expand Down Expand Up @@ -395,6 +429,73 @@ def init_single_subject_wf(subject_id: str):
]),
]) # fmt:skip

# Create CIFTI morphometrics
curv_wf = init_gifti_morphometrics_wf(morphometrics=['curv'], name='curv_wf')
hcp_morphometrics_wf = init_hcp_morphometrics_wf(omp_nthreads=omp_nthreads)
morph_grayords_wf = init_morph_grayords_wf(
grayord_density=config.workflow.cifti_output,
omp_nthreads=omp_nthreads,
)
resample_midthickness_wf = init_resample_midthickness_wf(
grayord_density=config.workflow.cifti_output,
)
ds_grayord_metrics_wf = init_ds_grayord_metrics_wf(
bids_root=bids_root,
output_dir=fmriprep_dir,
metrics=["curv", "thickness", "sulc"],
cifti_output=config.workflow.cifti_output,
)

workflow.connect([
(anat_fit_wf, curv_wf, [
("outputnode.subject_id", "inputnode.subject_id"),
("outputnode.subjects_dir", "inputnode.subjects_dir"),
]),
(anat_fit_wf, hcp_morphometrics_wf, [
("outputnode.subject_id", "inputnode.subject_id"),
("outputnode.thickness", "inputnode.thickness"),
("outputnode.sulc", "inputnode.sulc"),
("outputnode.midthickness", "inputnode.midthickness"),
]),
(curv_wf, hcp_morphometrics_wf, [
("outputnode.curv", "inputnode.curv"),
]),
(anat_fit_wf, resample_midthickness_wf, [
('outputnode.midthickness', 'inputnode.midthickness'),
(
f"outputnode.sphere_reg_{'msm' if msm_sulc else 'fsLR'}",
"inputnode.sphere_reg_fsLR",
),
]),
(anat_fit_wf, morph_grayords_wf, [
("outputnode.midthickness", "inputnode.midthickness"),
(
f'outputnode.sphere_reg_{"msm" if msm_sulc else "fsLR"}',
'inputnode.sphere_reg_fsLR',
),
]),
(hcp_morphometrics_wf, morph_grayords_wf, [
("outputnode.curv", "inputnode.curv"),
("outputnode.thickness", "inputnode.thickness"),
("outputnode.sulc", "inputnode.sulc"),
("outputnode.roi", "inputnode.roi"),
]),
(resample_midthickness_wf, morph_grayords_wf, [
('outputnode.midthickness_fsLR', 'inputnode.midthickness_fsLR'),
]),
(anat_fit_wf, ds_grayord_metrics_wf, [
('outputnode.t1w_valid_list', 'inputnode.source_files'),
]),
(morph_grayords_wf, ds_grayord_metrics_wf, [
("outputnode.curv_fsLR", "inputnode.curv"),
("outputnode.curv_metadata", "inputnode.curv_metadata"),
("outputnode.thickness_fsLR", "inputnode.thickness"),
("outputnode.thickness_metadata", "inputnode.thickness_metadata"),
("outputnode.sulc_fsLR", "inputnode.sulc"),
("outputnode.sulc_metadata", "inputnode.sulc_metadata"),
]),
]) # fmt:skip

if config.workflow.anat_only:
return clean_datasinks(workflow)

Expand All @@ -421,8 +522,8 @@ def init_single_subject_wf(subject_id: str):
fmap_wf = init_fmap_preproc_wf(
debug="fieldmaps" in config.execution.debug,
estimators=fmap_estimators,
omp_nthreads=config.nipype.omp_nthreads,
output_dir=str(config.execution.fmriprep_dir),
omp_nthreads=omp_nthreads,
output_dir=fmriprep_dir,
subject=subject_id,
)
fmap_wf.__desc__ = f"""
Expand Down Expand Up @@ -481,7 +582,7 @@ def init_single_subject_wf(subject_id: str):
s.metadata for s in estimator.sources if s.suffix in ("bold", "sbref")
]
syn_preprocessing_wf = init_syn_preprocessing_wf(
omp_nthreads=config.nipype.omp_nthreads,
omp_nthreads=omp_nthreads,
debug=config.execution.sloppy,
auto_bold_nss=True,
t1w_inversion=False,
Expand Down Expand Up @@ -561,7 +662,6 @@ def init_single_subject_wf(subject_id: str):
('outputnode.white', 'inputnode.white'),
('outputnode.pial', 'inputnode.pial'),
('outputnode.midthickness', 'inputnode.midthickness'),
('outputnode.thickness', 'inputnode.thickness'),
('outputnode.anat_ribbon', 'inputnode.anat_ribbon'),
(
f'outputnode.sphere_reg_{"msm" if msm_sulc else "fsLR"}',
Expand Down Expand Up @@ -609,6 +709,12 @@ def init_single_subject_wf(subject_id: str):
workflow.connect([
(select_MNI6_xfm, bold_wf, [("anat2std_xfm", "inputnode.anat2mni6_xfm")]),
(select_MNI6_tpl, bold_wf, [("brain_mask", "inputnode.mni6_mask")]),
(hcp_morphometrics_wf, bold_wf, [
("outputnode.roi", "inputnode.cortex_mask"),
]),
(resample_midthickness_wf, bold_wf, [
('outputnode.midthickness_fsLR', 'inputnode.midthickness_fsLR'),
]),
]) # fmt:skip

return clean_datasinks(workflow)
Expand Down
9 changes: 5 additions & 4 deletions fmriprep/workflows/bold/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ def init_bold_wf(
FreeSurfer pial surfaces, in T1w space, collated left, then right
sphere_reg_fsLR
Registration spheres from fsnative to fsLR space, collated left, then right
thickness
FreeSurfer thickness metrics, collated left, then right
anat_ribbon
Binary cortical ribbon mask in T1w space
fmap_id
Expand Down Expand Up @@ -235,7 +233,8 @@ def init_bold_wf(
"midthickness",
"pial",
"sphere_reg_fsLR",
"thickness",
"midthickness_fsLR",
"cortex_mask",
"anat_ribbon",
# Fieldmap registration
"fmap",
Expand Down Expand Up @@ -316,6 +315,7 @@ def init_bold_wf(
omp_nthreads=omp_nthreads,
name='bold_anat_wf',
)
bold_anat_wf.inputs.inputnode.resolution = "native"

workflow.connect([
(inputnode, bold_native_wf, [
Expand Down Expand Up @@ -580,8 +580,9 @@ def init_bold_wf(
("white", "inputnode.white"),
("pial", "inputnode.pial"),
("midthickness", "inputnode.midthickness"),
("thickness", "inputnode.thickness"),
("midthickness_fsLR", "inputnode.midthickness_fsLR"),
("sphere_reg_fsLR", "inputnode.sphere_reg_fsLR"),
("cortex_mask", "inputnode.cortex_mask"),
("anat_ribbon", "inputnode.anat_ribbon"),
]),
(bold_anat_wf, bold_fsLR_resampling_wf, [
Expand Down
Loading