Skip to content

Commit

Permalink
FIX: Invert sulcal depth metric before passing to MSM
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Nov 8, 2023
1 parent caa1af7 commit eeead71
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions smriprep/workflows/surfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ def init_fsLR_reg_wf(*, name="fsLR_reg_wf"):

def init_msm_sulc_wf(*, sloppy: bool = False, name: str = 'msm_sulc_wf'):
"""Run MSMSulc registration to fsLR surfaces, per hemisphere."""
from ..interfaces.gifti import InvertShape

Check warning on line 749 in smriprep/workflows/surfaces.py

View check run for this annotation

Codecov / codecov/patch

smriprep/workflows/surfaces.py#L749

Added line #L749 was not covered by tests
from ..interfaces.msm import MSM
from ..interfaces.workbench import (
SurfaceAffineRegression,
Expand Down Expand Up @@ -789,7 +790,16 @@ def init_msm_sulc_wf(*, sloppy: bool = False, name: str = 'msm_sulc_wf'):
name='modify_sphere',
)

# 2) Run MSMSulc
# 2) Invert sulc
# wb_command -metric-math "-1 * var" ...
invert_sulc = pe.MapNode(

Check warning on line 795 in smriprep/workflows/surfaces.py

View check run for this annotation

Codecov / codecov/patch

smriprep/workflows/surfaces.py#L795

Added line #L795 was not covered by tests
InvertShape(shape='sulc'),
iterfield=['shape_file', 'hemisphere'],
name='invert_sulc',
)
invert_sulc.inputs.hemisphere = ['L', 'R']

Check warning on line 800 in smriprep/workflows/surfaces.py

View check run for this annotation

Codecov / codecov/patch

smriprep/workflows/surfaces.py#L800

Added line #L800 was not covered by tests

# 3) Run MSMSulc
# ./msm_centos_v3 --conf=MSMSulcStrainFinalconf \
# --inmesh=${SUB}.${HEMI}.sphere_rot.native.surf.gii
# --refmesh=fsaverage.${HEMI}_LR.spherical_std.164k_fs_LR.surf.gii
Expand Down Expand Up @@ -829,18 +839,19 @@ def init_msm_sulc_wf(*, sloppy: bool = False, name: str = 'msm_sulc_wf'):
)
for hemi in 'LR'
]
# fmt:off
workflow.connect([
(inputnode, regress_affine, [('sphere', 'in_surface'),
('sphere_reg_fsLR', 'target_surface')]),
(inputnode, regress_affine, [
('sphere', 'in_surface'),
('sphere_reg_fsLR', 'target_surface'),
]),
(inputnode, apply_surface_affine, [('sphere', 'in_surface')]),
(inputnode, invert_sulc, [('sulc', 'shape_file')]),
(regress_affine, apply_surface_affine, [('out_affine', 'in_affine')]),
(apply_surface_affine, modify_sphere, [('out_surface', 'in_surface')]),
(inputnode, msmsulc, [('sulc', 'in_data')]),
(modify_sphere, msmsulc, [('out_surface', 'in_mesh')]),
(invert_sulc, msmsulc, [('shape_file', 'in_data')]),
(msmsulc, outputnode, [('warped_mesh', 'sphere_reg_fsLR')]),
])
# fmt:on
]) # fmt:skip
return workflow


Expand Down

0 comments on commit eeead71

Please sign in to comment.