From 8794ec2613466eddd29749987c014c4b1c373ab3 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 6 Sep 2023 13:03:15 -0400 Subject: [PATCH 1/3] MNT: Add sloppy MSM config --- smriprep/data/msm/MSMSulcStrainSloppyconf | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 smriprep/data/msm/MSMSulcStrainSloppyconf diff --git a/smriprep/data/msm/MSMSulcStrainSloppyconf b/smriprep/data/msm/MSMSulcStrainSloppyconf new file mode 100644 index 0000000000..4d612fe7a6 --- /dev/null +++ b/smriprep/data/msm/MSMSulcStrainSloppyconf @@ -0,0 +1,18 @@ +--simval=3,2 +--sigma_in=0,0 +--sigma_ref=0,0 +--lambda=0,10 +--it=20,5 +--opt=AFFINE,DISCRETE +--CPgrid=6,2 +--SGgrid=6,4 +--datagrid=6,4 +--regoption=3 +--regexp=2 +--dopt=HOCR +--VN +--rescaleL +--triclique +--k_exponent=2 +--bulkmod=1.6 +--shearmod=0.4 From 39a0e2374546a9ae8825baf6c086bb6edbb3978c Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 6 Sep 2023 13:07:09 -0400 Subject: [PATCH 2/3] ENH: Pass sloppy parameter to MSM workflow to select cheaper config --- smriprep/workflows/anatomical.py | 2 +- smriprep/workflows/surfaces.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/smriprep/workflows/anatomical.py b/smriprep/workflows/anatomical.py index 6187044895..738ec03941 100644 --- a/smriprep/workflows/anatomical.py +++ b/smriprep/workflows/anatomical.py @@ -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( diff --git a/smriprep/workflows/surfaces.py b/smriprep/workflows/surfaces.py index 50c0ad8ae3..213552f203 100644 --- a/smriprep/workflows/surfaces.py +++ b/smriprep/workflows/surfaces.py @@ -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, From 4e6fdd3c85c9c9cc606e2307618bf36e60d2b8f9 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Wed, 6 Sep 2023 13:08:02 -0400 Subject: [PATCH 3/3] CI: Test sloppy MSM on CI --- .circleci/ds005_run.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/ds005_run.sh b/.circleci/ds005_run.sh index 6981fe7478..864ea87f52 100644 --- a/.circleci/ds005_run.sh +++ b/.circleci/ds005_run.sh @@ -17,7 +17,6 @@ docker run -it -e FMRIPREP_DEV=1 -u $(id -u) \ --skull-strip-template MNI152NLin2009cAsym:res-2 \ --sloppy --mem-gb 4 \ --ncpus 2 --omp-nthreads 2 -vv \ - --no-msm \ --fs-license-file /tmp/fslicense/license.txt \ --fs-subjects-dir /tmp/ds005/freesurfer \ ${@:1}