THIS PAGE HAS BEEN MOVED TO SHAREPOINT!

Please refer to this site/make edits here for the most updated information: https://partnershealthcare.sharepoint.com/sites/LCN/SitePages/Additional-Martinos-Center-Resources.aspx#freesurfer-and-lcn-python-development





FreeSurfer and LCN Python Development

To facilitate straightforward and reproducible python development in the lab, a local conda distribution for internal developers is installed at /autofs/cluster/freesurfer/python/linux. To use this version, make sure all calls to python or python3 point to this install by adding the following to your PATH:

export PATH=/autofs/cluster/freesurfer/python/linux/bin:$PATH

Keep in mind there's also a python3 link in /usr/pubsw/bin, so it's important that /autofs/cluster/freesurfer/python/linux/bin comes before that in your PATH. If you want a python package installed into this distribution, email Andrew.

NOTE: This "lab" conda install is meant for quick access to python utilities. If you're a frequent python developer who uses multiple package versions or environments, please install your own local conda distribution. It will give you full access and control of the installed packages.

Developing and Using the FreeSurfer Python Library

The freesurfer python library source, which contains general utilities and various submodules like gems and samseg, is developed in the repository under repo/python/freesurfer. In order to utilize this library for your own local development, you must point your PYTHONPATH at it:

export PYTHONPATH=/path/to/your/freesurfer-repository/python:$PYTHONPATH

This allows you to import your working version of the freesurfer library in any script or python interpreter. Alternatively, there is a nightly build of the freesurfer module, enabling import of the package without cloning or installing the full freesurfer repository. To access this, add the following to your PYTHONPATH. Currently, we build for python 3.5-3.8.

export PYTHONPATH=/autofs/cluster/freesurfer/python/fsmodule:$PYTHONPATH