diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..15340eef --- /dev/null +++ b/.codespellrc @@ -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 diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 20b600fe..57937f5a 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -1,4 +1,4 @@ -name: Style check +name: Style + spelling check on: push: @@ -11,30 +11,27 @@ defaults: run: shell: bash +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + permissions: contents: read jobs: - build: - if: "!contains(github.event.head_commit.message, '[skip ci]')" + style: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: pipx run ruff check . + - run: pipx run ruff format --diff . + + codespell: + name: Check for spelling errors runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.11'] steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 # Only fetch the latest commit - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install black isort - - name: black code formatting check - run: | - black --check nibabies/ - - name: isort formatting check - run: isort nibabies/ --check-only + - name: Checkout + uses: actions/checkout@v4 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/.maint/contributors.json b/.maint/contributors.json index 2a7199d5..1c6fbb31 100644 --- a/.maint/contributors.json +++ b/.maint/contributors.json @@ -1,4 +1,9 @@ [ + { + "affiliation": "Department of Pediatrics, University of Minnesota, MN, USA", + "name": "Madison, Thomas", + "orcid": "0000-0003-3030-6580" + }, { "affiliation": "Montreal Neurological Institute, McGill University", "name": "Huberty, Scott", diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4cd27cd7..816907f2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,18 @@ +exclude: ".*/data/.*" repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 + - 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: 22.3.0 + - id: trailing-whitespace + exclude: '.*\.svg' + - id: end-of-file-fixer + exclude: '.*\.svg' + - id: check-yaml + - id: check-json + - id: check-toml + - id: check-added-large-files + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.2.0 hooks: - - id: black - files: ^nibabies/ -- repo: https://github.com/pycqa/isort - rev: 5.10.1 - hooks: - - id: isort - files: ^nibabies/ + - id: ruff + - id: ruff-format diff --git a/.readthedocs.yml b/.readthedocs.yml index be478304..a85becf3 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -3,7 +3,7 @@ version: 2 build: os: ubuntu-22.04 tools: - python: "3.10" + python: "3.11" jobs: post_checkout: - git fetch --unshallow @@ -15,3 +15,5 @@ python: path: . extra_requirements: - doc + - method: pip + path: wrapper/ diff --git a/CHANGES.md b/CHANGES.md index fea3d867..b668d1fc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -36,9 +36,9 @@ Previous, *NiBabies* expected input from the `--derivatives` flag to be in T1w s * DKR: Add M-CRIB-S to Docker container (#283) * DKR: Update dependencies, split into multi-stage build * ENH: Add option to exclude projecting high variance voxels to surface (#278) - * ENH: Resample morphometrics to fsLR CIFTI-2 files when outputing CIFTIs (#279) + * ENH: Resample morphometrics to fsLR CIFTI-2 files when outputting CIFTIs (#279) * ENH: Add MCRIBReconAll as alternative surface reconstruction method (#283) - * ENH: Reorder anatomical processsing, run ANTs DenoiseImage on anatomicals (#286) + * ENH: Reorder anatomical processing, run ANTs DenoiseImage on anatomicals (#286) * ENH: Extract participant ages from BIDS sources, deprecate `--age-months` (#287) * ENH: Dilate BOLD mask by 2 voxels to prevent over-aggressive masking degrading T2star map estimation (#296) * ENH: Allow precomputed derivatives in T1w or T2w space (#305) diff --git a/Dockerfile b/Dockerfile index fe818678..a49088a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,15 +23,15 @@ # SOFTWARE. # Ubuntu 22.04 LTS - Jammy -ARG BASE_IMAGE=ubuntu:jammy-20230605 +ARG BASE_IMAGE=ubuntu:jammy-20240405 # NiBabies wheel FROM python:slim AS src RUN pip install build RUN apt-get update && \ apt-get install -y --no-install-recommends git -COPY . /src/nibabies -RUN python -m build /src/nibabies +COPY . /src +RUN python -m build /src # Older Python to support legacy MCRIBS FROM python:3.6.15-slim as pyenv @@ -90,19 +90,26 @@ RUN mkdir /opt/workbench && \ # Micromamba FROM downloader as micromamba + +# Install a C compiler to build extensions when needed. +# traits<6.4 wheels are not available for Python 3.11+, but build easily. +RUN apt-get update && \ + apt-get install -y --no-install-recommends build-essential && \ + apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + WORKDIR / # Bump the date to current to force update micromamba -RUN echo "2023.06.29" -RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba +RUN echo "2024.04.25" && curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba ENV MAMBA_ROOT_PREFIX="/opt/conda" COPY env.yml /tmp/env.yml +COPY requirements.txt /tmp/requirements.txt +WORKDIR /tmp RUN micromamba create -y -f /tmp/env.yml && \ micromamba clean -y -a + ENV PATH="/opt/conda/envs/nibabies/bin:$PATH" -RUN /opt/conda/envs/nibabies/bin/npm install -g svgo@^2.8 bids-validator@1.11.0 && \ +RUN npm install -g svgo@^3.2.0 bids-validator@^1.14.0 && \ rm -r ~/.npm -COPY requirements.txt /tmp/requirements.txt -RUN /opt/conda/envs/nibabies/bin/pip install --no-cache-dir -r /tmp/requirements.txt # Main container FROM ${BASE_IMAGE} as nibabies @@ -207,7 +214,7 @@ ENV PERL5LIB="$MINC_LIB_DIR/perl5/5.8.5" \ PATH="$FREESURFER_HOME/bin:$FREESURFER_HOME/tktools:$MINC_BIN_DIR:$PATH" # MCRIBS (required legacy python) -COPY --from=nipreps/mcribs@sha256:6c7a8dedd61d0ead8c7c4a57ab158928c1c1d787d87dae33ab7ee43226fb1e0f /opt/MCRIBS/ /opt/MCRIBS +COPY --from=nipreps/mcribs@sha256:d5ea7616402cbc0b80f32634832dce540a32bb1d5e1e61dfdd2cc795dba8944a /opt/MCRIBS/ /opt/MCRIBS COPY --from=pyenv /usr/local/lib/ /usr/local/lib/ ENV PATH="/opt/MCRIBS/bin:/opt/MCRIBS/MIRTK/MIRTK-install/bin:/opt/MCRIBS/MIRTK/MIRTK-install/lib/tools:${PATH}" \ LD_LIBRARY_PATH="/opt/MCRIBS/lib:/opt/MCRIBS/ITK/ITK-install/lib:/opt/MCRIBS/VTK/VTK-install/lib:/opt/MCRIBS/MIRTK/MIRTK-install/lib:/usr/local/lib:${LD_LIBRARY_PATH}" \ @@ -257,7 +264,7 @@ RUN ${CONDA_PYTHON} -m pip install --no-cache-dir --upgrade templateflow && \ find $HOME/.cache/templateflow -type f -exec chmod go=u {} + # Install pre-built wheel -COPY --from=src /src/nibabies/dist/*.whl . +COPY --from=src /src/dist/*.whl . RUN ${CONDA_PYTHON} -m pip install --no-cache-dir $( ls *.whl )[telemetry,test] # Facilitate Apptainer use diff --git a/docs/community.md b/docs/community.md index f009a713..6bfb5eb4 100644 --- a/docs/community.md +++ b/docs/community.md @@ -1,6 +1,6 @@ ## NiPreps Community -Check out the [official NiPreps community page](https://www.nipreps.org/community/), where topics such as contributing, code of coduct, and licensing are outlined. +Check out the [official NiPreps community page](https://www.nipreps.org/community/), where topics such as contributing, code of conduct, and licensing are outlined. ## NiBabies Coding Style diff --git a/docs/outputs.md b/docs/outputs.md index bdf7a6c1..6c35605e 100644 --- a/docs/outputs.md +++ b/docs/outputs.md @@ -1,3 +1,772 @@ -# Outputs +.. include:: links.rst -Refer to [*fMRIPrep* outputs](https://fmriprep.org/en/latest/outputs.html) +.. _outputs: + +--------------------- +Outputs of *NiBabies* +--------------------- +*NiBabies* outputs conform to the :abbr:`BIDS (brain imaging data structure)` +Derivatives specification (see `BIDS Derivatives`_, along with the +upcoming `BEP 011`_ and `BEP 012`_). +*NiBabies* generates three broad classes of outcomes: + +1. **Visual QA (quality assessment) reports**: + one :abbr:`HTML (hypertext markup language)` per subject, + that allows the user a thorough visual assessment of the quality + of processing and ensures the transparency of *NiBabies* operations. + +2. **Derivatives (preprocessed data)** the input fMRI data ready for + analysis, i.e., after the various preparation procedures + have been applied. + For example, :abbr:`INU (intensity non-uniformity)`-corrected versions + of the T1-weighted image (per subject), the brain mask, + or :abbr:`BOLD (blood-oxygen level dependent)` + images after head-motion correction, slice-timing correction and aligned into + the same-subject's T1w space or in some standard space. + +3. **Confounds**: this is a special family of derivatives that can be utilized + to inform subsequent denoising steps. + + .. warning:: + These modules are still in alpha and require additional testing. + + .. important:: + In order to remain agnostic to any possible subsequent analysis, + *NiBabies* does not perform any denoising (e.g., spatial smoothing) itself. + There are exceptions to this principle (described in its corresponding + section below): + + - CompCor regressors, which are calculated after temporal high-pass filtering. + +Layout +------ +Assuming NiBabies is invoked with:: + + NiBabies / / participant [OPTIONS] + +The outputs will be a `BIDS Derivatives`_ dataset of the form:: + + / + logs/ + sub-