A suite of tools for medical image processing focused on brain analysis
BRAINSTools is a CMake SuperBuild harness for neuro-image analysis, providing a comprehensive suite of command-line tools for brain MRI processing. Built on ITK, VTK, ANTs, and SlicerExecutionModel, BRAINSTools covers registration, segmentation, atlas generation, DWI processing, cortical thickness estimation, and defacing.
BRAINSTools is developed at the University of Iowa and is also distributed as part of 3D Slicer.
| Source | github.com/BRAINSia/BRAINSTools |
| Wiki | BRAINSTools Wiki |
| Dashboard | CDash |
| License | Apache 2.0 |
| Version | 5.8.0 |
| Standard | C++17 (supports C++20, C++23) |
| Tool | Description |
|---|---|
| BRAINSFit | General-purpose rigid, affine, and BSpline image registration |
| BRAINSConstellationDetector | Landmark-based alignment using anatomical constellation detection (AC-PC) |
| BRAINSLandmarkInitializer | Compute initial transforms from paired landmark files |
| BRAINSResample | Apply transforms to resample images into new coordinate spaces |
| BRAINSTransformConvert | Convert between transform file formats |
| BRAINSStripRotation | Remove rotation component from transforms |
| Tool | Description |
|---|---|
| BRAINSABC | Atlas-based tissue classification using expectation-maximization |
| BRAINSROIAuto | Automatic brain ROI extraction for masking |
| BRAINSCreateLabelMapFromProbabilityMaps | Convert probability maps to discrete label maps |
| BRAINSInitializedControlPoints | Initialize BSpline control-point grids for deformable registration |
| Tool | Description |
|---|---|
| DWIConvert | Convert between DICOM, NRRD, and NIfTI DWI formats |
| BRAINSDWICleanup | Quality-control cleanup of diffusion-weighted images |
| GTRACT | Complete DTI processing pipeline (tensor estimation, tractography, tract matching) |
| Tool | Description |
|---|---|
| ImageCalculator | Voxel-wise arithmetic on images (add, multiply, mask, threshold, etc.) |
| ConvertBetweenFileFormats | Convert medical images between NIfTI, NRRD, MetaImage, and other ITK-supported formats |
| BRAINSLabelStats | Compute statistics within labeled regions |
| BRAINSSnapShotWriter | Generate PNG snapshots of 3D volumes for quality review |
| BRAINSIntensityNormalize | Normalize image intensity ranges |
| Tool | Description |
|---|---|
| BRAINSDeface | Remove facial features from structural MRI for anonymization |
| BRAINSSuperResolution | Super-resolution reconstruction from multiple acquisitions |
| BRAINSMultiSTAPLE | Multi-rater label fusion using STAPLE algorithm |
| AutoWorkup | End-to-end Python-driven brain processing pipeline |
BRAINSTools builds ANTs as part of its
SuperBuild, giving you access to the full ANTs toolkit (SyN registration,
cortical thickness via antsCorticalThickness.sh, N4 bias correction, etc.)
alongside the BRAINS tools.
git clone https://github.com/BRAINSia/BRAINSTools.git
BRAINSTools uses a two-phase SuperBuild: Phase I builds all dependencies (ITK, VTK, ANTs, etc.) automatically; Phase II builds the BRAINSTools themselves. You do not need to install dependencies manually.
cmake -B build -S BRAINSTools \
-G Ninja \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DUSE_BRAINSFit:BOOL=ON \
-DUSE_BRAINSConstellationDetector:BOOL=ON \
-DUSE_BRAINSABC:BOOL=ON \
-DUSE_ANTS:BOOL=ON
cmake --build build --config Release
The first build downloads and compiles all external dependencies, so expect it to take 30-60 minutes depending on your hardware. Subsequent rebuilds after source edits are fast because only changed targets recompile.
Each tool is controlled by a USE_<ToolName> CMake option. Many are ON by
default. Pass -DUSE_<ToolName>:BOOL=ON or OFF at configure time:
cmake -B build -S BRAINSTools \
-G Ninja \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DUSE_BRAINSFit:BOOL=ON \
-DUSE_DWIConvert:BOOL=ON \
-DBRAINSTools_BUILD_DICOM_SUPPORT:BOOL=ON \
-DUSE_BRAINSDeface:BOOL=ON
Note:
USE_DWIConvertandUSE_GTRACTrequire-DBRAINSTools_BUILD_DICOM_SUPPORT:BOOL=ON.
After a successful build, executables are located in:
build/BRAINSTools-Release-EP-Release-build/bin/
BRAINSTools provides a tiered test system controlled by
BRAINSTools_MAX_TEST_LEVEL. This lets you balance test coverage against
build time.
cmake -B build -S BRAINSTools \
-G Ninja \
-DBRAINSTools_MAX_TEST_LEVEL:STRING=3
cmake --build build
cd build && ctest -j$(nproc)
| Level | Purpose | When to Run |
|---|---|---|
| 1 | Absolute minimum, very fast tests | Before every commit |
| 3 | Fast tests for continuous integration | Every CI build (default) |
| 5 | Moderate nightly tests | Nightly dashboards |
| 7 | Long-running extensive tests | Weekly |
| 8 | Incomplete / in-development tests | As needed |
| 9 | Low-utility experimental tests | Rarely |
if(${BRAINSTools_MAX_TEST_LEVEL} GREATER 8)
ExternalData_add_test(BRAINSToolsFetchData
NAME itkResampleInPlaceImageFilterTest
COMMAND $<TARGET_FILE:itkResampleInPlaceImageFilterTest>
itkResampleInPlaceImageFilterTest input1 transform1 checkresult
)
endif()
BRAINSTools can be built as a 3D Slicer remote
extension by setting -DSlicer_BUILD_BRAINSTOOLS:BOOL=ON in the Slicer
SuperBuild. In this mode, shared libraries are used and install paths follow
Slicer conventions.
cd BRAINSTools
bash ./Utilities/SetupForDevelopment.sh
This configures Git hooks, remotes, and the recommended developer workflow. See the wiki for contribution guidelines.