Skip to content

Commit c9231f2

Browse files
committed
ENH: Adjust fsnative file based on surface recon method
1 parent 133c0b7 commit c9231f2

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

nibabies/workflows/bold/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,7 @@ def init_func_preproc_wf(bold_file, has_fieldmap=False, existing_derivatives=Non
931931
surface_spaces=freesurfer_spaces,
932932
medial_surface_nan=config.workflow.medial_surface_nan,
933933
project_goodvoxels=project_goodvoxels,
934+
surface_recon_method=config.workflow.surface_recon_method,
934935
name="bold_surf_wf",
935936
)
936937
# fmt:off

nibabies/workflows/bold/resampling.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,17 @@
2222
from niworkflows.interfaces.fixes import FixHeaderApplyTransforms as ApplyTransforms
2323
from niworkflows.interfaces.freesurfer import MedialNaNs
2424

25-
from ...config import DEFAULT_MEMORY_MIN_GB
25+
from nibabies.config import DEFAULT_MEMORY_MIN_GB
2626

2727

2828
def init_bold_surf_wf(
29-
mem_gb, surface_spaces, medial_surface_nan, project_goodvoxels, name="bold_surf_wf"
29+
*,
30+
mem_gb: float,
31+
surface_spaces: list,
32+
medial_surface_nan: bool,
33+
project_goodvoxels: bool,
34+
surface_recon_method: str,
35+
name: str = "bold_surf_wf",
3036
):
3137
"""
3238
Sample functional images to FreeSurfer surfaces.
@@ -184,6 +190,14 @@ def select_target(subject_id, space):
184190
name="outputnode",
185191
)
186192

193+
# Some recon methods do not create T1
194+
if surface_recon_method == 'freesurfer':
195+
fsnative_file = 'T1'
196+
elif surface_recon_method in ('infantfs', 'mcribs'):
197+
fsnative_file = 'brain'
198+
else:
199+
raise NotImplementedError(f"Surface recon method: {surface_recon_method}")
200+
187201
# fmt: off
188202
workflow.connect([
189203
(inputnode, get_fsnative, [
@@ -195,8 +209,7 @@ def select_target(subject_id, space):
195209
("source_file", "src_file"),
196210
("t1w2fsnative_xfm", "in_file"),
197211
]),
198-
# TODO: Dynamically adjust based on MCRIBS/InfantFS/FS
199-
(get_fsnative, itk2lta, [('brain', 'dst_file')]), # InfantFS: Use brain instead of T1
212+
(get_fsnative, itk2lta, [(fsnative_file, 'dst_file')]),
200213
(inputnode, sampler, [
201214
("subjects_dir", "subjects_dir"),
202215
("subject_id", "subject_id"),

0 commit comments

Comments
 (0)