question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ENH: Support dockerized FreeSurfer installations

See original GitHub issue

Describe the problem

The vast majority of scientists I work with use Windows computers. However, parts of MNE’s source estimation stack rely on FreeSurfer, which is only available for Linux and macOS. This issue is preventing a number of my colleagues from switching to MNE-Python.

Describe your solution

Currently, FreeSurfer operations are carried out by concatenating a list of arguments and passing these to the respective FreeSurfer command line tool. This, obviously, will work only if FreeSurfer has been installed, so Windows is excluded per se.

To extend support to the Windows platform, I suggest to add support for containerized FreeSurfer installations, specifically for Docker images: Instead of invoking a FreeSurfer subprocess on the host machine, MNE-Python would execute the operation inside a Docker container. For example, instead of calling mri_watershed -T1 -useSRAS ... we’d call something along the lines of docker run -it -d mne/FreeSurfer mri_watershed -T1 -useSRAS ... Of course, we’d also need to map host directories to the appropriate places inside the container.

The user, then, would only need to acquire a FreeSurfer license file and install Docker; the rest could be done automatically. Incidentally, this would work on all platforms.

To allow switching between the local installation and the container, a kwarg freesurfer_backend could be added to the relevant Python function signatures: freesurfer_backend='native' (or 'local') uses the host installation, and freesurfer_backend='docker' uses the Docker container (and first pulls the image, if necessary). Might even be worthwhile to allow for different Docker images, e.g., docker_image='mne/FreeSurfer-extended:latest'

There is already a FreeSurfer image on Docker Hub which could serve as a base, and inspiration could be drawn from the FreeSurfer BIDS App.

Describe possible alternatives

The FreeSurfer BIDS App already dockerizes FreeSurfer for processing of BIDS-compliant data; however, currently it’s a “stand-alone” thingy without integration into MNE-Python.

If the idea of a dockerized FreeSurfer is generally liked, it might be worthwhile to discuss whether adding a new, thin abstraction layer between MNE-Python and FreeSurfer could be of advantage in case we’d like to add support for additional FreeSurfer backends later on. For example, on Windows 10, Windows Subsystem for Linux (WSL) seems like an almost natural choice.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:30 (30 by maintainers)

github_iconTop GitHub Comments

2reactions
hoechenbergercommented, Jan 13, 2020

Thanks for your help, @buildqa! I already have a working Docker image (slightly modified the one officially supplied by FreeSurfer), so no need for any packaging required at this time. Regarding the FREESURFER_HOME variable, of course I would always set it inside the Docker container; my question was just how to treat the variable set on the host computer 😃 Currently I‘m just following @larsoner‘s suggestion of ignoring the host‘s variable and simply setting it correctly inside the container. All working great so far.

Will share my results in a couple of days; still in a very early stage due to time constraints.

1reaction
hoechenbergercommented, Mar 4, 2020

Sure, sorry I didn’t manage to work on this – I did start but then got caught up having to do too many other different things. Will pick this up again for sure, hopefully soon and with permission of @agramfort 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

infantFS-containers - Free Surfer Wiki
Containers for running FreeSurfer's infant pipeline. This guide describes how to build and run containers to execute and examine the outputs ...
Read more >
SynthStrip: Skull-Stripping for Any Brain Image - FreeSurfer
Overview. SynthStrip is a skull-stripping tool that extracts brain signal from a landscape of image types, ranging across imaging modality, contrast, ...
Read more >
infantFS - Free Surfer Wiki
(Note, we cannot download FSL in the docker container because their new install process requires signing up or using an FSL license, so...
Read more >
FreeSurfer - Docker Hub
This repository contains the entire FreeSurfer distribution - including all available subjects, atlases, and visualization tools.
Read more >
imaging bioinformatics system: Topics by Science.gov
For a future career in biology or bioinformatics, the installation of ... For the development of such a decision support system, object-oriented (OO)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found