Mris_convert within fmriprep-docker

hi there

new to fmriprep as well as docker/containerization. i installed the docker version on my macbook and it ran fine. but with the freesurfer outputs i’d like to now run @SUMA_Make_Spec_FS and it’s looking for mris_convert, which is containerized. i assume i’d have to actually just install a stand-alone FS or can mris_convert be installed stand-alone? or can i refer to an mris_convert path within the docker container that @SUMA_Make_Spec_FS would recognize? it’s not the end of the world installing FS by itself on this machine, i’m just trying to understand options/flexibility. thanks!


Hello and welcome to Neurostars!

This is a bit tricky, because commands that are in the container are not on your local path. I know of one potential solution, but only know how to do it in Singularity.

  1. You can build the docker container as a sandbox (basically, it is a set of folders instead of a .sif/.img file) with for example singularity build --sandbox fmriprep.img docker://nipreps/fmriprep:latest.
  2. Find where the FreeSurfer command is by entering the container:
singularity shell fmriprep.img
which mri-convert

which outputs /opt/freesurfer/bin/mri_convert
3) Based on that last answer, you can set your FREESURFER_HOME variable to that of singularity shell with

export FREESURFER_HOME=/PATH/TO/fmriprep.img/opt/freesurfer/
  1. Try rerunning your AFNI command. If that still doesn’t work, you can also try adding /PATH/TO/fmriprep.img/opt/freesurfer/bin to your path.

I wish I knew of the equivalent set of commands for Docker, but unfortunately I primarily use singularity.


1 Like

thanks for the welcome and thorough response! i’ll definitely try that if i switch to Singularity

Conversely, I suppose you can try mounting your AFNI installation on to the container (In docker this is done with the -v /Path/To/Thing/To/Mount argument), and then execute your AFNI command.

1 Like

Hi @stbmtx

Another option could be use - it makes combining multiple neuroimaging containers very easy (and it’s based on running singularity containers similarly to what @Steven mentioned + you don’t need to download these containers as we “stream” them to you) :slight_smile:

here is how you would do this in Neurodesk - just open a standard terminal and run:
ml fmriprep/21.0.1
(run your fmriprep pipeline)
ml freesurfer/7.1.1
(now mris_convert is on your path)
ml afni/22.1.14

now you can run your afni tools and they can use mris_convert from freesurfer 7.1.1 + you have full version control of everything :slight_smile:

Neurodesk runs on every operating system and you can also quickly try it out in the browser: NeurodeskPlay