Skip to content

freesurfer/samseg

Repository files navigation

SAMSEG

This repository is under construction. Please look at the main repository in the meantime.

TODO: Add segmentation image(s)?

Sequence Adaptive Multimodal SEGmentation (SAMSEG) is a tool to robustly segment dozens of brain structures from head MRI scans without preprocessing. The characteristic property of SAMSEG is that it accepts multi-contrast MRI data without prior assumptions on the specific type of scanner or pulse sequences used. Dedicated versions to handle longitudinal data, or to segment white matter lesions in multiple sclerosis (MS) patients are also available.

TODO: The description above does not include the subregions module. Fix this.

Build Status

Linux Windows MacOS
Build Status Build Status Build Status

Getting Started

SAMSEG runs on 64bit Windows, Linux, and MacOS machines. Please visit the official SAMSEG Wiki and subregions Wiki for instructions.

Most of the functionalities of SAMSEG do not require FreeSurfer to be installed on your system, except:

  • longitudinal registration preprocessing;
  • subregions module.

Installing from source (on *nix)

  1. Clone project: git clone https://github.com/freesurfer/samseg.git

  2. Get the submodules: git submodule init git submodule update

  3. Create a virtual environment using, e.g., conda: conda create -n samseg python=3.9

  4. Activate the virtual environment: conda activate samseg

  5. Install correct compilers for ITK v.4.13.2 conda install -c conda-forge gxx_linux-64=7.5 gcc_linux-64=7.5 sysroot_linux-64=2.17

  6. Create the ITK build directory mkdir ITK-build cd ITK-build

  7. Export compilers installed with conda: export CC=<your_conda_path>/envs/samseg/bin/x86_64-conda_cos6-linux-gnu-gcc export CXX=<your_conda_path>/envs/samseg/bin/x86_64-conda_cos6-linux-gnu-g++

  8. Run CMAKE: cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../ITK-install ../ITK

  9. Install: make install cd..

  10. Install in development mode (.[test] installs pytest, use just . if you don't want to run tests) ITK_DIR=ITK-install python -m pip install --editable .[test]

  11. If you want to build wheels call ITK_DIR=ITK-install python -m pip wheel . -w ./dist --no-deps

  12. If you're developing and want to run the tests call (in the root of the git repository): pytest samseg

References

If you use these tools in your analysis, please cite: