Skip to content
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
Empty file removed .codespellignore
Empty file.
74 changes: 74 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Python Build Artifacts
.Python
**/__pycache__/
**/*.py[cod]
**/build/
**/develop-eggs/
**/dist/
**/downloads/
**/eggs/
**/.eggs/
**/lib/
**/lib64/
**/parts/
**/sdist/
**/var/
**/wheels/
**/*.egg-info/
**/.installed.cfg
**/*.egg
**/MANIFEST

# Test & Coverage Files
.pytest_cache/
.ruff_cache/
.tox/
.nox/
coverage.xml
.coverage
.coverage.*
htmlcov/
junit-results.xml
tests/

# Version Control
.git/
.gitignore
.gitattributes
.github/

# Editor / IDE Files
.ipynb_checkpoints
.idea/
.vscode/
*.swp
*.swo
*~

# Virtual Environments
venv/
.venv/
env/
.env/

# Docker Files
.dockerignore
docker
docker/Dockerfile

# Singularity files
singularity
*sif

# Local Config Files
.env
*.env.*
*.pem
*.key

# OS files
.DS_Store
Thumbs.db

# Documentation
howto*
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
name: ${{ matrix.os }} - py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
defaults:
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Python 3.10
- name: Setup Python 3.13
uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.13'
architecture: 'x64'
- name: Install dependencies
run: |
Expand All @@ -28,8 +28,3 @@ jobs:
run: ruff check .
- name: Run codespell
uses: codespell-project/actions-codespell@master
with:
check_filenames: true
check_hidden: true
skip: './.git,./build,./.mypy_cache,./.pytest_cache'
ignore_words_file: ./.codespellignore
4 changes: 2 additions & 2 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
uses: actions/checkout@v6
with:
path: ./main
- name: Setup Python 3.10
- name: Setup Python 3.13
uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.13'
architecture: 'x64'
- name: Install package
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Python 3.10
- name: Setup Python 3.13
uses: actions/setup-python@v6
with:
python-version: '3.10'
python-version: '3.13'
architecture: 'x64'
- name: Install dependencies
run: |
Expand Down
28 changes: 17 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
#
misc
deprecated
testing
# tests
tests
.pytest_cache/
.ruff_cache/
junit-results.xml
coverage.xml

# macOS
# OS files
.DS_Store
Thumbs.db

#
.flake8
# documentation
howto*

# images
*sif

#
.ipynb_checkpoints
Expand All @@ -22,19 +28,19 @@ __pycache__/

# Distribution / packaging
.Python
.installed.cfg
build/
develop-eggs/
dist/
downloads/
develop-eggs/
eggs/
.eggs/
*.egg-info/
*.egg
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ ___
- At least one structural MR image that was processed with Freesurfer 6.0, 7.x,
or FastSurfer 1.1 or later (including the surface pipeline).

- A Python version >= 3.8 is required to run this script.
- A Python version >= 3.10 is required to run this script.

- Required packages include (among others) the nibabel and skimage package for
the core functionality, plus the matplotlib, pandas, and transform3d
Expand Down
10 changes: 6 additions & 4 deletions docker/Docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ The docker image will be based on Ubuntu, contain the fsqc scripts, the lapy and

## Build fsqc Docker image

To build the docker image, execute the following command after traversing into the *docker* directory of this repository:
To build the docker image, first download the software from its GitHub repository at `https://github.com/Deep-MI/fsqc`, or clone it directly via `git clone https://github.com/Deep-MI/fsqc`.

Next, execute the following **docker** command from the project's main directory, i.e. `fsqc` (not `fsqc/fsqc`):

```bash
docker build --rm -t deepmi/fsqcdocker -f Dockerfile .
docker build --rm -t deepmi/fsqcdocker -f docker/Dockerfile .
```
The name of the image will be `deepmi/fsqcdocker`, and it will be built from the `Dockerfile` configuration file from the *docker* directory. You have some flexibility in choosing the name, so this is just an example.
The name of the image will be `deepmi/fsqcdocker`, and it will be built from the `Dockerfile` configuration file from the *docker* directory. You have some flexibility in choosing the name, so this is just an example. Note that the `fsqc` directory will be the *build context* for creating the docker image; if you do not want to include any particular files or directories into the image, add them to the `.dockerignore` file.

The `--rm` flag will remove intermediate containers after a successful build; `-t` specifies the name of the image, and `-f` indicates the configuration file from which to build.

Take a look at the contents of the [`Dockerfile`](Dockerfile) to see what is done during the build process: essentially, it is getting the Ubuntu 22.04 image, installing additional packages from the distribution, downloading the fsqc toolbox, and setting the necessary environment variables. Unless the `Dockerfile` changes, the build process has to be done only once.
Take a look at the contents of the [`Dockerfile`](Dockerfile) to see what is done during the build process: essentially, it is getting the Python3.11 image, installing additional packages, copying and installing the fsqc toolbox, and setting the necessary environment variables. Unless the `Dockerfile` changes, the build process has to be done only once.

## Download the Docker image

Expand Down
66 changes: 39 additions & 27 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,45 +1,57 @@
# get OS
FROM ubuntu:22.04

# update OS
RUN apt-get update
FROM python:3.11

# get additional packages
RUN apt-get install -y --no-install-recommends \
gcc \
git \
RUN apt-get update && apt-get install -y --no-install-recommends \
time \
zlib1g-dev \
libjpeg-dev \
python3 \
python3-dev \
python3-pip \
python3-setuptools \
python3-wheel \
libxcb-xinerama0 \
xvfb \
libopengl0 \
libegl1-mesa

# clone fsqc
RUN git clone https://github.com/Deep-MI/fsqc.git /app/fsqc
libegl1 \
libgl1 \
libfontconfig1 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# upgrade pip
RUN pip3 install --upgrade pip
RUN pip install --upgrade pip

#
RUN mkdir -p /app/fsqc

# install additional python packages (not necessary if using pip install)
RUN pip3 install -r /app/fsqc/requirements.txt
#
COPY pyproject.toml /app/fsqc
COPY setup.py /app/fsqc
COPY requirements.txt /app/fsqc
COPY DESCRIPTION.md /app/fsqc
COPY LICENSE /app/fsqc
COPY VERSION /app/fsqc
COPY fsqc /app/fsqc/fsqc
COPY run_fsqc /app/fsqc

# install fsqc as a package
RUN pip install /app/fsqc

# Add other environment variables
ENV OMP_NUM_THREADS=1
ENV MPLCONFIGDIR=/tmp/mplconfigdir

# Set the working directory to /app
WORKDIR /app
# Suppress Mesa's shader-cache warning ("Failed to create //.cache …") that
# appears when running as a non-standard user inside Docker where $HOME is
# unset or points to a non-writable directory.
ENV MESA_SHADER_CACHE_DISABLE=1

# In order to find NVIDIA GPUs (--gpus all)
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=all

# Set entrypoint (non-interactive mode)
ENTRYPOINT ["python3", "/app/fsqc/run_fsqc"]
# Register the NVIDIA EGL ICD so libEGL finds the GPU driver
RUN mkdir -p /usr/share/glvnd/egl_vendor.d && \
echo '{"file_format_version":"1.0.0","ICD":{"library_path":"libEGL_nvidia.so.0"}}' \
> /usr/share/glvnd/egl_vendor.d/10_nvidia.json

## Run app when the container launches (interactive mode)
#CMD ["/bin/bash"]
# Set the working directory to /app
WORKDIR /app

# Set entrypoint
ENTRYPOINT ["run_fsqc"]
2 changes: 1 addition & 1 deletion fsqc/createScreenshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def computeLayout(n):

lut = np.concatenate((lut, lutAdd), axis=0)

lutEnum = dict(zip(lut[:, 0], range(len(lut[:, 0]))))
lutEnum = dict(zip(lut[:, 0], range(len(lut[:, 0])), strict=True))

lutTab = np.array(lut[:, (2, 3, 4, 5)] / 255, dtype="float32")
lutTab[:, 3] = 1
Expand Down
3 changes: 1 addition & 2 deletions fsqc/createSurfacePlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ def createSurfacePlots(SUBJECT, SUBJECTS_DIR, SURFACES_OUTDIR, VIEWS, FASTSURFER

import os

from whippersnappy import snap1
from whippersnappy.utils.types import ViewType
from whippersnappy import ViewType, snap1

# -----------------------------------------------------------------------------
# import surfaces and overlays
Expand Down
14 changes: 9 additions & 5 deletions fsqc/fsqcMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def get_help(print_help=True, return_help=False):
At least one subject whose structural MR image was processed with Freesurfer
6.0 or later, or FastSurfer v1.1 or later (including the surface pipeline).

A Python version >= 3.8 is required to run this script.
A Python version >= 3.10 is required to run this script.

Required packages include (among others) the nibabel and skimage package for
the core functionality, plus the the matplotlib, pandas, and transform3d
Expand Down Expand Up @@ -2438,7 +2438,8 @@ def _do_fsqc(argsDict):
"fornixShapeEV{:0>3}".format,
range(FORNIX_N_EIGEN),
),
fornixShapeOutput,
fornixShapeOutput,
strict=True,
)
)
}
Expand All @@ -2455,7 +2456,8 @@ def _do_fsqc(argsDict):
"fornixShapeEV{:0>3}".format,
range(FORNIX_N_EIGEN),
),
np.full(FORNIX_N_EIGEN, np.nan),
np.full(FORNIX_N_EIGEN, np.nan),
strict=True,
)
)
}
Expand Down Expand Up @@ -2486,7 +2488,8 @@ def _do_fsqc(argsDict):
"fornixShapeEV{:0>3}".format,
range(FORNIX_N_EIGEN),
),
fornixShapeOutput,
fornixShapeOutput,
strict=True,
)
)
}
Expand Down Expand Up @@ -2899,7 +2902,8 @@ def _do_fsqc(argsDict):
map(
"fornixShapeEV{:0>3}".format, range(FORNIX_N_EIGEN)
),
fornixShapeOutput,
fornixShapeOutput,
strict=True,
)
)
}
Expand Down
Loading