Skip to content

Commit

Permalink
Merge tag '3.0.4' into merge-with-main-mrtrix
Browse files Browse the repository at this point in the history
tagged version 3.0.4
  • Loading branch information
Lee Reid committed Apr 12, 2024
2 parents f40b165 + 32d1704 commit 4716d7c
Show file tree
Hide file tree
Showing 1,033 changed files with 2,384 additions and 1,882 deletions.
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Bug report
about: Create a report to help us improve
title: "[command]: [bug report title]"
labels: bug
assignees: ''

---

Please use this form for *bug reports only*; for installation problems, and general questions and support, please consult the [community forum](http://community.mrtrix.org/search?expanded=true).

**Describe the bug**

A clear and concise description of what the bug is; including if appropriate
how the observed behaviour differs from that expected.

**To Reproduce**

Steps to reproduce the behaviour.

If the issue is data-dependent, please consider providing a link to
(anonymised) data to assist developers in reproducing the bug.

**Platform/Environment/Version**

Please provide the following information:

- OS: (ubuntu: `lsb_release -a`, macOS: `sw_vers -productVersion`) [e.g. Ubuntu 16.04]

- *MRtrix3* version (example: `mrinfo -version`) [ e.g. `3.0_RC3-309-g0074bc6c` ]

---

**Advanced debugging information (if applicable)**

- In case of a critical error such as "segmentation fault", please generate
and report the backtrace as described [here](https://community.mrtrix.org/t/advanced-debugging-of-mrtrix3-binaries).

- For issues with `mrview`, please provide:

- Information about the Qt version; one of the following:

- `grep "Qt:" $(dirname $(which mrview))/../config`

- Open `mrview` --> `[i]` --> About Qt

- In the case of crashes or rendering issues, the information from:
`mrview -exit -debug`.
7 changes: 4 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:




jobs:
linux-clang-build:

Expand All @@ -24,7 +25,7 @@ jobs:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install clang-8 libqt5opengl5-dev libqt5svg5-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev
sudo apt-get install clang libqt5opengl5-dev libqt5svg5-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev
- name: configure
run: ./configure -assert || { cat configure.log; false; }
Expand Down Expand Up @@ -161,7 +162,7 @@ jobs:
- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install pylint3 python3-sphinx sphinx-rtd-theme-common python3-recommonmark python3-sphinx-rtd-theme python3-pip
sudo apt-get install pylint python3-sphinx sphinx-rtd-theme-common python3-recommonmark python3-sphinx-rtd-theme python3-pip
pip3 install sphinx-notfound-page
Expand All @@ -180,7 +181,7 @@ jobs:
run: python3 -m sphinx -n -N -W -w sphinx.log docs/ tmp/

- name: install build dependencies
run: sudo apt-get install clang-8 libqt5opengl5-dev libqt5svg5-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev
run: sudo apt-get install python2 clang libqt5opengl5-dev libqt5svg5-dev libglvnd-dev libeigen3-dev zlib1g-dev libfftw3-dev

- name: check configure with Python 2
run: python2 ./configure || { cat configure.log; false; }
Expand Down
18 changes: 12 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM buildpack-deps:buster AS base-builder
FROM base-builder AS mrtrix3-builder

# Git commitish from which to build MRtrix3.
ARG MRTRIX3_GIT_COMMITISH="3.0.3"
ARG MRTRIX3_GIT_COMMITISH="3.0.4"
# Command-line arguments for `./configure`
ARG MRTRIX3_CONFIGURE_FLAGS=""
# Command-line arguments for `./build`
Expand Down Expand Up @@ -40,21 +40,21 @@ WORKDIR /opt/art
RUN curl -fsSL https://osf.io/73h5s/download \
| tar xz --strip-components 1

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

# Download FreeSurfer files.
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)
# Download minified FSL (6.0.4-2)
FROM base-builder as fsl-installer
WORKDIR /opt/fsl
RUN curl -fsSL https://osf.io/dv258/download \
RUN curl -fsSL https://osf.io/dtep4/download \
| tar xz --strip-components 1

# Build final image.
Expand All @@ -63,6 +63,7 @@ FROM base AS final
# Install runtime system dependencies.
RUN apt-get -qq update \
&& apt-get install -yq --no-install-recommends \
binutils \
dc \
less \
libfftw3-3 \
Expand All @@ -73,6 +74,7 @@ RUN apt-get -qq update \
libqt5core5a \
libqt5gui5 \
libqt5network5 \
libqt5svg5 \
libqt5widgets5 \
libquadmath0 \
libtiff5 \
Expand All @@ -96,5 +98,9 @@ ENV ANTSPATH="/opt/ants/bin" \
LD_LIBRARY_PATH="/opt/fsl/lib:$LD_LIBRARY_PATH" \
PATH="/opt/mrtrix3/bin:/opt/ants/bin:/opt/art/bin:/opt/fsl/bin:$PATH"

WORKDIR /work
# 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

CMD ["/bin/bash"]
25 changes: 14 additions & 11 deletions Singularity
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ Include: apt
FSLTCLSH=/opt/fsl/bin/fsltclsh
FSLWISH=/opt/fsl/bin/fslwish
export FSLDIR FSLOUTPUTTYPE FSLMULTIFILEQUIT FSLTCLSH FSLWISH

# All
LD_LIBRARY_PATH="/usr/local/cuda/lib64:/usr/local/cuda/bin:/.singularity.d/libs:/usr/lib:/opt/fsl/lib:$LD_LIBRARY_PATH"
PATH="/opt/mrtrix3/bin:/opt/ants/bin:/opt/art/bin:/opt/fsl/bin:/usr/local/cuda/bin:$PATH"
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"
export LD_LIBRARY_PATH PATH

%post
Expand All @@ -39,30 +39,33 @@ Include: apt
apt-get update && apt-get upgrade -y

# Runtime requirements
apt-get update && apt-get install -y --no-install-recommends dc less libfftw3-bin liblapack3 libpng16-16 libqt5network5 libqt5widgets5 libtiff5 python3 python3-distutils zlib1g
apt-get update && apt-get install -y --no-install-recommends dbus dc less libfftw3-bin liblapack3 libpng16-16 libqt5network5 libqt5widgets5 libtiff5 python3 python3-distutils zlib1g

# Build requirements
apt-get update && apt-get install -y --no-install-recommends build-essential ca-certificates curl git libeigen3-dev libfftw3-dev libgl1-mesa-dev libpng-dev libqt5opengl5-dev libqt5svg5-dev libtiff5-dev qt5-qmake qtbase5-dev-tools wget zlib1g-dev

# Neuroimaging software / data dependencies
# Download minified ART ACPCdetect (V2.0).
mkdir -p /opt/art && curl -fsSL https://osf.io/73h5s/download | tar xz -C /opt/art --strip-components 1
# Download minified ANTs (2.3.4).
mkdir -p /opt/ants && curl -fsSL https://osf.io/3ad69/download | tar xz -C /opt/ants --strip-components 1
# Download minified ANTs (2.3.4-2).
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).
mkdir -p /opt/fsl && curl -fsSL https://osf.io/dv258/download | tar xz -C /opt/fsl --strip-components 1
# 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

# Use Python3 for anything requesting Python, since Python2 is not installed
ln -s /usr/bin/python3 /usr/bin/python

# MRtrix3 setup
git clone -b 3.0.3 --depth 1 https://github.com/MRtrix3/mrtrix3.git /opt/mrtrix3
git clone -b 3.0.4 --depth 1 https://github.com/MRtrix3/mrtrix3.git /opt/mrtrix3
cd /opt/mrtrix3 && ./configure && ./build -persistent -nopaginate && rm -rf testing/ tmp/ && cd ../../

# apt cleanup to recover as much space as possible
apt-get remove -y build-essential ca-certificates curl git libeigen3-dev libfftw3-dev libgl1-mesa-dev libpng-dev libqt5opengl5-dev libqt5svg5-dev libtiff5-dev qt5-qmake qtbase5-dev-tools wget zlib1g-dev && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
apt-get remove -y build-essential ca-certificates curl git libeigen3-dev libfftw3-dev libgl1-mesa-dev libpng-dev libqt5opengl5-dev libqt5svg5-dev libtiff5-dev qt5-qmake qtbase5-dev-tools wget zlib1g-dev && apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/*

# Configure DBus to facilitate mrview execution
dbus-uuidgen

%runscript
exec /usr/bin/bash -c "$@"
exec "$@"
2 changes: 1 addition & 1 deletion bin/5ttgen
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright (c) 2008-2021 the MRtrix3 contributors.
# Copyright (c) 2008-2022 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
5 changes: 4 additions & 1 deletion bin/blend
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python2

# Copyright (c) 2008-2021 the MRtrix3 contributors.
# Copyright (c) 2008-2022 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 All @@ -15,6 +15,9 @@
#
# For more details, see http://www.mrtrix.org/.

# note: deal with these warnings properly when we drop support for Python 2:
# pylint: disable=consider-using-f-string

import os
import sys

Expand Down
5 changes: 4 additions & 1 deletion bin/convert_bruker
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright (c) 2008-2021 the MRtrix3 contributors.
# Copyright (c) 2008-2022 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 All @@ -15,6 +15,9 @@
#
# For more details, see http://www.mrtrix.org/.

# note: deal with these warnings properly when we drop support for Python 2:
# pylint: disable=unspecified-encoding

import sys, os.path

if len (sys.argv) != 3:
Expand Down
29 changes: 15 additions & 14 deletions bin/dwi2response
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright (c) 2008-2021 the MRtrix3 contributors.
# Copyright (c) 2008-2022 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 @@ -100,19 +100,20 @@ def execute(): #pylint: disable=unused-variable

app.goto_scratch_dir()

if app.ARGS.mask:
# Check that the brain mask is appropriate
mask_header = image.Header('mask.mif')
if mask_header.size()[:3] != image.Header('dwi.mif').size()[:3]:
raise MRtrixError('Dimensions of provided mask image do not match DWI')
if not (len(mask_header.size()) == 3 or (len(mask_header.size()) == 4 and mask_header.size()[3] == 1)):
raise MRtrixError('Provided mask image needs to be a 3D image')
else:
app.console('Computing brain mask (dwi2mask)...')
run.command('dwi2mask dwi.mif mask.mif', show=False)

if not image.statistics('mask.mif', mask='mask.mif').count:
raise MRtrixError(('Provided' if app.ARGS.mask else 'Generated') + ' mask image does not contain any voxels')
if alg.supports_mask():
if app.ARGS.mask:
# Check that the brain mask is appropriate
mask_header = image.Header('mask.mif')
if mask_header.size()[:3] != image.Header('dwi.mif').size()[:3]:
raise MRtrixError('Dimensions of provided mask image do not match DWI')
if not (len(mask_header.size()) == 3 or (len(mask_header.size()) == 4 and mask_header.size()[3] == 1)):
raise MRtrixError('Provided mask image needs to be a 3D image')
else:
app.console('Computing brain mask (dwi2mask)...')
run.command('dwi2mask dwi.mif mask.mif', show=False)

if not image.statistics('mask.mif', mask='mask.mif').count:
raise MRtrixError(('Provided' if app.ARGS.mask else 'Generated') + ' mask image does not contain any voxels')

# From here, the script splits depending on what estimation algorithm is being used
alg.execute()
Expand Down
2 changes: 1 addition & 1 deletion bin/dwibiascorrect
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright (c) 2008-2021 the MRtrix3 contributors.
# Copyright (c) 2008-2022 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
39 changes: 30 additions & 9 deletions bin/dwicat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright (c) 2008-2021 the MRtrix3 contributors.
# Copyright (c) 2008-2022 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 All @@ -15,9 +15,12 @@
#
# For more details, see http://www.mrtrix.org/.

# note: deal with these warnings properly when we drop support for Python 2:
# pylint: disable=unspecified-encoding


import json

import json, shutil



Expand All @@ -36,7 +39,7 @@ def usage(cmdline): #pylint: disable=unused-variable


def execute(): #pylint: disable=unused-variable
from mrtrix3 import MRtrixError #pylint: disable=no-name-in-module, import-outside-toplevel
from mrtrix3 import CONFIG, MRtrixError #pylint: disable=no-name-in-module, import-outside-toplevel
from mrtrix3 import app, image, path, run #pylint: disable=no-name-in-module, import-outside-toplevel

num_inputs = len(app.ARGS.inputs)
Expand All @@ -45,13 +48,26 @@ def execute(): #pylint: disable=unused-variable

# check input data
def check_header(header):
if len(header.size()) != 4:
raise MRtrixError('Image "' + header.name() + '" is not a 4D image series')
if len(header.size()) > 4:
raise MRtrixError('Image "' + header.name() + '" contains more than 4 dimensions')
if not 'dw_scheme' in header.keyval():
raise MRtrixError('Image "' + header.name() + '" does not contain a gradient table')
num_grad_lines = len(header.keyval()['dw_scheme'])
if num_grad_lines != header.size()[3]:
raise MRtrixError('Number of lines in gradient table for image "' + header.name() + '" (' + str(num_grad_lines) + ') does not match number of volumes (' + str(header.size()[3]) + ')')
dw_scheme = header.keyval()['dw_scheme']
try:
if isinstance(dw_scheme[0], list):
num_grad_lines = len(dw_scheme)
elif (isinstance(dw_scheme[0], ( int, float))) and len(dw_scheme) >= 4:
num_grad_lines = 1
else:
raise MRtrixError
except (IndexError, MRtrixError):
raise MRtrixError('Image "' + header.name() + '" contains gradient table of unknown format')
if len(header.size()) == 4:
num_volumes = header.size()[3]
if num_grad_lines != num_volumes:
raise MRtrixError('Number of lines in gradient table for image "' + header.name() + '" (' + str(num_grad_lines) + ') does not match number of volumes (' + str(num_volumes) + ')')
elif not (num_grad_lines == 1 and len(dw_scheme) >= 4 and dw_scheme[3] <= float(CONFIG.get('BZeroThreshold', 10.0))):
raise MRtrixError('Image "' + header.name() + '" is 3D, and cannot be validated as a b=0 volume')

first_header = image.Header(path.from_user(app.ARGS.inputs[0], False))
check_header(first_header)
Expand Down Expand Up @@ -87,7 +103,12 @@ def execute(): #pylint: disable=unused-variable

# extract b=0 volumes within each input series
for index in range(0, num_inputs):
run.command('dwiextract ' + str(index) + 'in.mif ' + str(index) + 'b0.mif -bzero')
infile = str(index) + 'in.mif'
outfile = str(index) + 'b0.mif'
if len(image.Header(infile).size()) > 3:
run.command('dwiextract ' + infile + ' ' + outfile + ' -bzero')
else:
run.function(shutil.copyfile, infile, outfile)

mask_option = ' -mask_input mask.mif -mask_target mask.mif' if app.ARGS.mask else ''

Expand Down
Loading

0 comments on commit 4716d7c

Please sign in to comment.