Skip to content

Commit a8925d4

Browse files
authored
Refactor for 0.2.0 (#1)
* Add environment.yml * Update CMakeLists.txt * Clean up build script * Add `libopengl-devel` dependency * Fix build * Clean up tests, fix linking * Clean up `egl.Context` binding * Drop `carna.py` * Update settings.json * Clean up `base.Spatial` and `base.Node` * Implement `SpatialView` and add memory tests * Add `Node.test__attach_child__circular` * Add `Node.test__attach_child__nonfree` * Add `Node.test__movable` * Add `Node.test__tag` * Add `Node.test__localTransform` * Add `Node.test__detach_from_parent` * Add `CARNA_EXRA_CHECKS` environment variable * Add `Camera` tests * Add `Geometry` tests (incomplete) * Add `Geometry.test__geometry_type` and `Geometry.test__features_count` * Clean up code * Add `Material` and tests * Fix typo * Add `Geometry.put_feature` and `Geometry.remove_feature` * Add `Geometry.clear_features` * Add `Geometry.has_feature` * Clean up code * Add `ContextView` * Pin `pybind11 <3` * Refactor structure * Add `Surface` (no tests yet) * Add `FrameRenderer` and tests * Clean up test/test_egl.py * Add `configure_carna_log` * Add `math` * Add `MeshFactory` * Add `OpaqueRenderingStage` * Add `CarnaRenderingTestCase` * Make build directory readonly in VSCode * Fix `Surface::end` * Fix tests * Add `helpers.FrameRendererHelper` * Add `FrameRenderer.append_stage` * Remove extra checks (not working properly across submodules) * Add convenience layer * Add `renderer` convenience function * Extend spatial convenience functions * Add RTD setup * Add sphinx build to build script * Fix doc building * Update docs * Make `carna.renderer` a class instead of a function * Update docs * Update integration test * Add `frustum` method to convenience renderer * Update docs * Update docs * Update docs * Rename `configure_carna_log` to `logging` * Add `VolumeGridHelperBase` * Add `VolumeGridHelper_IntensityVolumeUInt16` * Add `VolumeGridHelper_IntensityVolumeUInt16.intensities_role` * Add `VolumeGridHelper_IntensityVolumeUInt16_NormalMap3DInt8` * Add `VolumeGridHelper_IntensityVolumeUInt8` * Add `VolumeGridHelper_IntensityVolumeUInt8_NormalMap3DInt8` * Add `VolumeGridHelper_*.create_node` * Add `MaskRenderingStage` (test fail) * Add failing `EGLContext` test case * Fix bug in `EGLContext` d'tor (tests pass) * Add `Color` and tests * Add `MaskRenderingStage` attributes, methods, and tests * Add docs * Add `volume` convenience function * Add debug build mode * Fix bug with lazy data loading behaviour of `VolumeGridHelper` https://kostrykin.github.io/Carna/html/classCarna_1_1base_1_1ManagedTexture3D.html#a37f03f311b2d1bd87ccb12f545d70f04 * Update docs * Update docs * Add logo to docs * Add `renderer.animation` * Use `solid` shaders instead of `unshaded` for example materials * Fix `animation.render` to produce smooth animations * Fix docs * Add `MIPStage` and `MIPLayer` * Fix bug in `EGLContext` (enable resource sharing) * Add `CuttingPlanesStage` * Add script to install Carna development version * Fix install_carna_dev.bash * Employ `.carna-dev` in CMakeLists.txt * Add `ColorMapView` * Fix install_carna_dev.bash * Add `MIPStage.color_map` * Update test results * Add `color_map_helper` and fix tests * Update build instructions * Add `carna.base.AssertionFailure` * Migrate to `Carna::base::MeshRenderingMixin` * Rename `Dimensions` to `Extent` and `millimeters` to `units` * Migrate build process from Carna to LibCarna * Migrate LICENSE to MIT * Migrate code from Carna to CarnaLib * Add logo * Add example notebook * Clean up convenience layer * Add `_transform` to convenience layer * Replace `np.bool` by `bool` * Add support for h264 rendering in `imshow` * Always build docs from scratch This is to avoid errors with nbsphinx. * Add examples/cthead.ipynb * Import colormaps from matplotlib * Add `DVRStage` * Add DVR to cells.ipynb * Update example notebooks * Rename `libcarna.animation` to `libcarna.animate` * Update example notebooks * Simplify `animate` syntax * Update example notebooks * Clean up `_expand_module` * Update example notebooks * Add material scheme validation * Update example notebooks * Add `dvr.replicate` * Add `mip.replicate` * Update example notebooks * Add `transform_into_voxels_from` method for volumes * Update example notebooks * Fix HUV normalization * Add `drr` * Update example notebooks * Update docs and example notebooks * Add `normalize_hounsfield_units` function * Add more debugging checks to `EGLContext` * Rename `mesh_factory` to `meshes` * Add `camera.proj` and `camera.frustum` methods * Refactor `_transform` and `_spatial_mixin` * Update * Update example notebooks * Add `libcarna.data` * Add `libcarna.data.toy` * Add `cutting_planes` * Add `cutting_planes` and `mask_renderer` * Rename `render` to `render_stage` * Fix `base.MeshFactory` * Clean up API, docs, and examples * Migrate `cutting_planes` to use color maps instead of windowing * Add `.normalized` and `.raw` convenience methods for `volume` geometries * Add fundamental colorbars * Refactor `colormap_helper` * Add colorbar labels, update example notebooks * Update example notebooks * Add spatial annotations example * Fix bugs, add segmentation example * Update README.md and example notebooks * Add `material.line_width` * Add track visualization example * Add `mesh` and `material` arguments to `geometry` function * Adapt to newest upstream changes * Add keyword aliases * Add more aliases and update docs * Update CI to build wheel * Add testing to CI * Update requirements * Update build workflows * Fix .github/workflows/build_all.yml * Fix .github/workflows/build_all.yml * Fix .github/workflows/build_all.yml * Fix .github/workflows/build.yml * Add example notebooks to test CI, fix triggers * Update README.md * Update environment.yml * Add `workflow_dispatch` trigger * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update build_all.yml * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI, update environment.yml * Update CI * Fix setup.py * Remove dangling files * Add dependencies to setup.py * Update CI * Update CI * Migrate to unity build * Update CI * Update CI * Update CI * Update CI * Update CI * Update CI * Remove libcarna from setup.py dependencies (not a Python dependency) * Fix dependencies * Update CI * Add test/__init__.py * Fix Python<3.12 compatibility * Update CI * Update CI * Update CI * Update CI * Fix compatibility with Python<3.11 * Debug * Add `LibCarna::egl::EGLContext::Details::selectDisplay` * Debug * Debug * Add `LIBCARNA_PYTHON_LOGGING` environment variable * Debug * Update CI * Install `libegl` via conda instead of apt * Add `typing_extensions` as dependency in setup.py * Update CI * Update CI * Update CI * Update CI * Remove support for Python 3.9 * Debug * Debug * Debug * Debug, add `EGLContext.vendor` and `EGLContext.renderer` * Update image comparison methods * Update image comparison methods * Update image comparison methods * Add vendor-specific expected test outputs * Employ vendor-specific expected test outputs * Remove debug output * Install missing dependencies * Add summary of notebook changes * Fix CI * Install ffmpeg * Remove notebooks from CI (taking too long) * Add more keyword aliases * Refactor `_spatial_mixin` rotation/translation/scaling methods
1 parent ec5c6a5 commit a8925d4

143 files changed

Lines changed: 8111 additions & 2853 deletions

File tree

Some content is hidden

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

.github/Dockerfile

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 115 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,133 @@
1-
name: Build CarnaPy and Docker image
1+
name: Build and Test
22

33
on:
4-
push:
5-
branches:
6-
- 'master'
7-
- 'dev**'
8-
tags:
9-
- '**'
4+
workflow_call:
5+
inputs:
6+
python-version:
7+
required: true
8+
type: string
109

1110
jobs:
12-
build_carnapy:
13-
name: Build CarnaPy
11+
build:
12+
name: Build
1413
runs-on: ubuntu-latest
1514
steps:
16-
-
17-
name: Git checkout
18-
uses: actions/checkout@v2
19-
-
20-
name: Setup Miniconda
21-
uses: conda-incubator/setup-miniconda@v2
15+
- name: Git checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Miniconda
19+
uses: conda-incubator/setup-miniconda@v3
2220
with:
23-
miniconda-version: 'latest'
24-
python-version: '3.10'
25-
channels: conda-forge, defaults
26-
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
21+
miniconda-version: latest
2722
auto-update-conda: true
28-
auto-activate-base: true
29-
-
30-
name: Set environment variables
31-
run: echo "CONDA_PREFIX=$CONDA" >> $GITHUB_ENV
32-
-
33-
name: Build dist
34-
run: sh linux_build.sh
35-
-
36-
name: Collect artifact data
23+
24+
- name: Patch required Python version
25+
run: |
26+
sed -i "s|python .\+|python ==${{ inputs.python-version }}|g" environment.yml
27+
cat environment.yml
28+
29+
- name: Create and validate conda environment
30+
shell: bash
3731
run: |
38-
mkdir /tmp/dist
39-
cp /usr/local/lib/libCarna-*.so /tmp/dist
40-
rm /tmp/dist/libCarna-*d.so
41-
cp $(find /home/runner/work -name '*.whl') /tmp/dist/
42-
-
43-
name: Build and upload artifact
44-
uses: actions/upload-artifact@v3
32+
conda env create -f environment.yml --prefix ./.env
33+
eval "$(conda shell.bash hook)"
34+
conda activate ./.env
35+
python -V
36+
python -c "import sys; v = sys.version_info; assert f'{v.major}.{v.minor}' == '${{ inputs.python-version }}'"
37+
38+
- name: Extract libcarna version
39+
id: meta
40+
shell: bash
41+
run: |
42+
eval "$(conda shell.bash hook)"
43+
conda activate ./.env
44+
export libcarna_version=$(conda list --json |jq -rj '[ .[] | select( .name == "libcarna" ) ][0].version')
45+
echo "libcarna_version=$libcarna_version" >> "$GITHUB_OUTPUT"
46+
47+
- name: Build dist
48+
shell: bash
49+
run: ./linux_build.bash
50+
51+
- name: Upload wheel
52+
uses: actions/upload-artifact@v4
4553
with:
46-
name: dist
54+
name: dist-${{ inputs.python-version }}
4755
path: |
48-
/tmp/dist
56+
dist
57+
58+
outputs:
59+
libcarna_version: ${{ steps.meta.outputs.libcarna_version }}
4960

50-
build_docker:
51-
name: Build Docker image
52-
needs: build_carnapy
61+
test:
62+
needs: build
63+
name: Test
5364
runs-on: ubuntu-latest
5465
steps:
55-
-
56-
name: Git checkout
57-
uses: actions/checkout@v2
58-
-
59-
name: Download artifact
60-
uses: actions/download-artifact@v3
66+
- name: Git checkout
67+
uses: actions/checkout@v4
68+
69+
- name: Install dependencies
70+
run: |
71+
sudo apt-get update -y -qq
72+
sudo apt-get install -y -qq libegl1
73+
74+
- name: Download artifact
75+
uses: actions/download-artifact@v4
6176
with:
62-
name: dist
63-
-
64-
name: Inspect working directory
65-
run: tree .
66-
-
67-
name: Set up QEMU
68-
uses: docker/setup-qemu-action@v3
69-
-
70-
name: Set up Docker Buildx
71-
uses: docker/setup-buildx-action@v3
72-
-
73-
name: Login to Docker Hub
74-
uses: docker/login-action@v3
77+
name: dist-${{ inputs.python-version }}
78+
79+
- name: Setup Miniconda
80+
uses: conda-incubator/setup-miniconda@v3
7581
with:
76-
username: ${{ secrets.DOCKERHUB_USERNAME }}
77-
password: ${{ secrets.DOCKERHUB_TOKEN }}
78-
-
79-
name: Setup repository name
80-
id: setup_repository_name
82+
miniconda-version: latest
83+
auto-update-conda: true
84+
85+
- name: Create and validate conda environment
86+
shell: bash
87+
run: |
88+
conda create --prefix ./.env -c conda-forge -c bioconda \
89+
python==${{ inputs.python-version }} \
90+
libcarna==${{ needs.build.outputs.libcarna_version }} \
91+
pip
92+
eval "$(conda shell.bash hook)"
93+
conda activate ./.env
94+
python -V
95+
python -c "import sys; v = sys.version_info; assert f'{v.major}.{v.minor}' == '${{ inputs.python-version }}'"
96+
97+
- name: Install wheel
98+
run: |
99+
eval "$(conda shell.bash hook)"
100+
conda activate ./.env
101+
pip install libcarna_python-*.whl
102+
103+
- name: Test installation
81104
run: |
82-
echo "docker_repository=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
83-
-
84-
name: Build and push
85-
uses: docker/build-push-action@v5
105+
eval "$(conda shell.bash hook)"
106+
conda activate ./.env
107+
python -c "import libcarna; assert libcarna.libcarna_version == '${{ needs.build.outputs.libcarna_version }}'"
108+
109+
- name: Install dependencies for tests and examples
110+
run: |
111+
eval "$(conda shell.bash hook)"
112+
conda activate ./.env
113+
pip install -r test/requirements.txt
114+
pip install -r docs/requirements.txt
115+
116+
- name: Run tests
117+
run: |
118+
eval "$(conda shell.bash hook)"
119+
conda activate ./.env
120+
cd test
121+
mkdir test
122+
mv results test/results
123+
python -m unittest -vv
124+
env:
125+
LIBCARNA_PYTHON_LOGGING: true
126+
127+
- name: Upload failed test output
128+
uses: actions/upload-artifact@v4
129+
if: failure()
86130
with:
87-
file: .github/Dockerfile
88-
context: .
89-
push: true
90-
tags: ${{ steps.setup_repository_name.outputs.docker_repository }}:${{ github.ref_name }}
131+
name: test-output-${{ inputs.python-version }}
132+
path: |
133+
test/test/results/actual

.github/workflows/build_all.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build and Test
2+
3+
on:
4+
workflow_dispatch:
5+
6+
push:
7+
branches: [ 'master', 'develop' ]
8+
paths-ignore:
9+
- 'docs/**'
10+
- '.git*'
11+
- 'LICENSE'
12+
- 'LICENSE-*'
13+
- 'README.md'
14+
15+
pull_request:
16+
branches-ignore: [ 'master' ]
17+
18+
jobs:
19+
build_and_test:
20+
name: Build and Test ${{ matrix.python-version }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
python-version: ['3.10', '3.11', '3.12']
25+
uses: ./.github/workflows/build.yml
26+
secrets: inherit
27+
with:
28+
python-version: ${{ matrix.python-version }}

.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
/.env
2+
/condaenv.*
13
/build
4+
/docs/build
25
/dist
3-
/CarnaPy.egg-info
4-
/misc/conda-recipe/carnapy
6+
/LibCarna_Python.egg-info
7+
/.libcarna-dev
58
.ipynb_checkpoints
69
*.swp
10+
*.pyc
11+
*.DS_Store

.readthedocs.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Read the Docs configuration file
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the OS, Python version, and other tools you might need
8+
build:
9+
os: ubuntu-24.04
10+
tools:
11+
python: "3.12"
12+
13+
# Build documentation in the "docs/" directory with Sphinx
14+
sphinx:
15+
fail_on_warning: true
16+
configuration: docs/conf.py
17+
18+
# Install dependencies
19+
conda:
20+
environment: environment.yml
21+
22+
# Install our python package and other dependencies
23+
python:
24+
install:
25+
- requirements: docs/requirements.txt
26+
- method: pip
27+
path: .

0 commit comments

Comments
 (0)