fMRIPrep Error: anat_fit_wf.msm_sulc

Summary of what happened:

Critical error halts my script; can’t run note anat_fit_wf.msm_sulc.

I confirmed MSM and FSL are installed. Seeing as the error is about running an MSM node, I’m wondering if this is a common issue when installing MSM? We pulled it from Git (GitHub - ecr05/MSM_HOCR: Multimodal Surface Matching with Higher order Clique Reduction: Mac OS and Linux binaries). Any guidance is appreciated!!!

Command used (and if a helper script was used, a link to the helper script or the command generated):

#variable directories hidden from this post due to participant info
# Run fMRIPrep
fmriprep \
  $INPUT_DIR $OUTPUT_DIR participant \
  --participant-label $SUBJECT_ID \
  --fs-license-file /share/team/neuro-sci/Olivier_paste_here/license.txt \
  --output-spaces MNI152NLin2009cAsym:res-2 anat \
  --ignore slicetiming \
  --nthreads 8 \
  --omp-nthreads 8 \
  --mem-mb 16000 \
  --work-dir $WORK_DIR 
  --verbose

Version:

fMRIPrep 24.1.1

Environment (Docker, Singularity / Apptainer, custom installation):

Docker container solution that also allocates shared resources (RunAI on Linux terminal)

Data formatted according to a validatable standard? Please provide the output of the validator:

BIDS dataset validated successfully.

No errors were found in the dataset.

Relevant log outputs (up to 20 lines):

2024-11-07 15:01:33,610 [    INFO] [Node] Finished "ds_bold", elapsed time 116.511013s.
2024-11-07 15:01:36,161 [   ERROR] could not run node: fmriprep_24_1_wf.sub_00840065_wf.anat_fit_wf.msm_sulc_wf.msmsulc
2024-11-07 15:01:36,162 [   ERROR] could not run node: fmriprep_24_1_wf.sub_00840065_wf.anat_fit_wf.msm_sulc_wf.msmsulc
2024-11-07 15:01:37,867 [CRITICAL] fMRIPrep failed: 2 raised. Re-raising first.

Screenshots / relevant information:


I’m interpreting this as a custom Dockerfile? Would you mind sharing it?

Yes, this is a custom Dockerfile!

The following line from the Dockerfile is how the latest version of fMRIPrep was installed:

RUN python -m pip install fmriprep

The following lines are how MSM was installed in the Dockerfile:

RUN mkdir /opt/msm && \

curl -sSL https://github.com/ecr05/MSM_HOCR/releases/download/v3.0FSL/msm_ubuntu_v3 > /opt/msm/msm && \

chmod 777 /opt/msm/msm

ENV PATH=/opt/msm:$PATH

That looks reasonable. Are you seeing anything else in the log? Typically there will be a traceback. There may also be crashfiles.

Here’s an upstream error might be relevant:

241107-13:24:13,437 nipype.workflow WARNING:
                [Node] Error on "_msmsulc0" (/share/team/neuro-sci/Olivier_paste_here/work/fmriprep_24_1_wf/sub_00840065_wf/anat_fit_wf/msm_sulc_wf/msmsulc/mapflow/_msmsulc0)
241107-13:24:18,844 nipype.workflow ERROR:
                Node _msmsulc0 failed to run on host fmriprep-0-1.
241107-13:24:18,989 nipype.workflow ERROR:
                Saving crash info to /share/team/neuro-sci/Olivier_paste_here/sub-00840065/log/20241107-120832_6ef089e0-e558-4ec7-85dc-2549de0272db/crash-20241107-132418-cheouser-_msmsulc0-dce22bdb-8ee4-4efc-a833-33278c83617e.txt
Traceback (most recent call last):
  File "/opt/fsl-6.0.7.7/lib/python3.11/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/fsl-6.0.7.7/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/fsl-6.0.7.7/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/fsl-6.0.7.7/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node _msmsulc0.

And here is info from the associated crashfile (no other crashfiles):

Node: _msmsulc0
Working directory: /share/team/neuro-sci/Olivier_paste_here/work/fmriprep_24_1_wf/sub_00840065_wf/anat_fit_wf/msm_sulc_wf/msmsulc/mapflow/_msmsulc0

Node inputs:

args = <undefined>
config_file = /opt/fsl-6.0.7.7/lib/python3.11/site-packages/smriprep/data/msm/MSMSulcStrainFinalconf
environ = {}
in_data = /share/team/neuro-sci/Olivier_paste_here/work/fmriprep_24_1_wf/sub_00840065_wf/anat_fit_wf/msm_sulc_wf/invert_sulc/mapflow/_invert_sulc0/sub-XYZ.L.sulc.native.shape.gii
in_mesh = /share/team/neuro-sci/Olivier_paste_here/work/fmriprep_24_1_wf/sub_00840065_wf/anat_fit_wf/msm_sulc_wf/modify_sphere/mapflow/_modify_sphere0/lh.sphere_converted_xformed.surf_mod.surf.gii
in_register = <undefined>
in_weight = <undefined>
levels = <undefined>
out_base = lh.
output_format = <undefined>
reference_data = /opt/fsl-6.0.7.7/lib/python3.11/site-packages/smriprep/data/atlases/L.refsulc.164k_fs_LR.shape.gii
reference_mesh = /opt/fsl-6.0.7.7/lib/python3.11/site-packages/smriprep/data/atlases/fsaverage.L_LR.spherical_std.164k_fs_LR.surf.gii
reference_weight = <undefined>
smooth_output_sigma = <undefined>
transformed_mesh = <undefined>
verbose = True

Traceback (most recent call last):
  File "/opt/fsl-6.0.7.7/lib/python3.11/site-packages/nipype/pipeline/plugins/multiproc.py", line 67, in run_node
    result["result"] = node.run(updatehash=updatehash)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/fsl-6.0.7.7/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 527, in run
    result = self._run_interface(execute=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/fsl-6.0.7.7/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 645, in _run_interface
    return self._run_command(execute)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/fsl-6.0.7.7/lib/python3.11/site-packages/nipype/pipeline/engine/nodes.py", line 771, in _run_command
    raise NodeExecutionError(msg)
nipype.pipeline.engine.nodes.NodeExecutionError: Exception raised while executing Node _msmsulc0.

Cmdline:
	msm --conf=/opt/fsl-6.0.7.7/lib/python3.11/site-packages/smriprep/data/msm/MSMSulcStrainFinalconf --indata=/share/team/neuro-sci/Olivier_paste_here/work/fmriprep_24_1_wf/sub_00840065_wf/anat_fit_wf/msm_sulc_wf/invert_sulc/mapflow/_invert_sulc0/sub-XYZ.L.sulc.native.shape.gii --inmesh=/share/team/neuro-sci/Olivier_paste_here/work/fmriprep_24_1_wf/sub_00840065_wf/anat_fit_wf/msm_sulc_wf/modify_sphere/mapflow/_modify_sphere0/lh.sphere_converted_xformed.surf_mod.surf.gii --out=lh. --refdata=/opt/fsl-6.0.7.7/lib/python3.11/site-packages/smriprep/data/atlases/L.refsulc.164k_fs_LR.shape.gii --refmesh=/opt/fsl-6.0.7.7/lib/python3.11/site-packages/smriprep/data/atlases/fsaverage.L_LR.spherical_std.164k_fs_LR.surf.gii --verbose
Stdout:

Stderr:

	Part of FSL (ID: "")
	msm configuration parameters 

	Usage: 


	Optional arguments (You may optionally specify one or more of):
		--opt	optimisation method. Choice of: AFFINE,DISCRETE (default)
		--simval	code for determining which similarty measure is used to assess cost during registration: options are 1) SSD; 2) pearsons correlation (default); 3) NMI;)
		--it	number of iterations at each resolution (default -–it=3,3,3)
		--sigma_in	smoothing parameter for input image (default --sigma_in=2,2,2)
		--sigma_ref	Sigma parameter - smoothing parameter for reference image  (set equal to sigma_in by default)
		--lambda	Lambda parameter - controls contribution of regulariser 
		--datagrid	DATA grid resolution (default --datagrid=5,5,5). If parameter = 0 then the native mesh is used.
		--CPgrid	Control point grid resolution (default --CPgrid=2,3,4)
		--SGgrid	Sampling grid resolution (default = 2 levels higher than the control point grid)
		--anatgrid	Anatomical grid resolution (default = 2 levels higher than the control point grid)
		--aKNN	Number of neighbours for estimation of kNN graph and alpha entropy measure (default --aKNN=5,5,5)
		--cutthr	Upper and lower thresholds for defining cut vertices (default --cutthr=0,0)
		--mInt	Method used for mesh interpolations, options: TPS or BARY (default)
		--dInt	Method used for data interpolations, options: GAUSSIAN or ADAP_BARY (default)
		--regexp	Regulariser exponent 'rexp' (default 2.0)
		--weight	weight regulariser cost using areal distortion weighting
		--anorm	norm regulariser cost using mean angle (for HCP compatibility)
		--rescaleL	rescale label grid rather than using barycentres
		--log	log transform and normalise the data
		--IN	Normalize intensity ranges using histogram matching 
		--INc	Normalize intensity ranges using histogram matching excluding cut
		--VN	Variance normalize data 
		--scale	Scale intensity ranges of a features in multivariate data to be equal to that of the first (useful for multimodal contrasts)
		--excl	Ignore the cut when resampling the data
		--stepsize	gradient stepping for affine optimisation (default 0.01)
		--gradsampling	Determines the finite distance spacing for the affine gradient calculation (default 0.5)
		--numthreads	number of threads for tbb (default 1)



	--regoption: Option doesn't exist!
Traceback:
	RuntimeError: subprocess exited with code 1

Apologies for the large text, as I didn’t want to remove anything that might be relevant.

You might want to docker run --rm -it --entrypoint=bash into your container and run which msm. It’s claming not to be able to use the --regoption flag, which is part of the MSMSulcStrainFinalconf. It generally works in our container. I’m seeing that you installed fMRIPrep into an FSL environment, which we may contain its own copy of MSM.

I would recommend installing via:

git clone https://github.com/nipreps/fmriprep
cd fmriprep
git checkout 24.1.1
conda env create -f env.yml
conda env config vars set -n tmp FSLDIR=$(conda activate fmriprep && echo $CONDA_PREFIX)

This will be a much closer reproduction to the environment that we generate in our Docker images.

Amazing, my team will try this now then run the script once more! Thank you very much for the prompt responses, I sincerely appreciate the support.