Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge branch 'master' into 'dev' #3061

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install clang qt6-base-dev libglvnd-dev zlib1g-dev libfftw3-dev ninja-build python3-distutils python3-numpy
sudo apt-get install clang qt6-base-dev libglvnd-dev zlib1g-dev libfftw3-dev ninja-build python3-numpy libpng-dev

- name: Run sccache-cache
uses: mozilla-actions/[email protected]
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install g++-9 qt6-base-dev libglvnd-dev zlib1g-dev libfftw3-dev ninja-build python3-numpy
sudo apt-get install g++-9 qt6-base-dev libglvnd-dev zlib1g-dev libfftw3-dev ninja-build python3-numpy libpng-dev

- name: Run sccache-cache
uses: mozilla-actions/[email protected]
Expand Down
137 changes: 137 additions & 0 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Releases

on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to release from'
required: true
default: 'dev'

jobs:
linux-release:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}

- name: Set env vars
id: envs
run: |
commit_sha=$(git rev-parse HEAD)
date=$(date +%Y_%m_%d)
echo "commit_sha=$commit_sha" >> $GITHUB_OUTPUT
echo "date=$date" >> $GITHUB_OUTPUT
echo "output_name=mrtrix3-linux-$commit_sha-$date" >> $GITHUB_OUTPUT

- name: Install Eigen3
run: |
git clone https://gitlab.com/libeigen/eigen.git && cd eigen && git checkout 3.4.0
cmake -B build && cmake --build build
sudo cmake --install build

- name: Install Qt 6
uses: jurplel/install-qt-action@v3
with:
version: '6.7.0'
set-env: true

- name: Run build
run: |
./packaging/package-linux-tarball.sh .
mv mrtrix.tar.gz ${{ steps.envs.outputs.output_name }}.tar.gz

- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.envs.outputs.output_name }}
path: ${{ steps.envs.outputs.output_name }}.tar.gz

macos-release:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}

- name: Set env vars
id: envs
run: |
commit_sha=$(git rev-parse HEAD)
date=$(date +%Y_%m_%d)
echo "commit_sha=$commit_sha" >> $GITHUB_OUTPUT
echo "date=$date" >> $GITHUB_OUTPUT
echo "output_name=mrtrix3-macos-$commit_sha-$date" >> $GITHUB_OUTPUT

- name: Install deps
run: brew install numpy cmake qt eigen pkg-config fftw libpng ninja

- name: Run build
run: |
cd ./packaging/macos
./build ${{ github.event.inputs.branch }}
mv ./mrtrix3-macos-${{ github.event.inputs.branch }}.tar.xz ../../${{ steps.envs.outputs.output_name }}.tar.xz

- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.envs.outputs.output_name }}
path: ${{ steps.envs.outputs.output_name }}.tar.xz

windows-release:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}

env:
MINGW_PACKAGE_PREFIX: mingw-w64-ucrt-x86_64

steps:
- uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
install: |
git
python
${{env.MINGW_PACKAGE_PREFIX}}-bc
${{env.MINGW_PACKAGE_PREFIX}}-cmake
${{env.MINGW_PACKAGE_PREFIX}}-diffutils
${{env.MINGW_PACKAGE_PREFIX}}-eigen3
${{env.MINGW_PACKAGE_PREFIX}}-fftw
${{env.MINGW_PACKAGE_PREFIX}}-gcc
${{env.MINGW_PACKAGE_PREFIX}}-libtiff
${{env.MINGW_PACKAGE_PREFIX}}-ninja
${{env.MINGW_PACKAGE_PREFIX}}-pkg-config
${{env.MINGW_PACKAGE_PREFIX}}-qt6-base
${{env.MINGW_PACKAGE_PREFIX}}-qt6-svg
${{env.MINGW_PACKAGE_PREFIX}}-zlib

- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}

- name: Set env vars
id: envs
run: |
commit_sha=$(git rev-parse HEAD)
date=$(date +%Y_%m_%d)
echo "commit_sha=$commit_sha" >> $GITHUB_OUTPUT
echo "date=$date" >> $GITHUB_OUTPUT
echo "output_name=mrtrix3-windows-$commit_sha-$date" >> $GITHUB_OUTPUT

- name: Run build
run: |
cd packaging/mingw
./run.sh ${{ steps.envs.outputs.commit_sha }} mrtrix3
mv mingw*.tar.zst ../../../${{ steps.envs.outputs.output_name }}.tar.zst

- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.envs.outputs.output_name }}
path: ${{ steps.envs.outputs.output_name }}.tar.zst
62 changes: 62 additions & 0 deletions .github/workflows/weekly_sanitizers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Sanitizers checks

on:
workflow_dispatch:
# Run this every Sunday at midnight
schedule:
- cron: "0 0 * * 0"

jobs:
linux-clang-build:
runs-on: ubuntu-latest

env:
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_SIZE: "2G"

strategy:
fail-fast: false
matrix:
sanitizer: [address, thread, undefined]

steps:
- uses: actions/checkout@v1
with:
submodules: true
ref: dev

- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install clang llvm qt6-base-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev ninja-build python3-numpy

- name: Run sccache-cache
uses: mozilla-actions/[email protected]

- name: Get CMake
uses: lukka/get-cmake@latest
with:
cmakeVersion: '3.16.3'

- name: Print CMake version
run: cmake --version

- name: configure
run: >
cmake
-B build
-G Ninja
-D CMAKE_BUILD_TYPE=RelWithDebInfo
-D MRTRIX_BUILD_TESTS=ON
-D ECM_ENABLE_SANITIZERS=${{ matrix.sanitizer }}
-D CMAKE_C_COMPILER=clang
-D CMAKE_CXX_COMPILER=clang++

- name: build
run: cmake --build build

- name: binary tests
run: cd build && ctest -L binary --output-on-failure

- name: unit tests
run: cd build && ctest -L unittest --output-on-failure
33 changes: 20 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG MAKE_JOBS="1"
ARG DEBIAN_FRONTEND="noninteractive"

FROM python:3.8-slim AS base
FROM buildpack-deps:buster AS base-builder
FROM buildpack-deps:bookworm AS base-builder

FROM base-builder AS mrtrix3-builder

Expand All @@ -21,39 +21,42 @@ RUN apt-get -qq update \
libpng-dev \
libqt5opengl5-dev \
libqt5svg5-dev \
qt5-default \
libtiff5-dev \
qtbase5-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

# Clone, build, and install MRtrix3.
ARG MAKE_JOBS
WORKDIR /opt/mrtrix3
RUN git clone -b $MRTRIX3_GIT_COMMITISH --depth 1 https://github.com/MRtrix3/mrtrix3.git . \
&& ./configure $MRTRIX3_CONFIGURE_FLAGS \
&& NUMBER_OF_PROCESSORS=$MAKE_JOBS ./build $MRTRIX3_BUILD_FLAGS \
&& python3 ./configure $MRTRIX3_CONFIGURE_FLAGS \
&& NUMBER_OF_PROCESSORS=$MAKE_JOBS python3 ./build $MRTRIX3_BUILD_FLAGS \
&& rm -rf tmp

# Download minified ART ACPCdetect (V2.0).
FROM base-builder as acpcdetect-installer
FROM base-builder AS acpcdetect-installer
WORKDIR /opt/art
RUN curl -fsSL https://osf.io/73h5s/download \
| tar xz --strip-components 1

# Download minified ANTs (2.3.4-2).
FROM base-builder as ants-installer
FROM base-builder AS ants-installer
WORKDIR /opt/ants
RUN curl -fsSL https://osf.io/yswa4/download \
| tar xz --strip-components 1

# Download FreeSurfer files.
FROM base-builder as freesurfer-installer
FROM base-builder AS freesurfer-installer
WORKDIR /opt/freesurfer
RUN curl -fsSLO https://raw.githubusercontent.com/freesurfer/freesurfer/v7.1.1/distribution/FreeSurferColorLUT.txt

# Download minified FSL (6.0.4-2)
FROM base-builder as fsl-installer
# Download minified FSL (6.0.7.7)
# TODO May be separate evolution of this dependency that needs to be addressed
# (or do #2684 / #2601)
FROM base-builder AS fsl-installer
WORKDIR /opt/fsl
RUN curl -fsSL https://osf.io/dtep4/download \
RUN curl -fsSL https://osf.io/ph9ex/download \
| tar xz --strip-components 1

# Build final image.
Expand All @@ -65,7 +68,8 @@ RUN apt-get -qq update \
binutils \
dc \
less \
libfftw3-3 \
libfftw3-single3 \
libfftw3-double3 \
libgl1-mesa-glx \
libgomp1 \
liblapack3 \
Expand All @@ -76,7 +80,9 @@ RUN apt-get -qq update \
libqt5svg5 \
libqt5widgets5 \
libquadmath0 \
libtiff5-dev \
python3-distutils \
procps \
&& rm -rf /var/lib/apt/lists/*

COPY --from=acpcdetect-installer /opt/art /opt/art
Expand All @@ -93,12 +99,13 @@ ENV ANTSPATH="/opt/ants/bin" \
FSLMULTIFILEQUIT="TRUE" \
FSLTCLSH="/opt/fsl/bin/fsltclsh" \
FSLWISH="/opt/fsl/bin/fslwish" \
LD_LIBRARY_PATH="/opt/fsl/lib:$LD_LIBRARY_PATH" \
PATH="/opt/mrtrix3/bin:/opt/ants/bin:/opt/art/bin:/opt/fsl/bin:$PATH"
PATH="/opt/mrtrix3/bin:/opt/ants/bin:/opt/art/bin:/opt/fsl/share/fsl/bin:$PATH"

# Fix "Singularity container cannot load libQt5Core.so.5" on CentOS 7
RUN strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5 \
&& ldconfig \
&& apt-get purge -yq binutils

RUN ln -s /usr/bin/python3 /usr/bin/python

CMD ["/bin/bash"]
10 changes: 6 additions & 4 deletions Singularity
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Include: apt
export FSLDIR FSLOUTPUTTYPE FSLMULTIFILEQUIT FSLTCLSH FSLWISH

# All
LD_LIBRARY_PATH="/.singularity.d/libs:/usr/lib:/opt/fsl/lib:$LD_LIBRARY_PATH"
PATH="/opt/mrtrix3/bin:/opt/ants/bin:/opt/art/bin:/opt/fsl/bin:$PATH"
LD_LIBRARY_PATH="/.singularity.d/libs:/usr/lib:$LD_LIBRARY_PATH"
PATH="/opt/mrtrix3/bin:/opt/ants/bin:/opt/art/bin:/opt/fsl/share/fsl/bin:$PATH"
export LD_LIBRARY_PATH PATH

%post
Expand All @@ -51,8 +51,10 @@ Include: apt
mkdir -p /opt/ants && curl -fsSL https://osf.io/yswa4/download | tar xz -C /opt/ants --strip-components 1
# Download FreeSurfer lookup table file (v7.1.1).
mkdir -p /opt/freesurfer && curl -fsSL -o /opt/freesurfer/FreeSurferColorLUT.txt https://raw.githubusercontent.com/freesurfer/freesurfer/v7.1.1/distribution/FreeSurferColorLUT.txt
# Download minified FSL (6.0.4-2).
mkdir -p /opt/fsl && curl -fsSL https://osf.io/dtep4/download | tar xz -C /opt/fsl --strip-components 1
# Download minified FSL (6.0.7.7).
# TODO May be separate evolutions of this dependency that require merging
# (or obviate through #2684 / #2601)
mkdir -p /opt/fsl && curl -fsSL https://osf.io/ph9ex/download | tar xz -C /opt/fsl --strip-components 1

# Use Python3 for anything requesting Python, since Python2 is not installed
ln -s /usr/bin/python3 /usr/bin/python
Expand Down
2 changes: 1 addition & 1 deletion check_syntax
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

# Copyright (c) 2008-2024 the MRtrix3 contributors.
# Copyright (c) 2008-2025 the MRtrix3 contributors.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
2 changes: 1 addition & 1 deletion clang-format-all
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3

# Copyright (c) 2008-2024 the MRtrix3 contributors.
# Copyright (c) 2008-2025 the MRtrix3 contributors.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmd/5tt2gmwmi.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2024 the MRtrix3 contributors.
/* Copyright (c) 2008-2025 the MRtrix3 contributors.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmd/5tt2vis.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2024 the MRtrix3 contributors.
/* Copyright (c) 2008-2025 the MRtrix3 contributors.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
9 changes: 5 additions & 4 deletions cpp/cmd/5ttcheck.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2024 the MRtrix3 contributors.
/* Copyright (c) 2008-2025 the MRtrix3 contributors.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down Expand Up @@ -146,10 +146,11 @@ void run() {
}

const std::string vox_option_suggestion =
get_options("masks").empty()
? " (suggest re-running using the -masks option to see voxels where tissue fractions do not sum to 1.0)"
get_options("voxels").empty()
? " (suggest re-running using the -voxels option "
"to see voxels where tissue fractions do not sum to 1.0)"
: (" (suggest checking " + std::string(argument.size() > 1 ? "outputs from" : "output of") +
" -masks option)");
" -voxels option)");

if (major_error_count) {
if (argument.size() > 1)
Expand Down
2 changes: 1 addition & 1 deletion cpp/cmd/5ttedit.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2008-2024 the MRtrix3 contributors.
/* Copyright (c) 2008-2025 the MRtrix3 contributors.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
Expand Down
Loading
Loading