Skip to content

Commit

Permalink
Merge pull request #7 from tsalo/draft-contents
Browse files Browse the repository at this point in the history
Copy over ICA-AROMA workflow from fMRIPrep 23.0.2
  • Loading branch information
tsalo authored Mar 4, 2024
2 parents ea84eba + 0d67273 commit 244cd72
Show file tree
Hide file tree
Showing 36 changed files with 3,806 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[codespell]
skip = .git,*.pdf,*.svg,*.html,dataset_description.json,*.bib
# te - TE
# Weill - name
# reson - Reson. abbreviation in citation
ignore-words-list = te,weill,reson
14 changes: 14 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# python cache
__pycache__/**/*
__pycache__
*.pyc

# python distribution
build/**/*
build
dist/**/*
dist
fmripost_aroma.egg-info/**/*
fmripost_aroma.egg-info
.eggs/**/*
.eggs
Empty file added .git-blame-ignore-revs
Empty file.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git_archival.txt export-subst
Empty file added .gitmodules
Empty file.
3 changes: 3 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Christopher J. Markiewicz <[email protected]>
Christopher J. Markiewicz <[email protected]> <[email protected]>
Christopher J. Markiewicz <[email protected]> <[email protected]>
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
exclude: ".*/data/.*"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
files: ^fmriprep/|^wrapper/
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
files: ^fmriprep/|^wrapper/
19 changes: 19 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.10"
jobs:
post_checkout:
- git fetch --unshallow

sphinx:
configuration: docs/conf.py

python:
install:
- method: pip
path: .
extra_requirements:
- doc
4 changes: 4 additions & 0 deletions .versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"flagged": {
}
}
38 changes: 38 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"title": "fMRIPost-AROMA: a robust preprocessing pipeline for functional MRI",
"description": "<p>fMRIPost-AROMA is a robust and easy-to-use pipeline for running ICA-AROMA on preprocessed fMRI data organized in BIDS format.</p>",
"creators": [
{
"affiliation": "Department of Psychology, Stanford University",
"name": "Markiewicz, Christopher J.",
"orcid": "0000-0002-6533-164X"
},
{
"affiliation": "Department of Psychology, Florida International University",
"name": "Salo, Taylor",
"orcid": "0000-0001-9813-3167"
}
],
"keywords": [
"neuroimaging",
"workflow",
"pipeline",
"preprocessing",
"fMRI",
"BIDS"
],
"license": "Apache-2.0",
"related_identifiers": [
{
"identifier": "https://fmripost_aroma.org",
"relation": "documents",
"scheme": "url"
},
{
"identifier": "10.1038/s41592-018-0235-4",
"relation": "isPartOf",
"scheme": "doi"
}
],
"upload_type": "software"
}
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
23.0.0 ()
=========

fMRIPost-AROMA's initial release.
4 changes: 4 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# fMRIPost-AROMA Code of Conduct

*fMRIPost-AROMA* is a project of the
[*NiPreps* Community, and is under its code of conduct](https://www.nipreps.org/community/CODE_OF_CONDUCT/).
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Contributing to *fMRIPost-AROMA*

*fMRIPost-AROMA* is a project of the
[*NiPreps* Community, which specifies the contributing guidelines](https://www.nipreps.org/community/).
234 changes: 234 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
# fMRIPost-AROMA Docker Container Image distribution
#
# MIT License
#
# Copyright (c) 2023 The NiPreps Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

FROM python:slim AS src
RUN pip install build
RUN apt-get update && \
apt-get install -y --no-install-recommends git
COPY . /src/fmripost_aroma
RUN python -m build /src/fmripost_aroma

# Use Ubuntu 22.04 LTS
FROM ubuntu:jammy-20221130

# Prepare environment
RUN apt-get update && \
apt-get install -y --no-install-recommends \
apt-utils \
autoconf \
build-essential \
bzip2 \
ca-certificates \
curl \
git \
gnupg \
libtool \
lsb-release \
netbase \
pkg-config \
unzip \
xvfb && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV DEBIAN_FRONTEND="noninteractive" \
LANG="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"

# FSL 6.0.5.1
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
bc \
dc \
file \
libfontconfig1 \
libfreetype6 \
libgl1-mesa-dev \
libgl1-mesa-dri \
libglu1-mesa-dev \
libgomp1 \
libice6 \
libxcursor1 \
libxft2 \
libxinerama1 \
libxrandr2 \
libxrender1 \
libxt6 \
sudo \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& echo "Downloading FSL ..." \
&& mkdir -p /opt/fsl-6.0.5.1 \
&& curl -fsSL --retry 5 https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-6.0.5.1-centos7_64.tar.gz \
| tar -xz -C /opt/fsl-6.0.5.1 --strip-components 1 \
--exclude "fsl/config" \
--exclude "fsl/data/atlases" \
--exclude "fsl/data/first" \
--exclude "fsl/data/mist" \
--exclude "fsl/data/possum" \
--exclude "fsl/data/standard/bianca" \
--exclude "fsl/data/standard/tissuepriors" \
--exclude "fsl/doc" \
--exclude "fsl/etc/default_flobs.flobs" \
--exclude "fsl/etc/fslconf" \
--exclude "fsl/etc/js" \
--exclude "fsl/etc/luts" \
--exclude "fsl/etc/matlab" \
--exclude "fsl/extras" \
--exclude "fsl/include" \
--exclude "fsl/python" \
--exclude "fsl/refdoc" \
--exclude "fsl/src" \
--exclude "fsl/tcl" \
--exclude "fsl/bin/FSLeyes" \
&& find /opt/fsl-6.0.5.1/bin -type f -not \( \
-name "applywarp" -or \
-name "bet" -or \
-name "bet2" -or \
-name "convert_xfm" -or \
-name "fast" -or \
-name "flirt" -or \
-name "fsl_regfilt" -or \
-name "fslhd" -or \
-name "fslinfo" -or \
-name "fslmaths" -or \
-name "fslmerge" -or \
-name "fslroi" -or \
-name "fslsplit" -or \
-name "fslstats" -or \
-name "imtest" -or \
-name "mcflirt" -or \
-name "melodic" -or \
-name "prelude" -or \
-name "remove_ext" -or \
-name "susan" -or \
-name "topup" -or \
-name "zeropad" \) -delete \
&& find /opt/fsl-6.0.5.1/data/standard -type f -not -name "MNI152_T1_2mm_brain.nii.gz" -delete
ENV FSLDIR="/opt/fsl-6.0.5.1" \
PATH="/opt/fsl-6.0.5.1/bin:$PATH" \
FSLOUTPUTTYPE="NIFTI_GZ" \
FSLMULTIFILEQUIT="TRUE" \
FSLLOCKDIR="" \
FSLMACHINELIST="" \
FSLREMOTECALL="" \
FSLGECUDAQ="cuda.q" \
LD_LIBRARY_PATH="/opt/fsl-6.0.5.1/lib:$LD_LIBRARY_PATH"

# Configure PPA for libpng12
RUN GNUPGHOME=/tmp gpg --keyserver hkps://keyserver.ubuntu.com --no-default-keyring --keyring /usr/share/keyrings/linuxuprising.gpg --recv 0xEA8CACC073C3DB2A \
&& echo "deb [signed-by=/usr/share/keyrings/linuxuprising.gpg] https://ppa.launchpadcontent.net/linuxuprising/libpng12/ubuntu jammy main" > /etc/apt/sources.list.d/linuxuprising.list

# Installing and setting up ICA_AROMA
WORKDIR /opt/ICA-AROMA
RUN curl -sSL "https://github.com/oesteban/ICA-AROMA/archive/v0.4.5.tar.gz" \
| tar -xzC /opt/ICA-AROMA --strip-components 1 && \
chmod +x /opt/ICA-AROMA/ICA_AROMA.py
ENV PATH="/opt/ICA-AROMA:$PATH" \
AROMA_VERSION="0.4.5"

WORKDIR /opt
RUN curl -sSLO https://www.humanconnectome.org/storage/app/media/workbench/workbench-linux64-v1.5.0.zip && \
unzip workbench-linux64-v1.5.0.zip && \
rm workbench-linux64-v1.5.0.zip && \
rm -rf /opt/workbench/libs_linux64_software_opengl /opt/workbench/plugins_linux64 && \
strip --remove-section=.note.ABI-tag /opt/workbench/libs_linux64/libQt5Core.so.5
# ABI tags can interfere when running on Singularity

ENV PATH="/opt/workbench/bin_linux64:$PATH" \
LD_LIBRARY_PATH="/opt/workbench/lib_linux64:$LD_LIBRARY_PATH"

# nipreps/miniconda:py39_4.12.0rc0
COPY --from=nipreps/miniconda@sha256:5aa4d2bb46e7e56fccf6e93ab3ff765add74e79f96ffa00449504b4869790cb9 /opt/conda /opt/conda

RUN ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc

# Set CPATH for packages relying on compiled libs (e.g. indexed_gzip)
ENV PATH="/opt/conda/bin:$PATH" \
CPATH="/opt/conda/include:$CPATH" \
LD_LIBRARY_PATH="/opt/conda/lib:$LD_LIBRARY_PATH" \
LANG="C.UTF-8" \
LC_ALL="C.UTF-8" \
PYTHONNOUSERSITE=1

RUN conda install -y -n base \
-c anaconda \
-c conda-forge \
convert3d=1.3.0 \
&& sync \
&& conda clean -afy; sync \
&& rm -rf ~/.conda ~/.cache/pip/*; sync \
&& ldconfig

# Unless otherwise specified each process should only use one thread - nipype
# will handle parallelization
ENV MKL_NUM_THREADS=1 \
OMP_NUM_THREADS=1

# Create a shared $HOME directory
RUN useradd -m -s /bin/bash -G users fmripost_aroma
WORKDIR /home/fmripost_aroma
ENV HOME="/home/fmripost_aroma" \
LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH"

RUN echo ". /opt/conda/etc/profile.d/conda.sh" >> $HOME/.bashrc && \
echo "conda activate base" >> $HOME/.bashrc

RUN /opt/conda/bin/python -m pip install --no-cache-dir --upgrade templateflow

# Precaching atlases
COPY scripts/fetch_templates.py fetch_templates.py

RUN /opt/conda/bin/python fetch_templates.py && \
rm fetch_templates.py && \
find $HOME/.cache/templateflow -type d -exec chmod go=u {} + && \
find $HOME/.cache/templateflow -type f -exec chmod go=u {} +

# Installing fMRIPost-AROMA
COPY --from=src /src/fmripost_aroma/dist/*.whl .
RUN /opt/conda/bin/python -m pip install --no-cache-dir $( ls *.whl )[all]

RUN find $HOME -type d -exec chmod go=u {} + && \
find $HOME -type f -exec chmod go=u {} + && \
rm -rf $HOME/.npm $HOME/.conda $HOME/.empty

ENV IS_DOCKER_8395080871=1

RUN ldconfig
WORKDIR /tmp
ENTRYPOINT ["/opt/conda/bin/fmripost_aroma"]

ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="fMRIPost-AROMA" \
org.label-schema.description="fMRIPost-AROMA - robust fMRI preprocessing tool" \
org.label-schema.url="http://fmripost_aroma.org" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/nipreps/fmripost_aroma" \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0"
Loading

0 comments on commit 244cd72

Please sign in to comment.