Skip to content

Commit

Permalink
ENH: Pass sloppy parameter to MSM workflow to select cheaper config
Browse files Browse the repository at this point in the history
effigies committed Sep 6, 2023
1 parent 8794ec2 commit 39a0e23
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion smriprep/workflows/anatomical.py
Original file line number Diff line number Diff line change
@@ -530,7 +530,7 @@ def _check_img(img):
name="surface_recon_wf", omp_nthreads=omp_nthreads, hires=hires
)
applyrefined = pe.Node(fsl.ApplyMask(), name="applyrefined")
sphere_reg_wf = init_sphere_reg_wf(msm_sulc=msm_sulc, name="sphere_reg_wf")
sphere_reg_wf = init_sphere_reg_wf(msm_sulc=msm_sulc, sloppy=sloppy, name="sphere_reg_wf")

if t2w:
t2w_template_wf = init_anat_template_wf(
14 changes: 10 additions & 4 deletions smriprep/workflows/surfaces.py
Original file line number Diff line number Diff line change
@@ -494,7 +494,12 @@ def _dedup(in_list):
return workflow


def init_sphere_reg_wf(*, msm_sulc: bool = False, name: str = "sphere_reg_wf"):
def init_sphere_reg_wf(
*,
msm_sulc: bool = False,
sloppy: bool = False,
name: str = "sphere_reg_wf",
):
"""Generate GIFTI registration files to fsLR space"""
from ..interfaces.surf import FixGiftiMetadata
from ..interfaces.workbench import SurfaceSphereProjectUnproject
@@ -564,7 +569,7 @@ def init_sphere_reg_wf(*, msm_sulc: bool = False, name: str = "sphere_reg_wf"):
fix_sphere_meta = pe.MapNode(
FixGiftiMetadata(), iterfield='in_file', name='fix_sphere_meta',
)
msm_sulc_wf = init_msm_sulc_wf()
msm_sulc_wf = init_msm_sulc_wf(sloppy=sloppy)
# fmt:off
workflow.connect([
(get_surfaces, sphere_gii, [(('sphere', _sorted_by_basename), 'in_file')]),
@@ -578,7 +583,7 @@ def init_sphere_reg_wf(*, msm_sulc: bool = False, name: str = "sphere_reg_wf"):
return workflow


def init_msm_sulc_wf(*, name: str = 'msm_sulc_wf'):
def init_msm_sulc_wf(*, sloppy: bool = False, name: str = 'msm_sulc_wf'):
"""Run MSMSulc registration to fsLR surfaces, per hemisphere."""
from ..interfaces.msm import MSM
from ..interfaces.workbench import SurfaceAffineRegression, SurfaceApplyAffine
@@ -618,8 +623,9 @@ def init_msm_sulc_wf(*, name: str = 'msm_sulc_wf'):
# --indata=sub-${SUB}_ses-${SES}_hemi-${HEMI)_sulc.shape.gii \
# --refdata=tpl-fsaverage_hemi-${HEMI}_den-164k_sulc.shape.gii \
# --out=${HEMI}. --verbose
msm_conf = load_resource(f'msm/MSMSulcStrain{"Sloppy" if sloppy else "Final"}conf')
msmsulc = pe.MapNode(
MSM(verbose=True, config_file=load_resource('msm/MSMSulcStrainFinalconf')),
MSM(verbose=True, config_file=msm_conf),
iterfield=['in_mesh', 'reference_mesh', 'in_data', 'reference_data', 'out_base'],
name='msmsulc',
mem_gb=2,

0 comments on commit 39a0e23

Please sign in to comment.