Skip to content

Commit 68296be

Browse files
committed
updates from internal repository
1 parent bd252fc commit 68296be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1474
-839
lines changed

.dockerignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,8 @@ migrated
567567
**/*.lprof
568568

569569
# Stuff only needed to run Docker
570-
base.Dockerfile
571-
Dockerfile
572-
docker-compose.yml
573-
docker-compose.override.yml
570+
dependencies/base.Dockerfile
571+
dependencies/Dockerfile
572+
dependencies/docker-compose.yml
573+
dependencies/docker-compose.override.yml
574574
run_docker.py

.github/workflows/dataset.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
with:
3838
# Include requirements.txt so that the caching works
3939
sparse-checkout: |
40-
requirements.txt
40+
dependencies/requirements.txt
4141
tutorials/website_example.py
4242
sparse-checkout-cone-mode: false
4343

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- name: Install dependencies
2525
run: |
26-
pip install -r requirements.txt
26+
pip install -r dependencies/requirements.txt
2727
pip install pytest pytest-xdist wheel
2828
2929
- name: Install htc

.gitlab-ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,30 @@ stages:
1212
build-docker:
1313
stage: build
1414
script:
15-
- docker compose -f docker-compose.yml -f gitlab_runner/docker-compose.yml build $BUILD_OPT
16-
- docker compose -f docker-compose.yml -f gitlab_runner/docker-compose.yml run --rm htc conda list --export
15+
- docker compose -f dependencies/docker-compose.yml -f gitlab_runner/docker-compose.yml build $BUILD_OPT
16+
- docker compose -f dependencies/docker-compose.yml -f gitlab_runner/docker-compose.yml run --rm htc conda list --export
1717

1818
code-checks:
1919
stage: test
2020
script:
2121
# We trigger the build process again before running the actual checks in case the code changed
2222
# This may happen if jobs from multiple branches run at the same time
2323
# If the code did not change, the build cache will be used
24-
- docker compose -f docker-compose.yml -f gitlab_runner/docker-compose.yml build
25-
- docker compose -f docker-compose.yml -f gitlab_runner/docker-compose.yml run --rm htc bash run_hooks.sh
24+
- docker compose -f dependencies/docker-compose.yml -f gitlab_runner/docker-compose.yml build
25+
- docker compose -f dependencies/docker-compose.yml -f gitlab_runner/docker-compose.yml run --rm htc bash run_hooks.sh
2626

2727
tests:
2828
stage: test
2929
script:
30-
- docker compose -f docker-compose.yml -f gitlab_runner/docker-compose.yml build
31-
- docker compose -f docker-compose.yml -f gitlab_runner/docker-compose.yml run --rm htc htc tests --parallel 4 $TEST_OPT
30+
- docker compose -f dependencies/docker-compose.yml -f gitlab_runner/docker-compose.yml build
31+
- docker compose -f dependencies/docker-compose.yml -f gitlab_runner/docker-compose.yml run --rm htc htc tests --parallel 4 $TEST_OPT
3232

3333
test-package:
3434
stage: test
3535
script:
36-
- docker compose -f docker-compose.yml -f gitlab_runner/docker-compose.yml build
36+
- docker compose -f dependencies/docker-compose.yml -f gitlab_runner/docker-compose.yml build
3737
- >
38-
docker compose -f docker-compose.yml -f gitlab_runner/docker-compose.yml run --rm htc bash -c '
38+
docker compose -f dependencies/docker-compose.yml -f gitlab_runner/docker-compose.yml run --rm htc bash -c '
3939
CIBW_BUILD="cp312-*"
4040
CIBW_TEST_COMMAND=""
4141
cibuildwheel --platform linux --output-dir dist &&
@@ -50,9 +50,9 @@ package:
5050
stage: deploy
5151
script:
5252
# cibuildwheel is configured via pyproject.toml
53-
- docker compose -f docker-compose.yml -f gitlab_runner/docker-compose.yml build
53+
- docker compose -f dependencies/docker-compose.yml -f gitlab_runner/docker-compose.yml build
5454
- >
55-
docker compose -f docker-compose.yml -f gitlab_runner/docker-compose.yml run --rm htc bash -c "
55+
docker compose -f dependencies/docker-compose.yml -f gitlab_runner/docker-compose.yml run --rm htc bash -c "
5656
pip install --upgrade cibuildwheel twine &&
5757
CIBW_ENVIRONMENT=CI_COMMIT_TAG=${CI_COMMIT_TAG}
5858
python -m cibuildwheel --platform linux --output-dir dist &&

.pre-commit-config.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.8.6
3+
rev: v0.9.3
44
hooks:
55
- id: ruff
66
args: [--fix]
77
- id: ruff-format
8+
- repo: https://github.com/pre-commit/mirrors-clang-format
9+
rev: v19.1.7
10+
hooks:
11+
- id: clang-format
12+
types_or: [c++, c, cuda]
813
# Avoid potential problems with py.test if __init__.py files are missing
914
- repo: https://github.com/lk16/detect-missing-init
1015
rev: v0.1.6

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ authors:
1010
doi: 10.5281/zenodo.6577614
1111
repository-code: "https://github.com/IMSY-DKFZ/htc"
1212
license: MIT
13-
version: v0.0.18
14-
date-released: "2025-01-06"
13+
version: v0.0.19
14+
date-released: "2025-02-01"

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ If you use the `htc` framework, please consider citing the [corresponding papers
3939
author = {Sellner, Jan and Seidlitz, Silvia},
4040
publisher = {Zenodo},
4141
url = {https://github.com/IMSY-DKFZ/htc},
42-
date = {2025-01-06},
42+
date = {2025-02-01},
4343
doi = {10.5281/zenodo.6577614},
4444
title = {Hyperspectral Tissue Classification},
45-
version = {v0.0.18},
45+
version = {v0.0.19},
4646
}
4747
```
4848

@@ -58,7 +58,7 @@ This package can be installed via pip:
5858
pip install imsy-htc
5959
```
6060

61-
This installs all the required dependencies defined in [`requirements.txt`](./requirements.txt). The requirements include [PyTorch](https://pytorch.org/), so you may want to install it manually before installing the package in case you have specific needs (e.g. CUDA version).
61+
This installs all the required dependencies defined in [`requirements.txt`](./dependencies/requirements.txt). The requirements include [PyTorch](https://pytorch.org/), so you may want to install it manually before installing the package in case you have specific needs (e.g. CUDA version).
6262

6363
> ⚠️ This framework was developed and tested using the Ubuntu 20.04+ Linux distribution. Despite we do provide wheels for Windows and macOS as well, they are not tested.
6464
@@ -82,6 +82,7 @@ We cannot provide wheels for all PyTorch versions. Hence, a version of `imsy-htc
8282
| 0.0.16 | 2.4 |
8383
| 0.0.17 | 2.5 |
8484
| 0.0.18 | 2.5 |
85+
| 0.0.19 | 2.6 |
8586

8687
However, we do not make explicit version constraints in the dependencies of the `imsy-htc` package because a future version of PyTorch may still work and we don't want to break the installation if it is not necessary.
8788

@@ -105,7 +106,7 @@ or by adding the following lines to your `requirements.txt`
105106
imsy-htc[extra]
106107
```
107108

108-
This installs the optional dependencies defined in [`requirements-extra.txt`](./requirements-extra.txt), including for example our Python wrapper for the [challengeR toolkit](https://github.com/wiesenfa/challengeR).
109+
This installs the optional dependencies defined in [`requirements-extra.txt`](./dependencies/requirements-extra.txt), including for example our Python wrapper for the [challengeR toolkit](https://github.com/wiesenfa/challengeR).
109110

110111
</details>
111112

@@ -129,7 +130,7 @@ export PATH_Tivita_HeiPorSPECTRAL="/path/to/the/dataset"
129130
python run_docker.py bash
130131
```
131132

132-
You can now run any commands you like. All datasets you provided via an environment variable that starts with `PATH_Tivita` will be accessible in your container (you can also check the generated `docker-compose.override.yml` file for details). Please note that the Docker container is meant for small testing only and not for development. This is also reflected by the fact that per default all results are stored inside the container and hence will also be deleted after exiting the container. If you want to keep your results, let the environment variable `PATH_HTC_DOCKER_RESULTS` point to the directory where you want to store the results.
133+
You can now run any commands you like. All datasets you provided via an environment variable that starts with `PATH_Tivita` will be accessible in your container (you can also check the generated `dependencies/docker-compose.override.yml` file for details). Please note that the Docker container is meant for small testing only and not for development. This is also reflected by the fact that per default all results are stored inside the container and hence will also be deleted after exiting the container. If you want to keep your results, let the environment variable `PATH_HTC_DOCKER_RESULTS` point to the directory where you want to store the results.
133134

134135
</details>
135136

@@ -144,7 +145,7 @@ conda create --yes --name htc python=3.12
144145
conda activate htc
145146

146147
# Install the htc package and its requirements
147-
pip install -r requirements-dev.txt
148+
pip install -r dependencies/requirements-dev.txt
148149
pip install --no-use-pep517 -e .
149150
```
150151

Dockerfile renamed to dependencies/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ RUN apt install -y libmagickwand-dev \
2121
&& pip install Wand \
2222
&& sed -i '/disable ghostscript format types/,+6d' /etc/ImageMagick-6/policy.xml
2323

24+
# Install chromium for kaleido, as it is explicitly required now
25+
RUN apt update && apt install -y chromium-browser
26+
2427
# Install and cache the static code checks
2528
# We need a git repo for pre-commit to work but we don't want to copy the main repo to the Docker container as it unnecessarily slows down the build process
2629
# Instead, we create a new empty git repo and make sure that files are staged before the hooks run (because pre-commit does not consider unstaged files)
@@ -33,4 +36,4 @@ RUN git init \
3336
COPY . /home/src
3437
RUN pip install --no-use-pep517 -e /home/src
3538

36-
ENTRYPOINT ["python", "docker_startup.py"]
39+
ENTRYPOINT ["python", "dependencies/docker_startup.py"]

dependencies/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Dependencies
2+
3+
This folder contains all dependency files to get the htc project running.
4+
5+
The `requirements*.txt` list all the Python dependencies and are installed automatically if you followed the installation instructions. Despite the general dependencies (`requirements.txt`, 'requirements-extra.txt' and 'requirements-dev.txt') there may also be additional project-dependent dependencies which are not installed automatically but which may be required to run the project (and hence need to be installed manually.).
6+
7+
The Docker files define how to run the htc project in an isolated Docker container. From a user perspective, it is usually enough to run `htc docker bash` to get an isolated container (with mounted read-only results folder and datasets). The Docker files are mainly used for testing.

base.Dockerfile renamed to dependencies/base.Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ ENV PATH="/opt/conda/bin:${PATH}"
2121

2222
RUN curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh \
2323
&& bash Miniforge3-Linux-x86_64.sh -b -p "/opt/conda" \
24+
&& conda update -y --all \
25+
&& conda install -y python=3.12 \
2426
&& rm -f Miniforge3-Linux-x86_64.sh
2527

2628
# Cache common pretrained models
2729
RUN curl -L https://github.com/lukemelas/EfficientNet-PyTorch/releases/download/1.0/efficientnet-b5-b6417697.pth --create-dirs -o /root/.cache/torch/hub/checkpoints/efficientnet-b5-b6417697.pth
2830

2931
# Install all requirements separately so that this step can be cached
30-
COPY requirements.txt /requirements.txt
31-
COPY requirements-extra.txt /requirements-extra.txt
32-
COPY requirements-dev.txt /requirements-dev.txt
32+
COPY dependencies/requirements.txt /requirements.txt
33+
COPY dependencies/requirements-extra.txt /requirements-extra.txt
34+
COPY dependencies/requirements-dev.txt /requirements-dev.txt
3335
RUN python -m pip install -U pip \
3436
&& pip install -r /requirements-dev.txt
3537

docker-compose.yml renamed to dependencies/docker-compose.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
services:
22
htc-base:
33
build:
4-
context: .
5-
dockerfile: base.Dockerfile
4+
context: ..
5+
dockerfile: dependencies/base.Dockerfile
66
image: htc-base
77
htc:
8-
build: .
8+
build:
9+
context: ..
10+
dockerfile: dependencies/Dockerfile
911
depends_on:
1012
- htc-base
1113
image: htc
File renamed without changes.
File renamed without changes.

requirements-extra.txt renamed to dependencies/requirements-extra.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
-r requirements.txt
2-
matplotlib-venn
32
pynrrd
43
pypdf
54
ipywidgets
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--index-url https://read_package:[email protected]/api/v4/projects/90/packages/pypi/simple
2+
susi
File renamed without changes.

htc/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
"utils.LabelMapping": ["LabelMapping"],
124124
"utils.LDA": ["LDA"],
125125
"utils.MeasureTime": ["MeasureTime"],
126+
"utils.mitk.mitk_masks": ["nrrd_mask", "segmentation_to_nrrd"],
126127
"utils.MultiPath": ["MultiPath"],
127128
"utils.parallel": ["p_map"],
128129
"utils.SpectrometerReader": ["SpectrometerReader"],
@@ -253,6 +254,7 @@
253254
from htc.utils.LabelMapping import LabelMapping
254255
from htc.utils.LDA import LDA
255256
from htc.utils.MeasureTime import MeasureTime
257+
from htc.utils.mitk.mitk_masks import nrrd_mask, segmentation_to_nrrd
256258
from htc.utils.MultiPath import MultiPath
257259
from htc.utils.parallel import p_map
258260
from htc.utils.SpectrometerReader import SpectrometerReader

htc/cluster/UpdateCluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def update_container_files(self) -> str:
7676

7777
# Build docker and apptainer container
7878
self.run_command(
79-
command="docker build --tag htc-base --file base.Dockerfile .",
79+
command="docker build --tag htc-base --file dependencies/base.Dockerfile .",
8080
task="building the htc-base container",
8181
)
8282
self.run_command(

0 commit comments

Comments
 (0)