Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 88 additions & 42 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# THIS DOCKERFILE IS BROKEN
# it is being developed to incorporate synb0 and dev branch of MRtrix3

FROM ubuntu:18.04
MAINTAINER Robert E. Smith <robert.smith@florey.edu.au>
LABEL org.opencontainers.image.authors="Robert E. Smith <robert.smith@florey.edu.au>"

# Core system capabilities required
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
Expand All @@ -18,7 +21,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
tcsh \
tzdata \
unzip \
wget
wget \
npm

# PPA for newer version of nodejs, which is required for bids-validator
RUN curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh && \
Expand Down Expand Up @@ -58,20 +62,31 @@ RUN wget -qO- https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.1.1/frees
--exclude='freesurfer/lib/qt'
RUN echo "cHJpbnRmICJyb2JlcnQuc21pdGhAZmxvcmV5LmVkdS5hdVxuMjg1NjdcbiAqQ3FLLjFwTXY4ZE5rXG4gRlNvbGRZRXRDUFZqNlxuIiA+IC9vcHQvZnJlZXN1cmZlci9saWNlbnNlLnR4dAo=" | base64 -d | sh
RUN apt-get install -y ants=2.2.0-1ubuntu1


# FSL installer appears to now be ready for use with version 6
# eddy is also now included in FSL6
RUN wget -q http://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py && \
chmod 775 fslinstaller.py && \
python2 /fslinstaller.py -d /opt/fsl -V 6.0.4 -q && \
rm -f /fslinstaller.py
RUN which immv || ( echo "FSLPython not properly configured; re-running" && rm -rf /opt/fsl/fslpython && /opt/fsl/etc/fslconf/fslpython_install.sh -f /opt/fsl || ( cat /tmp/fslpython*/fslpython_miniconda_installer.log && exit 1 ) )
#RUN wget -q http://fsl.fmrib.ox.ac.uk/fsldownloads/fslinstaller.py && \
# chmod 775 fslinstaller.py && \
# python2 /fslinstaller.py -d /opt/fsl -V 6.0.4 -q && \
# rm -f /fslinstaller.py
#RUN which immv || ( echo "FSLPython not properly configured; re-running" && rm -rf /opt/fsl/fslpython && /opt/fsl/etc/fslconf/fslpython_install.sh -f /opt/fsl || ( cat /tmp/fslpython*/fslpython_miniconda_installer.log && exit 1 ) )
FROM buildpack-deps:buster AS base-builder
FROM base-builder as fsl-installer
WORKDIR /opt/fsl
RUN curl -fsSL https://osf.io/dv258/download \
| tar xz --strip-components 1

# ROBEX
RUN wget -qO- "https://www.nitrc.org/frs/download.php/5994/ROBEXv12.linux64.tar.gz//?i_agree=1&download_now=1" | \
tar zx -C /opt
RUN npm install -gq bids-validator@1.5.3

# BIDS validator
#RUN npm install -gq bids-validator@1.5.3

# apt cleanup to recover as much space as possible
RUN apt-get remove -y libegl1-mesa-dev && \
apt-get autoremove -y && \
#RUN apt-get remove -y libegl1-mesa-dev && \
RUN apt-get autoremove -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Expand All @@ -95,30 +110,30 @@ RUN wget -q https://github.com/AlistairPerry/CCA/raw/master/parcellations/512inM
# rm -f oasis.zip
RUN wget -qO- http://www.nitrc.org/frs/download.php/5906/ADHD200_parcellations.tar.gz | \
tar zx -C /opt
RUN wget -q "https://s3-eu-west-1.amazonaws.com/pfigshare-u-files/5528816/lh.HCPMMP1.annot" \
-O /opt/freesurfer/subjects/fsaverage/label/lh.HCPMMP1.annot && \
wget -q "https://s3-eu-west-1.amazonaws.com/pfigshare-u-files/5528819/rh.HCPMMP1.annot" \
-O /opt/freesurfer/subjects/fsaverage/label/rh.HCPMMP1.annot
RUN mkdir /opt/brainnetome && \
( wget -q "http://ddl.escience.cn/f/IiyU?func=download&rid=8135438" -O /opt/freesurfer/average/rh.BN_Atlas.gcs || \
wget -q "https://osf.io/e6zkg/download" -O /opt/freesurfer/average/rh.BN_Atlas.gcs ) && \
( wget -q "http://ddl.escience.cn/f/IiyP?func=download&rid=8135433" -O /opt/freesurfer/average/lh.BN_Atlas.gcs || \
wget -q "https://osf.io/af9ut/download" -O /opt/freesurfer/average/lh.BN_Atlas.gcs ) && \
( wget -q "http://ddl.escience.cn/f/PC7Q?func=download&rid=9882718" -O /opt/freesurfer/average/BN_Atlas_subcortex.gca || \
wget -q "https://osf.io/k2cd8/download" -O /opt/freesurfer/average/BN_Atlas_subcortex.gca ) && \
( wget -q "http://ddl.escience.cn/f/PC7O?func=download&rid=9882716" -O /opt/brainnetome/BN_Atlas_246_LUT.txt || \
wget -q "https://osf.io/eb7pm/download" -O /opt/brainnetome/BN_Atlas_246_LUT.txt ) && \
( wget -q "http://ddl.escience.cn/f/Bvhg?func=download&rid=6516020" -O /opt/brainnetome/BNA_MPM_thr25_1.25mm.nii.gz || \
wget -q "https://osf.io/dbqep/download" -O /opt/brainnetome/BNA_MPM_thr25_1.25mm.nii.gz ) && \
cp /opt/brainnetome/BN_Atlas_246_LUT.txt /opt/freesurfer/
RUN wget -qO- "https://github.com/ThomasYeoLab/CBIG/archive/v0.11.1-Wu2017_RegistrationFusion.tar.gz" | \
tar zx -C /opt && \
cp /opt/CBIG-0.11.1-Wu2017_RegistrationFusion/stable_projects/brain_parcellation/Yeo2011_fcMRI_clustering/1000subjects_reference/Yeo_JNeurophysiol11_SplitLabels/fsaverage5/label/*h.Yeo2011_*Networks_N1000.split_components.annot /opt/freesurfer/subjects/fsaverage5/label/ && \
cp /opt/CBIG-0.11.1-Wu2017_RegistrationFusion/stable_projects/brain_parcellation/Yeo2011_fcMRI_clustering/1000subjects_reference/Yeo_JNeurophysiol11_SplitLabels/project_to_individual/Yeo2011_*networks_Split_Components_LUT.txt /opt/freesurfer/ && \
mkdir /opt/Yeo2011 && \
cp /opt/CBIG-0.11.1-Wu2017_RegistrationFusion/stable_projects/brain_parcellation/Yeo2011_fcMRI_clustering/1000subjects_reference/Yeo_JNeurophysiol11_SplitLabels/MNI152/Yeo2011_*Networks_N1000.split_components.FSL_MNI152_*mm.nii.gz /opt/Yeo2011/ && \
cp /opt/CBIG-0.11.1-Wu2017_RegistrationFusion/stable_projects/brain_parcellation/Yeo2011_fcMRI_clustering/1000subjects_reference/Yeo_JNeurophysiol11_SplitLabels/MNI152/*Networks_ColorLUT_freeview.txt /opt/Yeo2011/ && \
rm -rf /opt/CBIG-0.11.1-Wu2017_RegistrationFusion
#RUN wget -q "https://s3-eu-west-1.amazonaws.com/pfigshare-u-files/5528816/lh.HCPMMP1.annot" \
# -O /opt/freesurfer/subjects/fsaverage/label/lh.HCPMMP1.annot && \
# wget -q "https://s3-eu-west-1.amazonaws.com/pfigshare-u-files/5528819/rh.HCPMMP1.annot" \
# -O /opt/freesurfer/subjects/fsaverage/label/rh.HCPMMP1.annot
#RUN mkdir /opt/brainnetome && \
# ( wget -q "http://ddl.escience.cn/f/IiyU?func=download&rid=8135438" -O /opt/freesurfer/average/rh.BN_Atlas.gcs || \
# wget -q "https://osf.io/e6zkg/download" -O /opt/freesurfer/average/rh.BN_Atlas.gcs ) && \
# ( wget -q "http://ddl.escience.cn/f/IiyP?func=download&rid=8135433" -O /opt/freesurfer/average/lh.BN_Atlas.gcs || \
# wget -q "https://osf.io/af9ut/download" -O /opt/freesurfer/average/lh.BN_Atlas.gcs ) && \
# ( wget -q "http://ddl.escience.cn/f/PC7Q?func=download&rid=9882718" -O /opt/freesurfer/average/BN_Atlas_subcortex.gca || \
# wget -q "https://osf.io/k2cd8/download" -O /opt/freesurfer/average/BN_Atlas_subcortex.gca ) && \
# ( wget -q "http://ddl.escience.cn/f/PC7O?func=download&rid=9882716" -O /opt/brainnetome/BN_Atlas_246_LUT.txt || \
# wget -q "https://osf.io/eb7pm/download" -O /opt/brainnetome/BN_Atlas_246_LUT.txt ) && \
# ( wget -q "http://ddl.escience.cn/f/Bvhg?func=download&rid=6516020" -O /opt/brainnetome/BNA_MPM_thr25_1.25mm.nii.gz || \
# wget -q "https://osf.io/dbqep/download" -O /opt/brainnetome/BNA_MPM_thr25_1.25mm.nii.gz ) && \
# cp /opt/brainnetome/BN_Atlas_246_LUT.txt /opt/freesurfer/
#RUN wget -qO- "https://github.com/ThomasYeoLab/CBIG/archive/v0.11.1-Wu2017_RegistrationFusion.tar.gz" | \
# tar zx -C /opt && \
# cp /opt/CBIG-0.11.1-Wu2017_RegistrationFusion/stable_projects/brain_parcellation/Yeo2011_fcMRI_clustering/1000subjects_reference/Yeo_JNeurophysiol11_SplitLabels/fsaverage5/label/*h.Yeo2011_*Networks_N1000.split_components.annot /opt/freesurfer/subjects/fsaverage5/label/ && \
# cp /opt/CBIG-0.11.1-Wu2017_RegistrationFusion/stable_projects/brain_parcellation/Yeo2011_fcMRI_clustering/1000subjects_reference/Yeo_JNeurophysiol11_SplitLabels/project_to_individual/Yeo2011_*networks_Split_Components_LUT.txt /opt/freesurfer/ && \
# mkdir /opt/Yeo2011 && \
# cp /opt/CBIG-0.11.1-Wu2017_RegistrationFusion/stable_projects/brain_parcellation/Yeo2011_fcMRI_clustering/1000subjects_reference/Yeo_JNeurophysiol11_SplitLabels/MNI152/Yeo2011_*Networks_N1000.split_components.FSL_MNI152_*mm.nii.gz /opt/Yeo2011/ && \
# cp /opt/CBIG-0.11.1-Wu2017_RegistrationFusion/stable_projects/brain_parcellation/Yeo2011_fcMRI_clustering/1000subjects_reference/Yeo_JNeurophysiol11_SplitLabels/MNI152/*Networks_ColorLUT_freeview.txt /opt/Yeo2011/ && \
# rm -rf /opt/CBIG-0.11.1-Wu2017_RegistrationFusion

# Setup envvars
ENV ANTSPATH=/usr/lib/ants \
Expand Down Expand Up @@ -146,14 +161,45 @@ ENV ANTSPATH=/usr/lib/ants \

# MRtrix3 setup
# Commitish is 3.0.2 plus relevant hotfix
RUN git clone https://github.com/MRtrix3/mrtrix3.git /opt/mrtrix3 && \
cd /opt/mrtrix3 && \
git checkout 4ab54489f40997f7da1e1915c2adde3373cf6039 && \
python3 configure -nogui && \
python3 build -persistent -nopaginate && \
git describe --tags > /mrtrix3_version && \
rm -rf .git/ cmd/ core/ src/ testing/ tmp/ && \
cd /
#RUN git clone https://github.com/MRtrix3/mrtrix3.git /opt/mrtrix3 && \
# cd /opt/mrtrix3 && \
# git checkout dev && \
# python3 configure -nogui && \
# python3 build -persistent -nopaginate && \
# git describe --tags > /mrtrix3_version && \
# rm -rf .git/ cmd/ core/ src/ testing/ tmp/ && \
# cd /

FROM base-builder AS mrtrix3-builder

# Git commitish from which to build MRtrix3.
ARG MRTRIX3_GIT_COMMITISH="dev"
# Command-line arguments for `./configure`
ARG MRTRIX3_CONFIGURE_FLAGS=""
# Command-line arguments for `./build`
ARG MRTRIX3_BUILD_FLAGS="-persistent -nopaginate"

RUN apt-get -qq update \
&& apt-get install -yq --no-install-recommends \
libeigen3-dev \
libfftw3-dev \
libgl1-mesa-dev \
libpng-dev \
libqt5opengl5-dev \
libqt5svg5-dev \
libtiff5-dev \
qt5-default \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

# Clone, build, and install MRtrix3.
ARG MAKE_JOBS="1"
#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 \
&& rm -rf tmp

# Acquire extra MRtrix3 data
RUN wget -q "https://osf.io/v8n5g/download" -O /opt/mrtrix3/share/mrtrix3/labelconvert/Yeo2011_7N_split.txt && \
Expand Down
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,58 @@ normalisation.
**NOTE**: App is still under development; script is not guaranteed to be operational
for all use cases.

## Changes relative to the original (this is a fork)

We tried to adapt the code to incorporate synb0 processing, an approach described in:
https://www.sciencedirect.com/science/article/pii/S0730725X18306179

See also: https://github.com/BIDS-Apps/MRtrix3_connectome/issues/81

First, you need to run synb0 (e.g. using https://github.com/treanus/KUL_NeuroImaging_Tools/blob/master/KUL_synb0.sh).
This will use BIDS data is input, run synb0 with topup and store the relevant output in the BIDS derivatives as follows:

BIDS/derivatives/
└── synb0
├── sub-iz01
│   ├── ses-01
│   │   └── topup
│   │   ├── topup_fieldcoef.nii.gz
│   │   └── topup_movpar.txt
│   └── ses-02
│   └── topup
│   ├── topup_fieldcoef.nii.gz
│   └── topup_movpar.txt
├── sub-iz02
│   ├── ses-01
│   │   └── topup
│   │   ├── topup_fieldcoef.nii.gz
│   │   └── topup_movpar.txt
│   └── ses-02
│   └── topup
│   ├── topup_fieldcoef.nii.gz
│   └── topup_movpar.txt

The above is then used as input to the mrtrix3_connectome.py command.
An new option was created:
+ **--topup_preproc prefix**<br>Provide a prefix by which pre-processed topup image data may be found for the processed participant(s) / session(s)

Using 'mrtrix3_connectome.py bids_dir output_dir preproc [ options ] **-topup_preproc synb0**' means that the synb0 data in /BIDS/derivatives/synb0 will be used.

Internally this works since the dwifslpreproc command of MRtrix3 dev branch (3.1) has a new option '-topup_files'. See https://github.com/MRtrix3/mrtrix3/blob/dev/bin/dwifslpreproc

You thus need to have the dev branch of MRtrix3 installed:

git pull
git checkout dev
./configure
./build


Note:
For now this only works command line. There is no docker nor singularity container.



## Requirements

Due to use of the Anatomically-Constrained Tractography (ACT) framework, correction of
Expand Down
Loading