Skip to content

Commit

Permalink
feat: Output fsLR meshes on subject surfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Dec 13, 2024
1 parent 152a80d commit 2c18a34
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
31 changes: 26 additions & 5 deletions fmriprep/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,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 fmriprep.workflows.bold.base import init_bold_wf
Expand Down Expand Up @@ -449,7 +450,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 @@ -458,6 +460,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=fmriprep_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 @@ -473,7 +484,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 @@ -493,12 +506,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 @@ -507,6 +523,11 @@ def init_single_subject_wf(subject_id: str):
('outputnode.sulc_fsLR', 'inputnode.sulc'),
('outputnode.sulc_metadata', 'inputnode.sulc_metadata'),
]),
(morph_grayords_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 @@ -740,7 +761,7 @@ def init_single_subject_wf(subject_id: str):
(hcp_morphometrics_wf, bold_wf, [
('outputnode.roi', 'inputnode.cortex_mask'),
]),
(resample_midthickness_wf, bold_wf, [
(resample_surfaces_wf, bold_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 @@ -34,7 +34,7 @@ dependencies = [
"pybids >= 0.16",
"requests >= 2.27",
"sdcflows >= 2.10.0",
"smriprep >= 0.16.0",
"smriprep @ git+https://github.com/nipreps/smriprep.git",
"tedana >= 23.0.2",
"templateflow >= 24.2.2",
"transforms3d >= 0.4",
Expand Down

0 comments on commit 2c18a34

Please sign in to comment.