-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 29beebc
Showing
32 changed files
with
1,430 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# ignoring this might speed up build | ||
# by preventing passing extra content to the docker daemon | ||
|
||
.simg | ||
|
||
tests/data | ||
|
||
env | ||
|
||
tmp | ||
|
||
docs/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[flake8] | ||
count = True | ||
show-source = True | ||
statistics = True | ||
max_function_length = 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
* annex.backend=MD5E | ||
**/.git* annex.largefiles=nothing | ||
CHANGELOG.md annex.largefiles=nothing | ||
README.md annex.largefiles=nothing | ||
pyproject.toml annex.largefiles=nothing | ||
.readthedocs.yml annex.largefiles=nothing | ||
.github/**/*.yml annex.largefiles=nothing | ||
*.def annex.largefiles=nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
# Documentation | ||
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
schedule: | ||
interval: monthly | ||
|
||
- package-ecosystem: gitsubmodule | ||
directory: / | ||
schedule: | ||
interval: monthly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
--- | ||
name: docker build | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
USER_NAME: bids | ||
REPO_NAME: cat12 | ||
IMAGE: /home/runner/work/Remi-Gau/cat12-container/docker | ||
|
||
jobs: | ||
|
||
docker-build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
# # cache tarred docker image to speed up build on follow up runs | ||
# - uses: actions/cache@v4 | ||
# id: cache | ||
# with: | ||
# path: ${{ env.IMAGE }}/image.tar | ||
# key: data | ||
# - if: ${{ steps.cache.outputs.cache-hit != 'true' }} | ||
# name: Load image | ||
# run: docker load -i ${{ env.IMAGE }}/image.tar | ||
- name: Build the Docker image | ||
run: | | ||
docker build . --tag ${{env.USER_NAME}}/${{env.REPO_NAME}} | ||
- name: Check image size and version | ||
run: | | ||
docker images | ||
docker run --rm ${{env.USER_NAME}}/${{env.REPO_NAME}} --version | ||
- name: Run simple commands | ||
run: | | ||
docker run --rm ${{env.USER_NAME}}/${{env.REPO_NAME}} --help | ||
docker run --rm ${{env.USER_NAME}}/${{env.REPO_NAME}} . /foo participant view segment --verbose 3 | ||
docker run --rm ${{env.USER_NAME}}/${{env.REPO_NAME}} . /foo participant copy segment --verbose 3 | ||
docker run --rm ${{env.USER_NAME}}/${{env.REPO_NAME}} . /foo participant segment --help | ||
- name: Save docker image | ||
run: | | ||
mkdir -p ${{ env.IMAGE }} | ||
docker save "${{env.USER_NAME}}/${{env.REPO_NAME}}" > "${{ env.IMAGE }}/image.tar" | ||
- name: Upload docker artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: docker | ||
path: ${{ env.IMAGE }} | ||
|
||
one-session: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
type: [default, simple, enigma] | ||
fail-fast: false | ||
needs: docker-build | ||
steps: | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get -y -qq update | ||
sudo apt-get -y install tree | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Restore docker image | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: docker | ||
path: ${{ env.IMAGE }} | ||
- name: Load image | ||
run: docker load -i ${{ env.IMAGE }}/image.tar | ||
- name: Get data | ||
run: make tests/data/MoAEpilot | ||
- name: Segment | ||
run: | | ||
docker run --rm \ | ||
-v ${PWD}/tests/data/MoAEpilot:/data \ | ||
${{env.USER_NAME}}/${{env.REPO_NAME}} \ | ||
/data /data/derivatives participant \ | ||
segment --verbose 3 --type ${{ matrix.type }} | ||
tree ${PWD}/tests/data/ | ||
- name: Upload output artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: output_${{ matrix.type }} | ||
path: /home/runner/work/cat12-container/cat12-container/tests/data/MoAEpilot/derivatives | ||
|
||
two-sessions: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
type: [long_0, long_2] | ||
fail-fast: false | ||
needs: docker-build | ||
steps: | ||
- name: Install python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get -y -qq update | ||
sudo apt-get -y install git-annex tree | ||
pip install datalad | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Restore docker image | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: docker | ||
path: ${{ env.IMAGE }} | ||
- name: Load image | ||
run: docker load -i ${{ env.IMAGE }}/image.tar | ||
- name: Get data | ||
run: make data_ds002799 | ||
- name: Segment | ||
run: | | ||
docker run --rm \ | ||
-v ${PWD}/tests/data/ds002799:/data \ | ||
${{env.USER_NAME}}/${{env.REPO_NAME}} \ | ||
/data /data/derivatives participant \ | ||
segment --verbose 3 --type ${{ matrix.type }} \ | ||
--participant_label 292 294 \ | ||
--skip_validation | ||
tree ${PWD}/tests/data/ | ||
- name: Upload output artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: output_${{ matrix.type }} | ||
path: /home/runner/work/cat12-container/cat12-container/tests/data/ds002799/derivatives |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.simg | ||
|
||
tests/data | ||
|
||
env | ||
|
||
tmp | ||
|
||
docs/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: check-json | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-case-conflict | ||
- id: check-merge-conflict | ||
- id: mixed-line-ending | ||
|
||
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt | ||
rev: 0.2.3 | ||
hooks: | ||
- id: yamlfmt | ||
args: [--mapping, '4', --sequence, '4', --offset, '0'] | ||
|
||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.3.0 | ||
hooks: | ||
- id: codespell | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
args: [--line-length, '79', --profile, black] | ||
|
||
- repo: https://github.com/psf/black-pre-commit-mirror | ||
rev: 24.8.0 | ||
hooks: | ||
- id: black | ||
args: [--line-length, '79'] | ||
|
||
- repo: https://github.com/pycqa/flake8 | ||
rev: 7.1.1 | ||
hooks: | ||
- id: flake8 | ||
args: [--config, .flake8, --verbose] | ||
additional_dependencies: [flake8-docstrings, flake8-use-fstring, flake8-functions, flake8-bugbear] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
# .readthedocs.yml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: '3.12' | ||
|
||
# Build documentation in the docs/ directory with Sphinx | ||
sphinx: | ||
configuration: docs/source/conf.py | ||
builder: html | ||
fail_on_warning: false | ||
|
||
# Optionally set the version of Python and requirements required to build your docs | ||
python: | ||
install: | ||
- method: pip | ||
path: . | ||
extra_requirements: | ||
- docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
<!-- | ||
### Added | ||
### Changed | ||
### Deprecated | ||
### Removed | ||
### Fixed | ||
### Security | ||
--> | ||
|
||
## [Unreleased] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
FROM ubuntu:22.04@sha256:340d9b015b194dc6e2a13938944e0d016e57b9679963fdeb9ce021daac430221 | ||
|
||
LABEL org.opencontainers.image.authors="[email protected], Malgorzata Wierzba ([email protected]), Felix Hoffstaedter ([email protected]), Remi Gau ([email protected])" | ||
LABEL org.opencontainers.image.source="https://gin.g-node.org/felixh/cat12-container" | ||
LABEL org.opencontainers.image.version="v1.1dev" | ||
LABEL org.opencontainers.image.licenses="MIT" | ||
LABEL org.opencontainers.image.title="cat12-container" | ||
|
||
ENV LANG="en_US.UTF-8" \ | ||
LC_ALL="en_US.UTF-8" \ | ||
FORCE_SPMMCR="1" \ | ||
SPM_HTML_BROWSER="0" \ | ||
MCR_INHIBIT_CTF_LOCK="1" \ | ||
MCR_VERSION="2017b" | ||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu:/opt/MCR-${MCR_VERSION}/v93/runtime/glnxa64:/opt/MCR-${MCR_VERSION}/v93/bin/glnxa64:/opt/MCR-${MCR_VERSION}/v93/sys/os/glnxa64:/opt/MCR-${MCR_VERSION}/v93/extern/bin/glnxa64" \ | ||
MATLABCMD="/opt/MCR-${MCR_VERSION}/v93/toolbox/matlab" \ | ||
XAPPLRESDIR="/opt//opt/MCR-${MCR_VERSION}/v93/x11/app-defaults" \ | ||
MCRROOT="/opt/MCR-${MCR_VERSION}/v93" \ | ||
CAT_VERSION=".8.1_r2042_R${MCR_VERSION}" \ | ||
DENO_INSTALL="/root/.deno" | ||
ENV SPMROOT="/opt/CAT12${CAT_VERSION}" \ | ||
PATH="$DENO_INSTALL/bin:/opt/CAT12${CAT_VERSION}:$PATH" \ | ||
STANDALONE="/opt/CAT12${CAT_VERSION}/standalone" | ||
|
||
RUN export ND_ENTRYPOINT="/neurodocker/startup.sh" \ | ||
&& apt-get update -qq \ | ||
&& apt-get install -y -q --no-install-recommends \ | ||
apt-utils \ | ||
bc \ | ||
bzip2 \ | ||
ca-certificates \ | ||
curl \ | ||
dbus-x11 \ | ||
libncurses5 \ | ||
libxext6 \ | ||
libxmu6 \ | ||
libxpm-dev \ | ||
libxt6 \ | ||
locales \ | ||
openjdk-8-jre \ | ||
python3 \ | ||
pip \ | ||
unzip \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& 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 | ||
|
||
RUN echo "Downloading MATLAB Compiler Runtime ..." \ | ||
&& export TMPDIR="$(mktemp -d)" \ | ||
&& curl -o "$TMPDIR/mcr.zip" https://ssd.mathworks.com/supportfiles/downloads/R${MCR_VERSION}/deployment_files/R${MCR_VERSION}/installers/glnxa64/MCR_R${MCR_VERSION}_glnxa64_installer.zip \ | ||
&& unzip -q "$TMPDIR/mcr.zip" -d "$TMPDIR/mcrtmp" \ | ||
&& "$TMPDIR/mcrtmp/install" -destinationFolder /opt/MCR-${MCR_VERSION} -mode silent -agreeToLicense yes \ | ||
&& rm -rf "$TMPDIR" \ | ||
&& unset TMPDIR | ||
|
||
RUN echo "Downloading standalone CAT12 ..." \ | ||
&& curl -fL -o /tmp/cat12.zip http://www.neuro.uni-jena.de/cat12/CAT12${CAT_VERSION}_MCR_Linux.zip \ | ||
&& unzip -q /tmp/cat12.zip -d /tmp \ | ||
&& rm -rf /tmp/cat12.zip \ | ||
&& mkdir -p /opt/CAT12${CAT_VERSION} \ | ||
&& mv /tmp/*${CAT_VERSION}*/* /opt/CAT12${CAT_VERSION}/ \ | ||
&& chmod -R 777 /opt/CAT12${CAT_VERSION} \ | ||
# Test | ||
&& /opt/CAT12${CAT_VERSION}/spm12 function exit | ||
|
||
## Install BIDS validator | ||
RUN curl -fsSL https://deno.land/install.sh | sh && \ | ||
deno install -Agf -n bids-validator jsr:@bids/[email protected] | ||
|
||
# transfer code and set permission | ||
RUN mkdir -p /code | ||
COPY ./code/requirements.txt /code | ||
RUN pip install -r /code/requirements.txt | ||
|
||
COPY ./code /code | ||
RUN ls /code && find /code -type f -print0 | xargs -0 chmod +r | ||
|
||
# modify enigma script to output content to path defined by an env variable | ||
RUN sed -i -e "s/cat_version/getenv('OUTPUT_DIR')/g" /opt/CAT12${CAT_VERSION}/standalone/cat_standalone_segment_enigma.m | ||
|
||
WORKDIR ${STANDALONE} | ||
|
||
ENTRYPOINT ["python3", "/code/main.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Małgorzata Wierzba, Felix Hoffstaedter, Michael Hanke | ||
|
||
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. |
Oops, something went wrong.