Add MSMSulc
edickie opened this issue · comments
Following the addition of one-shot fsLR resampling (#339), this should be much easier to add.
Adding relevant code from ciftify..
the bit to add to teh docker file
RUN mkdir /opt/msm && \
curl -sSL https://github.com/ecr05/MSM_HOCR_macOSX/releases/download/1.0/msm_ubuntu > /opt/msm/msm && \
chmod 777 /opt/msm/msm
ENV PATH=/opt/msm:$PATH
Additional configuration text file {MSMSulcStrainFinalconf}:
https://github.com/edickie/ciftify/blob/master/ciftify/data/hcp_config/MSMSulcStrainFinalconf
Reference sulcal depth data:
https://github.com/edickie/ciftify/tree/master/ciftify/data/standard_mesh_atlases/L.refsulc.164k_fs_LR.shape.gii
https://github.com/edickie/ciftify/tree/master/ciftify/data/standard_mesh_atlases/R.refsulc.164k_fs_LR.shape.gii
A log of how MSMSulc runs for one subject inside ciftify
-------------------------------------------------------------
2020-12-25 07:58:00.383054 : Running MSMSulc surface registration
-------------------------------------------------------------
Running: wb_command -surface-affine-regression /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.L.sphere.native.surf.gii /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.L.sphere.reg.reg_LR.native.surf.gii /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/L.mat
Running: wb_command -surface-apply-affine /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.L.sphere.native.surf.gii /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/L.mat /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/L.sphere_rot.surf.gii
Running: wb_command -surface-modify-sphere -logging SEVERE /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/L.sphere_rot.surf.gii 100 /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/L.sphere_rot.surf.gii
Running: cp /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/L.sphere_rot.surf.gii /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.L.sphere.rot.native.surf.gii
Running: msm --conf=/home/code/ciftify/ciftify/data/hcp_config/MSMSulcStrainFinalconf --inmesh=/output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.L.sphere.rot.native.surf.gii --refmesh=/output/ciftify/sub-CMH0002/MNINonLinear/sub-CMH0002.L.sphere.164k_fs_LR.surf.gii --indata=/tmp/tmp00t5dbqr/MNINonLinear/native/sub-CMH0002.L.sulc.native.shape.gii --refdata=/home/code/ciftify/ciftify/data/standard_mesh_atlases/L.refsulc.164k_fs_LR.shape.gii --out=/output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/L.
orig save SPH
Running: cp /home/code/ciftify/ciftify/data/hcp_config/MSMSulcStrainFinalconf /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/L.logdir/conf
Running: cp /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/L.sphere.reg.surf.gii /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.L.sphere.MSMSulc.native.surf.gii
Running: wb_command -set-structure /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.L.sphere.MSMSulc.native.surf.gii CORTEX_LEFT
Running: wb_command -surface-vertex-areas /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.L.sphere.native.surf.gii /tmp/tmpyo5i17o0/sphere_pre_va.shape.gii
Running: wb_command -surface-vertex-areas /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.L.sphere.MSMSulc.native.surf.gii /tmp/tmpyo5i17o0/sphere_reg_va.shape.gii
Running: wb_command -metric-math "(ln(spherereg / sphere) / ln(2))" /tmp/tmp00t5dbqr/MNINonLinear/native/sub-CMH0002.L.ArealDistortion_MSMSulc.native.shape.gii -var sphere /tmp/tmpyo5i17o0/sphere_pre_va.shape.gii -var spherereg /tmp/tmpyo5i17o0/sphere_reg_va.shape.gii
parsed '(ln(spherereg / sphere) / ln(2))' as '(ln((spherereg/sphere))/ln(2))'
Running: wb_command -set-map-names /tmp/tmp00t5dbqr/MNINonLinear/native/sub-CMH0002.L.ArealDistortion_MSMSulc.native.shape.gii -map 1 sub-CMH0002_L__Areal_Distortion__MSMSulc
Running: wb_command -metric-palette /tmp/tmp00t5dbqr/MNINonLinear/native/sub-CMH0002.L.ArealDistortion_MSMSulc.native.shape.gii MODE_AUTO_SCALE -palette-name ROY-BIG-BL -thresholding THRESHOLD_TYPE_NORMAL THRESHOLD_TEST_SHOW_OUTSIDE -1 1
Running: wb_command -surface-distortion /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.L.sphere.native.surf.gii /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.L.sphere.MSMSulc.native.surf.gii /tmp/tmp00t5dbqr/MNINonLinear/native/sub-CMH0002.L.EdgeDistortion_MSMSulc.native.shape.gii -edge-method
Running: wb_command -surface-affine-regression /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.R.sphere.native.surf.gii /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.R.sphere.reg.reg_LR.native.surf.gii /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/R.mat
Running: wb_command -surface-apply-affine /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.R.sphere.native.surf.gii /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/R.mat /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/R.sphere_rot.surf.gii
Running: wb_command -surface-modify-sphere -logging SEVERE /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/R.sphere_rot.surf.gii 100 /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/R.sphere_rot.surf.gii
Running: cp /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/R.sphere_rot.surf.gii /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.R.sphere.rot.native.surf.gii
Running: msm --conf=/home/code/ciftify/ciftify/data/hcp_config/MSMSulcStrainFinalconf --inmesh=/output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.R.sphere.rot.native.surf.gii --refmesh=/output/ciftify/sub-CMH0002/MNINonLinear/sub-CMH0002.R.sphere.164k_fs_LR.surf.gii --indata=/tmp/tmp00t5dbqr/MNINonLinear/native/sub-CMH0002.R.sulc.native.shape.gii --refdata=/home/code/ciftify/ciftify/data/standard_mesh_atlases/R.refsulc.164k_fs_LR.shape.gii --out=/output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/R.
orig save SPH
Running: cp /home/code/ciftify/ciftify/data/hcp_config/MSMSulcStrainFinalconf /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/R.logdir/conf
Running: cp /output/ciftify/sub-CMH0002/MNINonLinear/Native/MSMSulc/R.sphere.reg.surf.gii /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.R.sphere.MSMSulc.native.surf.gii
Running: wb_command -set-structure /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.R.sphere.MSMSulc.native.surf.gii CORTEX_RIGHT
Running: wb_command -surface-vertex-areas /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.R.sphere.native.surf.gii /tmp/tmps7nsu9_z/sphere_pre_va.shape.gii
Running: wb_command -surface-vertex-areas /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.R.sphere.MSMSulc.native.surf.gii /tmp/tmps7nsu9_z/sphere_reg_va.shape.gii
Running: wb_command -metric-math "(ln(spherereg / sphere) / ln(2))" /tmp/tmp00t5dbqr/MNINonLinear/native/sub-CMH0002.R.ArealDistortion_MSMSulc.native.shape.gii -var sphere /tmp/tmps7nsu9_z/sphere_pre_va.shape.gii -var spherereg /tmp/tmps7nsu9_z/sphere_reg_va.shape.gii
parsed '(ln(spherereg / sphere) / ln(2))' as '(ln((spherereg/sphere))/ln(2))'
Running: wb_command -set-map-names /tmp/tmp00t5dbqr/MNINonLinear/native/sub-CMH0002.R.ArealDistortion_MSMSulc.native.shape.gii -map 1 sub-CMH0002_R__Areal_Distortion__MSMSulc
Running: wb_command -metric-palette /tmp/tmp00t5dbqr/MNINonLinear/native/sub-CMH0002.R.ArealDistortion_MSMSulc.native.shape.gii MODE_AUTO_SCALE -palette-name ROY-BIG-BL -thresholding THRESHOLD_TYPE_NORMAL THRESHOLD_TEST_SHOW_OUTSIDE -1 1
Running: wb_command -surface-distortion /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.R.sphere.native.surf.gii /output/ciftify/sub-CMH0002/MNINonLinear/Native/sub-CMH0002.R.sphere.MSMSulc.native.surf.gii /tmp/tmp00t5dbqr/MNINonLinear/native/sub-CMH0002.R.EdgeDistortion_MSMSulc.native.shape.gii -edge-method
Notes from @madisoth and @juansanchezpena (via @ericfeczko):
We located the required inputs for MSMSulc in an fMRIPrep derivatives/work directory, plus additional required files (MSM binary, MSM config file, reference mesh, reference sulcal map, FSL dependencies), and got MSMSulc to run on MSI. We still need to rerun the native-to-fsLR resampling with the new MSMSulc registration on our test subject to compare to the non-MSM registration. We also think it would be fairly straightforward to incorporate MSMSulc into sMRIPrep, since all dependencies besides the MSM binary and config file appear to be in the sMRIPrep workflow (or accessible via TemplateFlow) already; the main hurdle is that it's probably necessary to implement a native-to-32k surface resampling workflow (similar to what is currently in XCP-D) in sMRIPrep.
At OHBM, Emma Robinson advertised a rewrite of MSM: https://metrics-lab.github.io/newMSM/
This is MIT-licensed and distributed as a conda package through the FSL channel.
But it does link into libfsl-*
libraries, which I don't know what that does to the license:
https://github.com/rbesenczi/msm-newresampler/blob/main/src/Makefile
https://github.com/rbesenczi/msm-newmeshreg/blob/main/src/Makefile
we just pushed a dev version to dockerhub (nipreps/fmriprep:msmsulc
) - msmsulc will be run by default as long as you are specifying --cifti-output
, and can be bypassed with the --no-msm
flag.