Skip to content

Commit 6995f33

Browse files
committed
Merge remote-tracking branch 'upstream/master' into next
2 parents 92773f5 + 949a13f commit 6995f33

File tree

3 files changed

+82
-4
lines changed

3 files changed

+82
-4
lines changed

smriprep/interfaces/msm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class MSMInputSpec(CommandLineInputSpec):
4444
exists=True,
4545
argstr="--trans=%s",
4646
desc="Transformed source mesh (output of a previous registration). "
47-
"Use this to initiliase the current registration.",
47+
"Use this to initialise the current registration.",
4848
)
4949
in_register = File(
5050
exists=True,
@@ -87,7 +87,7 @@ class MSMInputSpec(CommandLineInputSpec):
8787
)
8888
smooth_output_sigma = traits.Int(
8989
argstr="--smoothout=%d",
90-
desc="smooth tranformed output with this sigma (default=0)",
90+
desc="smooth transformed output with this sigma (default=0)",
9191
)
9292
verbose = traits.Bool(
9393
argstr="--verbose",

smriprep/interfaces/workbench.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,71 @@ class SurfaceApplyWarpfield(WBCommand):
352352
_cmd = "wb_command -surface-apply-warpfield"
353353

354354

355+
class SurfaceModifySphereInputSpec(CommandLineInputSpec):
356+
in_surface = File(
357+
exists=True,
358+
mandatory=True,
359+
position=0,
360+
argstr="%s",
361+
desc="the sphere to modify",
362+
)
363+
radius = traits.Int(
364+
mandatory=True,
365+
position=1,
366+
argstr="%d",
367+
desc='the radius the output sphere should have'
368+
)
369+
out_surface = File(
370+
name_template="%s_mod.surf.gii",
371+
name_source="in_surface",
372+
position=2,
373+
argstr="%s",
374+
desc="the modified sphere",
375+
)
376+
recenter = traits.Bool(
377+
False,
378+
position=3,
379+
argstr="-recenter",
380+
desc="recenter the sphere by means of the bounding box",
381+
)
382+
383+
384+
class SurfaceModifySphereOutputSpec(TraitedSpec):
385+
out_surface = File(desc="the modified sphere")
386+
387+
388+
class SurfaceModifySphere(WBCommand):
389+
"""CHANGE RADIUS AND OPTIONALLY RECENTER A SPHERE
390+
391+
wb_command -surface-modify-sphere
392+
<sphere-in> - the sphere to modify
393+
<radius> - the radius the output sphere should have
394+
<sphere-out> - output - the output sphere
395+
396+
[-recenter] - recenter the sphere by means of the bounding box
397+
398+
This command may be useful if you have used -surface-resample to resample
399+
a sphere, which can suffer from problems generally not present in
400+
-surface-sphere-project-unproject. If the sphere should already be
401+
centered around the origin, using -recenter may still shift it slightly
402+
before changing the radius, which is likely to be undesireable.
403+
404+
If <sphere-in> is not close to spherical, or not centered around the
405+
origin and -recenter is not used, a warning is printed.
406+
407+
>>> sms = SurfaceModifySphere()
408+
>>> sms.inputs.in_surface = 'sub-01_hemi-L_sphere.surf.gii'
409+
>>> sms.inputs.radius = 100
410+
>>> sms.cmdline # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
411+
'wb_command -surface-modify-sphere \
412+
sub-01_hemi-L_sphere.surf.gii 100 sub-01_hemi-L_sphere.surf_mod.surf.gii'
413+
"""
414+
415+
input_spec = SurfaceModifySphereInputSpec
416+
output_spec = SurfaceModifySphereOutputSpec
417+
_cmd = 'wb_command -surface-modify-sphere'
418+
419+
355420
class SurfaceSphereProjectUnprojectInputSpec(TraitedSpec):
356421
"""COPY REGISTRATION DEFORMATIONS TO DIFFERENT SPHERE.
357422

smriprep/workflows/surfaces.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,11 @@ def init_fsLR_reg_wf(*, name="fsLR_reg_wf"):
747747
def init_msm_sulc_wf(*, sloppy: bool = False, name: str = 'msm_sulc_wf'):
748748
"""Run MSMSulc registration to fsLR surfaces, per hemisphere."""
749749
from ..interfaces.msm import MSM
750-
from ..interfaces.workbench import SurfaceAffineRegression, SurfaceApplyAffine
750+
from ..interfaces.workbench import (
751+
SurfaceAffineRegression,
752+
SurfaceApplyAffine,
753+
SurfaceModifySphere,
754+
)
751755

752756
workflow = Workflow(name=name)
753757
inputnode = pe.Node(
@@ -777,6 +781,14 @@ def init_msm_sulc_wf(*, sloppy: bool = False, name: str = 'msm_sulc_wf'):
777781
iterfield=['in_surface', 'in_affine'],
778782
name='apply_surface_affine',
779783
)
784+
785+
# Fix for oblongated sphere
786+
modify_sphere = pe.MapNode(
787+
SurfaceModifySphere(radius=100),
788+
iterfield=['in_surface'],
789+
name='modify_sphere',
790+
)
791+
780792
# 2) Run MSMSulc
781793
# ./msm_centos_v3 --conf=MSMSulcStrainFinalconf \
782794
# --inmesh=${SUB}.${HEMI}.sphere_rot.native.surf.gii
@@ -823,8 +835,9 @@ def init_msm_sulc_wf(*, sloppy: bool = False, name: str = 'msm_sulc_wf'):
823835
('sphere_reg_fsLR', 'target_surface')]),
824836
(inputnode, apply_surface_affine, [('sphere', 'in_surface')]),
825837
(regress_affine, apply_surface_affine, [('out_affine', 'in_affine')]),
838+
(apply_surface_affine, modify_sphere, [('out_surface', 'in_surface')]),
826839
(inputnode, msmsulc, [('sulc', 'in_data')]),
827-
(apply_surface_affine, msmsulc, [('out_surface', 'in_mesh')]),
840+
(modify_sphere, msmsulc, [('out_surface', 'in_mesh')]),
828841
(msmsulc, outputnode, [('warped_mesh', 'sphere_reg_fsLR')]),
829842
])
830843
# fmt:on

0 commit comments

Comments
 (0)