Skip to content

Commit

Permalink
Output fsLR meshes on subject surfaces
Browse files Browse the repository at this point in the history
Implementation of nipreps/fmriprep#3411.
  • Loading branch information
tsalo committed Jan 2, 2025
1 parent a2dc27d commit e57a953
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
31 changes: 26 additions & 5 deletions aslprep/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,14 @@ def init_single_subject_wf(subject_id: str):
from smriprep.workflows.outputs import (
init_ds_anat_volumes_wf,
init_ds_grayord_metrics_wf,
init_ds_surfaces_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,
init_resample_surfaces_wf,
)

from aslprep.interfaces.bids import BIDSDataGrabber
Expand Down Expand Up @@ -422,7 +423,8 @@ def init_single_subject_wf(subject_id: str):
grayord_density=config.workflow.cifti_output,
omp_nthreads=omp_nthreads,
)
resample_midthickness_wf = init_resample_midthickness_wf(
resample_surfaces_wf = init_resample_surfaces_wf(
surfaces=['white', 'pial', 'midthickness'],
grayord_density=config.workflow.cifti_output,
)
ds_grayord_metrics_wf = init_ds_grayord_metrics_wf(
Expand All @@ -431,6 +433,15 @@ def init_single_subject_wf(subject_id: str):
metrics=['curv', 'thickness', 'sulc'],
cifti_output=config.workflow.cifti_output,
)
ds_fsLR_surfaces_wf = init_ds_surfaces_wf(
output_dir=aslprep_dir,
surfaces=['white', 'pial', 'midthickness'],
entities={
'space': 'fsLR',
'density': '32k' if config.workflow.cifti_output == '91k' else '59k',
},
name='ds_fsLR_surfaces_wf',
)

workflow.connect([
(anat_fit_wf, curv_wf, [
Expand All @@ -446,7 +457,9 @@ def init_single_subject_wf(subject_id: str):
(curv_wf, hcp_morphometrics_wf, [
('outputnode.curv', 'inputnode.curv'),
]),
(anat_fit_wf, resample_midthickness_wf, [
(anat_fit_wf, resample_surfaces_wf, [
('outputnode.white', 'inputnode.white'),
('outputnode.pial', 'inputnode.pial'),
('outputnode.midthickness', 'inputnode.midthickness'),
(
f"outputnode.sphere_reg_{'msm' if msm_sulc else 'fsLR'}",
Expand All @@ -466,12 +479,15 @@ def init_single_subject_wf(subject_id: str):
('outputnode.sulc', 'inputnode.sulc'),
('outputnode.roi', 'inputnode.roi'),
]),
(resample_midthickness_wf, morph_grayords_wf, [
(resample_surfaces_wf, morph_grayords_wf, [
('outputnode.midthickness_fsLR', 'inputnode.midthickness_fsLR'),
]),
(anat_fit_wf, ds_grayord_metrics_wf, [
('outputnode.t1w_valid_list', 'inputnode.source_files'),
]),
(anat_fit_wf, ds_fsLR_surfaces_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'),
Expand All @@ -480,6 +496,11 @@ def init_single_subject_wf(subject_id: str):
('outputnode.sulc_fsLR', 'inputnode.sulc'),
('outputnode.sulc_metadata', 'inputnode.sulc_metadata'),
]),
(resample_surfaces_wf, ds_fsLR_surfaces_wf, [
('outputnode.white_fsLR', 'inputnode.white'),
('outputnode.pial_fsLR', 'inputnode.pial'),
('outputnode.midthickness_fsLR', 'inputnode.midthickness'),
]),
]) # fmt:skip

if config.workflow.anat_only:
Expand Down Expand Up @@ -713,7 +734,7 @@ def init_single_subject_wf(subject_id: str):
(select_MNI6_xfm, asl_wf, [('anat2std_xfm', 'inputnode.anat2mni6_xfm')]),
(select_MNI6_tpl, asl_wf, [('brain_mask', 'inputnode.mni6_mask')]),
(hcp_morphometrics_wf, asl_wf, [('outputnode.roi', 'inputnode.cortex_mask')]),
(resample_midthickness_wf, asl_wf, [
(resample_surfaces_wf, asl_wf, [
('outputnode.midthickness_fsLR', 'inputnode.midthickness_fsLR'),
]),
]) # fmt:skip
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies = [
"requests",
"sdcflows <= 2.11.0",
"sentry-sdk <= 2.19.2",
"smriprep <= 0.16.1",
"smriprep <= 0.17.0",
"templateflow <= 24.2.2",
"toml",
]
Expand Down

0 comments on commit e57a953

Please sign in to comment.