8000 ENH: Add naive isotropic smoothing by effigies · Pull Request #104 · poldracklab/fitlins · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ENH: Add naive isotropic smoothing #104

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

Merged
merged 5 commits into from
Feb 4, 2019
Merged
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
1 change: 1 addition & 0 deletions .neurodocker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"pkg_manager": "apt", "instructions": [["base", "neurodebian@sha256:5fbbad8c68525b588a459092254094436aae9dc1f3920f8d871a03053b10377c"], ["label", {"maintainer": "Christopher J. Markiewicz"}], ["env", {"MKL_NUM_THREADS": "1", "OMP_NUM_THREADS": "1"}], ["fsl", {"version": "5.0.11"}], ["user", "neuro"], ["miniconda", {"create_env": "neuro", "conda_install": ["python=3.6", "icu=58.1", "mkl=2018.0.1", "mkl-service", "git=2.9.3"]}], ["miniconda", {"use_env": "neuro", "conda_install": ["numpy=1.16.1", "scipy=1.2.0", "scikit-learn=0.19.1", "matplotlib=3.0.2", "seaborn=0.9.0", "pytables=3.4.4", "pandas=0.24.1", "patsy", "traits"]}], ["copy", [".", "/src/fitlins"]], ["user", "root"], ["arg", {"VERSION": ""}], ["run", "echo \"$VERSION\" > /src/fitlins/fitlins/VERSION"], ["run", "mkdir /work && chown -R neuro /src /work && chmod a+w /work"], ["user", "neuro"], ["miniconda", {"use_env": "neuro", "pip_opts": "-r", "pip_install": ["/src/fitlins/requirements.txt"]}], ["miniconda", {"use_env": "neuro", "pip_opts": "-e", "pip_install": ["/src/fitlins[all]"], "activate": true}], ["workdir", "/work"], ["entrypoint", "/neurodocker/startup.sh fitlins"], ["arg", {"BUILD_DATE": "", "VCS_REF": ""}], ["label", {"org.label-schema.build-date": "$BUILD_DATE", "org.label-schema.name": "FitLins", "org.label-schema.description": "FitLins - Fit Linear Models to BIDS datasets", "org.label-schema.url": "http://github.com/poldracklab/fitlins", "org.label-schema.vcs-ref": "$VCS_REF", "org.label-schema.vcs-url": "https://github.com/poldracklab/fitlins", "org.label-schema.version": "$VERSION", "org.label-schema.schema-version": "1.0"}]]}
240 changes: 144 additions & 96 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,88 +1,117 @@
# Generated by Neurodocker v0.3.2.
#
# Generated by Neurodocker version 0.4.3-6-g12a2b6f
# Timestamp: 2019-02-04 19:47:24 UTC
#
# Thank you for using Neurodocker. If you discover any issues
# or ways to improve this software, please submit an issue or
# pull request on our GitHub repository:
#
# https://github.com/kaczmarj/neurodocker
#
# Timestamp: 2018-05-23 00:49:26

FROM neurodebian@sha256:5fbbad8c68525b588a459092254094436aae9dc1f3920f8d871a03053b10377c

ARG DEBIAN_FRONTEND=noninteractive
ARG DEBIAN_FRONTEND="noninteractive"

#----------------------------------------------------------
# Install common dependencies and create default entrypoint
#----------------------------------------------------------
ENV LANG="en_US.UTF-8" \
LC_ALL="C.UTF-8" \
LC_ALL="en_US.UTF-8" \
ND_ENTRYPOINT="/neurodocker/startup.sh"
RUN apt-get update -qq && apt-get install -yq --no-install-recommends \
apt-utils bzip2 ca-certificates curl locales unzip \
RUN export ND_ENTRYPOINT="/neurodocker/startup.sh" \
&& apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
apt-utils \
bzip2 \
ca-certificates \
curl \
locales \
unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& localedef --force --inputfile=en_US --charmap=UTF-8 C.UTF-8 \
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
&& dpkg-reconfigure --frontend=noninteractive locales \
&& update-locale LANG="en_US.UTF-8" \
&& chmod 777 /opt && chmod a+s /opt \
&& mkdir -p /neurodocker \
&& if [ ! -f "$ND_ENTRYPOINT" ]; then \
echo '#!/usr/bin/env bash' >> $ND_ENTRYPOINT \
&& echo 'set +x' >> $ND_ENTRYPOINT \
&& echo 'if [ -z "$*" ]; then /usr/bin/env bash; else $*; fi' >> $ND_ENTRYPOINT; \
fi \
echo '#!/usr/bin/env bash' >> "$ND_ENTRYPOINT" \
&& echo 'set -e' >> "$ND_ENTRYPOINT" \
&& echo 'if [ -n "$1" ]; then "$@"; else /usr/bin/env bash; fi' >> "$ND_ENTRYPOINT"; \
fi \
&& chmod -R 777 /neurodocker && chmod a+s /neurodocker

ENTRYPOINT ["/neurodocker/startup.sh"]

LABEL maintainer="Christopher J. Markiewicz"

ARG PYTHON_VERSION_MAJOR="3"
ARG PYTHON_VERSION_MINOR="6"

ENV MKL_NUM_THREADS="1" \
OMP_NUM_THREADS="1"

# Create new user: neuro
RUN useradd --no-user-group --create-home --shell /bin/bash neuro
ENV FSLDIR="/opt/fsl-5.0.11" \
PATH="/opt/fsl-5.0.11/bin:$PATH"
RUN apt-get update -qq \
&& apt-get install -y -q --no-install-recommends \
bc \
dc \
file \
libfontconfig1 \
libfreetype6 \
libgl1-mesa-dev \
libglu1-mesa-dev \
libgomp1 \
libice6 \
libxcursor1 \
libxft2 \
libxinerama1 \
libxrandr2 \
libxrender1 \
libxt6 \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& echo "Downloading FSL ..." \
&& mkdir -p /opt/fsl-5.0.11 \
&& curl -fsSL --retry 5 https://fsl.fmrib.ox.ac.uk/fsldownloads/fsl-5.0.11-centos6_64.tar.gz \
| tar -xz -C /opt/fsl-5.0.11 --strip-components 1 \
&& sed -i '$iecho Some packages in this Docker container are non-free' $ND_ENTRYPOINT \
&& sed -i '$iecho If you are considering commercial use of this container, please consult the relevant license:' $ND_ENTRYPOINT \
&& sed -i '$iecho https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/Licence' $ND_ENTRYPOINT \
&& sed -i '$isource $FSLDIR/etc/fslconf/fsl.sh' $ND_ENTRYPOINT \
&& echo "Installing FSL conda environment ..." \
&& bash /opt/fsl-5.0.11/etc/fslconf/fslpython_install.sh -f /opt/fsl-5.0.11

RUN test "$(getent passwd neuro)" || useradd --no-user-group --create-home --shell /bin/bash neuro
USER neuro

#------------------
# 8000 Install Miniconda
#------------------
ENV CONDA_DIR=/opt/conda \
PATH=/opt/conda/bin:$PATH
RUN echo "Downloading Miniconda installer ..." \
&& miniconda_installer=/tmp/miniconda.sh \
&& curl -sSL --retry 5 -o $miniconda_installer https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& /bin/bash $miniconda_installer -b -p $CONDA_DIR \
&& rm -f $miniconda_installer \
ENV CONDA_DIR="/opt/miniconda-latest" \
PATH="/opt/miniconda-latest/bin:$PATH"
RUN export PATH="/opt/miniconda-latest/bin:$PATH" \
&& echo "Downloading Miniconda installer ..." \
&& conda_installer="/tmp/miniconda.sh" \
&& curl -fsSL --retry 5 -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& bash "$conda_installer" -b -p /opt/miniconda-latest \
&& rm -f "$conda_installer" \
&& conda update -yq -nbase conda \
&& conda config --system --prepend channels conda-forge \
&& conda config --system --set auto_update_conda false \
&& conda config --system --set show_channel_urls true \
&& conda update -n base conda \
&& conda clean -tipsy && sync

#-------------------------
# Create conda environment
#-------------------------
RUN conda create -y -q --name neuro python=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} \
icu=58.1 \
mkl=2018.0.1 \
mkl-service \
git=2.9.3 \
&& sync && conda clean -tipsy && sync \
&& sed -i '$isource activate neuro' $ND_ENTRYPOINT
&& conda create -y -q --name neuro \
&& conda install -y -q --name neuro \
'python=3.6' \
'icu=58.1' \
'mkl=2018.0.1' \
'mkl-service' \
'git=2.9.3' \
&& sync && conda clean -tipsy && sync

#-------------------------
# Update conda environment
#-------------------------
RUN conda install -y -q --name neuro numpy=1.14.1 \
scipy=1.0.0 \
scikit-learn=0.19.1 \
matplotlib=2.1.2 \
seaborn=0.8.1 \
pytables=3.4.2 \
pandas=0.22.0 \
nipype=1.1.1 \
patsy \
RUN conda install -y -q --name neuro \
'numpy=1.16.1' \
'scipy=1.2.0' \
'scikit-learn=0.19.1' \
'matplotlib=3.0.2' \
'seaborn=0.9.0' \
'pytables=3.4.4' \
'pandas=0.24.1' \
'patsy' \
'traits' \
&& sync && conda clean -tipsy && sync

COPY [".", "/src/fitlins"]
Expand All @@ -91,28 +120,24 @@ USER root

ARG VERSION

# User-defined instruction
RUN echo "$VERSION" > /src/fitlins/fitlins/VERSION

# User-defined instruction
RUN mkdir /work && chown -R neuro /src /work
RUN mkdir /work && chown -R neuro /src /work && chmod a+w /work

USER neuro

#-------------------------
# Update conda environment
#-------------------------
RUN /bin/bash -c "source activate neuro \
&& pip install --no-cache-dir --upgrade pip \
&& pip install -q --no-cache-dir --upgrade -r /src/fitlins/requirements.txt" \
RUN bash -c "source activate neuro \
&& pip install --no-cache-dir -r \
'/src/fitlins/requirements.txt'" \
&& rm -rf ~/.cache/pip/* \
&& sync

#-------------------------
# Update conda environment
#-------------------------
RUN /bin/bash -c "source activate neuro \
&& pip install -q --no-cache-dir -e /src/fitlins[all]" \
&& sync
RUN bash -c "source activate neuro \
&& pip install --no-cache-dir -e \
'/src/fitlins[all]'" \
&& rm -rf ~/.cache/pip/* \
&& sync \
&& sed -i '$isource activate neuro' $ND_ENTRYPOINT

WORKDIR /work

Expand All @@ -130,12 +155,8 @@ LABEL org.label-schema.build-date="$BUILD_DATE" \
org.label-schema.version="$VERSION" \
org.label-schema.schema-version="1.0"

#--------------------------------------
# Save container specifications to JSON
#--------------------------------------
RUN echo '{ \
\n "pkg_manager": "apt", \
\n "check_urls": false, \
\n "instructions": [ \
\n [ \
\n "base", \
Expand All @@ -148,20 +169,16 @@ RUN echo '{ \
\n } \
\n ], \
\n [ \
\n "arg", \
\n "env", \
\n { \
\n "PYTHON_VERSION_MAJOR": "3", \
\n "PYTHON_VERSION_MINOR": "6", \
\n "BUILD_DATE": "", \
\n "VCS_REF": "", \
\n "VERSION": "" \
\n "MKL_NUM_THREADS": "1", \
\n "OMP_NUM_THREADS": "1" \
\n } \
\n ], \
\n [ \
\n "env", \
\n "fsl", \
\n { \
\n "MKL_NUM_THREADS": "1", \
\n "OMP_NUM_THREADS": "1" \
\n "version": "5.0.11" \
\n } \
\n ], \
\n [ \
Expand All @@ -171,16 +188,31 @@ RUN echo '{ \
\n [ \
\n "miniconda", \
\n { \
\n "env_name": "neuro", \
\n "activate": true, \
\n "conda_install": "python=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} icu=58.1 mkl=2018.0.1 mkl-service git=2.9.3" \
\n "create_env": "neuro", \
\n "conda_install": [ \
\n "python=3.6", \
\n "icu=58.1", \
\n "mkl=2018.0.1", \
\n "mkl-service", \
\n "git=2.9.3" \
\n ] \
\n } \
\n ], \
\n [ \
\n "miniconda", \
\n { \
\n "env_name": "neuro", \
\n "conda_install": "numpy=1.14.1 scipy=1.0.0 scikit-learn=0.19.1 matplotlib=2.1.2 seaborn=0.8.1 pytables=3.4.2 pandas=0.22.0 nipype=1.0.3 patsy" \
\n "use_env": "neuro", \
\n "conda_install": [ \
\n "numpy=1.16.1", \
\n "scipy=1.2.0", \
\n "scikit-learn=0.19.1", \
\n "matplotlib=3.0.2", \
\n "seaborn=0.9.0", \
\n "pytables=3.4.4", \
\n "pandas=0.24.1", \
\n "patsy", \
\n "traits" \
\n ] \
\n } \
\n ], \
\n [ \
Expand All @@ -195,12 +227,18 @@ RUN echo '{ \
\n "root" \
\n ], \
\n [ \
\n "arg", \
\n { \
\n "VERSION": "" \
\n } \
\n ], \
\n [ \
\n "run", \
\n "echo \"$VERSION\" > /src/fitlins/fitlins/VERSION" \
\n ], \
\n [ \
\n "run", 9E88 \
\n "mkdir /work && chown -R neuro /src /work" \
\n "mkdir /work && chown -R neuro /src /work && chmod a+w /work" \
\n ], \
\n [ \
\n "user", \
Expand All @@ -209,17 +247,22 @@ RUN echo '{ \
\n [ \
\n "miniconda", \
\n { \
\n "env_name": "neuro", \
\n "use_env": "neuro", \
\n "pip_opts": "-r", \
\n "pip_install": "/src/fitlins/requirements.txt" \
\n "pip_install": [ \
\n "/src/fitlins/requirements.txt" \
\n ] \
\n } \
\n ], \
\n [ \
\n "miniconda", \
\n { \
\n "env_name": "neuro", \
\n "use_env": "neuro", \
\n "pip_opts": "-e", \
\n "pip_install": "/src/fitlins[all]" \
\n "pip_install": [ \
\n "/src/fitlins[all]" \
\n ], \
\n "activate": true \
\n } \
\n ], \
\n [ \
Expand All @@ -231,6 +274,13 @@ RUN echo '{ \
\n "/neurodocker/startup.sh fitlins" \
\n ], \
\n [ \
\n "arg", \
\n { \
\n "BUILD_DATE": "", \
\n "VCS_REF": "" \
\n } \
\n ], \
\n [ \
\n "label", \
\n { \
\n "org.label-schema.build-date": "$BUILD_DATE", \
Expand All @@ -243,7 +293,5 @@ RUN echo '{ \
\n "org.label-schema.schema-version": "1.0" \
\n } \
\n ] \
\n ], \
\n "generation_timestamp": "2018-05-23 00:49:26", \
\n "neurodocker_version": "0.3.2" \
\n ] \
\n}' > /neurodocker/neurodocker_specs.json
9 changes: 8 additions & 1 deletion fitlins/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ def get_parser():
g_bids.add_argument('--desc-label', action='store', default='preproc',
help="use BOLD files with the provided description label")

g_prep = parser.add_argument_group('Options for preprocessing BOLD series')
g_prep.add_argument('-s', '--smoothing', action='store', metavar="TYPE:FWHM",
help="Smooth BOLD series with FWHM mm kernel prior to fitting. "
"Valid types: iso (isotropic); "
"e.g. `--smothing iso:5` will use an isotropic 5mm FWHM kernel")

g_perfm = parser.add_argument_group('Options to handle performance')
g_perfm.add_argument('--n-cpus', action='store', default=0, type=int,
help='maximum number of threads across all processes')
Expand Down Expand Up @@ -168,7 +174,8 @@ def run_fitlins(argv=None):
desc=opts.desc_label,
model=model,
participants=subject_list, base_dir=work_dir,
include_pattern=opts.include, exclude_pattern=opts.exclude
include_pattern=opts.include, exclude_pattern=opts.exclude,
smoothing=opts.smoothing,
)

retcode = 0
Expand Down
Loading
0