AFNI + FreeSurfer FSvent workflow on Neurodesk containers (Puma HPC): @SUMA_Make_Spec_FS cannot find mris_convert

Hi all,

I’m preprocessing a task fMRI dataset on the Puma HPC cluster using Neurodesk containers for AFNI and FreeSurfer. I’m trying to include ventricle-based nuisance regressors in afni_proc.py via:

-regress_ROI_PC          FSvent 5
-regress_ROI_PC_per_run  FSvent

As far as I understand, the standard AFNI workflow is:

  1. Run FreeSurfer recon-all.
  2. Run @SUMA_Make_Spec_FS on the FreeSurfer subject directory.
  3. Use the resulting FSvent mask for the regressors above.

FreeSurfer part works. The SUMA part does not.


Environment

FreeSurfer container

${SIF}/freesurfer_v8.1.sif

AFNI container

${SIF}/afni_v24.1.02.sif

SUBJECTS_DIR

/groups/*******/metvis_fmri/derivatives/freesurfer

FreeSurfer completed fine

recon-all -s sub-METVIS001 finished without error

Log is present and clean.


Attempt to generate FSvent with AFNI container

Inside the AFNI container, with FreeSurfer’s SUBJECTS_DIR bound:

SUB=sub-METVIS001
SUBJECTS_DIR=/groups/*****/metvis_fmri/derivatives/freesurfer

apptainer exec --cleanenv \
  --env SUBJECTS_DIR="$SUBJECTS_DIR" \
  --bind /groups/******/metvis_fmri:/groups/******/metvis_fmri \
  ${SIF}/afni_v24.1.02.sif \
  tcsh -c "@SUMA_Make_Spec_FS -sid $SUB -NIFTI"

This fails with:

++ Running @SUMA_Make_Spec_FS version: 2.2.4
program not found in path: mris_convert
1 program(s) not found
program failure: exiting...

So:

  • @SUMA_Make_Spec_FS exists in AFNI’s container,
  • but it cannot find mris_convert,
  • because the FreeSurfer binaries only exist inside the other container (freesurfer_v8.1.sif).

Binding the FreeSurfer directory makes the data visible, but it does not expose the FS commands.


My questions

What is the recommended way in Neurodesk to generate FSvent when AFNI and FreeSurfer are split across separate containers?

Specifically:

  1. Is there an existing AFNI+FreeSurfer combined container?
  2. Is there a documented workflow where @SUMA_Make_Spec_FS is run inside the FreeSurfer container instead of the AFNI one?
  3. Is there a wrapper or module on Neurodesk/Puma that puts AFNI and FS binaries on the same PATH?
  4. If none of the above are standard, is there a different recommended method for generating the FSvent mask used by AFNI for nuisance regression?

Right now, recon-all is complete and correct, but I’m blocked because AFNI’s SUMA tools cannot access FreeSurfer’s executables.

Any guidance on the expected / canonical way to do this in Neurodesk would be greatly appreciated.

P.S. For now, I am working around the issue by:

  • Running recon-all in the FreeSurfer container (done).
  • Still inside the FreeSurfer container, using mri_binarize and mri_convert to create NIFTI ventricle and WM masks.
  • Then, in AFNI, warping these masks to EPI space and extracting PCs manually.

This appears functionally equivalent to the FSvent approach, but I would still like to know the intended / supported method within the Neurodesk ecosystem.

Hi @Cagatay_Cora and welcome to neurostars!

Did you see this related thread? Mris_convert within fmriprep-docker - #4 by Steven

Best,
Steven

Hi @Steven
Thanks for the pointer to that thread. I ended up doing something very similar with a Singularity/Apptainer sandbox, and it solved the problem.

On Puma, I built a sandbox from the Neurodesk FreeSurfer image and then, when running @SUMA_Make_Spec_FS from the AFNI container, I bind the sandboxed FreeSurfer tree into the container and set FREESURFER_HOME so that -fs_setup can source SetUpFreeSurfer.csh. With that, mris_convert is on the PATH and @SUMA_Make_Spec_FS runs successfully, producing the SUMA outputs and FSvent masks.

From there I can use the FSvent/WM masks in afni_proc.py (as anat_follower_ROI plus -regress_ROI_PC FSvent 5 and -regress_ROI_PC_per_run FSvent), which was the original goal.

This seems like a workable pattern for folks on Puma using separate AFNI and FreeSurfer Neurodesk containers.