Some FreeSurfer functions unavailable in nipype Docker container


Summary of what happened:

I tried to transform a surface based image into volume space using nipype’s freesurfer.Surface2VolumeTransform in a nipype container. But running that function failed unfortunately because the command mri_surf2vol could not be found. I noticed that also in the terminal within that container it looks like no mri_surf2vol was on the PATH.

It is nice to have all fMRI analysis toolboxes integrated in this one nipype container. It is just a pity that some of the FreeSurfer functionality appears not to be available in the container.

Currently I am running some of the FreeSurfer commands outside the container in a different environment. This solution is not exactly ideal. How can I use all of FreeSurfer with the nipype image?

A few thoughts come to mind:

  1. Install a different FreeSurfer manually inside Docker (a bit annoying because FreeSurfer is supposed to already be there and the two installations might not play nice with each other)
  2. Perhaps -v mount an existing installation from outside and run the container (not sure if this would actually work)

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

import nipype.interfaces.freesurfer as fs
import os

opj = os.path.join

sub_id = 'sub-sid000005'
hemi = 'lh'

surf2vol = fs.Surface2VolTransform()

surf2vol.inputs.source_file = opj(
    fs_dir, sub_id, 'surf/%s.wang15_mplbl.mgz' % hemi)
surf2vol.inputs.transformed_file = opj(
    fmriprep_dir, sub_id, 'rois/%s_wang15_mplbl.nii.gz')
surf2vol.inputs.template_file = opj(
    fmriprep_dir, sub_id,
    'func/%s_task-movie_run-3_space-T1w_boldref.nii.gz' % sub_id)
surf2vol.inputs.reg_file = opj(
    fs_dir, sub_id, 'stats/%s_register.dat' % sub_id)
surf2vol.inputs.subjects_dir = fs_dir
surf2vol.inputs.projfrac = .1
surf2vol.inputs.hemi = hemi


nipype 1.8.6.dev0

Environment (Docker, Singularity, custom installation):

I am using this nipype Docker image.

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

BIDS validation successful

Relevant log outputs (up to 20 lines):

OSError                                   Traceback (most recent call last)
Cell In[12], line 20
     17 surf2vol.inputs.projfrac = .1
     18 surf2vol.inputs.hemi = hemi
---> 20

File /src/nipype/nipype/interfaces/freesurfer/, in, **inputs)
    147     self.inputs.subjects_dir = inputs["subjects_dir"]
    148 self._subjects_dir_update()
--> 149 return super(FSCommand, self).run(**inputs)

File /src/nipype/nipype/interfaces/base/, in, cwd, ignore_exception, **inputs)
    396 # Run interface
    397 runtime = self._pre_run_hook(runtime)
--> 398 runtime = self._run_interface(runtime)
    399 runtime = self._post_run_hook(runtime)
    400 # Collect outputs

File /src/nipype/nipype/interfaces/base/, in CommandLine._run_interface(self, runtime, correct_return_codes)
    750 cmd_path = which(executable_name, env=runtime.environ)
    752 if cmd_path is None:
--> 753     raise IOError(
    754         'No command "%s" found on host %s. Please check that the '
    755         "corresponding package is installed."
    756         % (executable_name, runtime.hostname)
    757     )
    759 runtime.command_path = cmd_path
    760 runtime.dependencies = (
    761     get_dependencies(executable_name, runtime.environ)
    762     if self._ldd
    763     else ""
    764 )

OSError: No command "mri_surf2vol" found on host b32ee0851ce9. Please check that the corresponding package is installed.

Any ideas?