mergechannels 0.1.1__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mergechannels might be problematic. Click here for more details.
- {mergechannels-0.1.1 → mergechannels-0.1.2}/.gitattributes +1 -1
- {mergechannels-0.1.1 → mergechannels-0.1.2}/.github/workflows/CI.yml +58 -32
- {mergechannels-0.1.1 → mergechannels-0.1.2}/.gitignore +5 -1
- mergechannels-0.1.2/.pre-commit-config.yaml +16 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/Cargo.lock +1 -1
- {mergechannels-0.1.1 → mergechannels-0.1.2}/Cargo.toml +1 -1
- {mergechannels-0.1.1 → mergechannels-0.1.2}/LICENSE +1 -1
- {mergechannels-0.1.1 → mergechannels-0.1.2}/PKG-INFO +10 -7
- {mergechannels-0.1.1 → mergechannels-0.1.2}/README.md +6 -4
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/phase.lut +0 -1
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/Turbo.lut +1 -1
- {mergechannels-0.1.1 → mergechannels-0.1.2}/pyproject.toml +11 -3
- {mergechannels-0.1.1 → mergechannels-0.1.2}/pytests/test_colorize.py +28 -1
- {mergechannels-0.1.1 → mergechannels-0.1.2}/python/mergechannels/__init__.py +4 -4
- {mergechannels-0.1.1 → mergechannels-0.1.2}/python/mergechannels/__init__.pyi +1 -1
- {mergechannels-0.1.1 → mergechannels-0.1.2}/python/mergechannels/_internal.py +4 -15
- mergechannels-0.1.2/ruff.toml +86 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/scripts/convert_luts_to_txt.ijm +1 -1
- {mergechannels-0.1.1 → mergechannels-0.1.2}/scripts/populate_luts.py +22 -19
- mergechannels-0.1.2/tox.ini +11 -0
- mergechannels-0.1.2/uv.lock +662 -0
- mergechannels-0.1.1/assets/readme_images/camera_red-green.png +0 -3
- mergechannels-0.1.1/assets/readme_images/cells_multicolor.png +0 -3
- mergechannels-0.1.1/test.ipynb +0 -101
- mergechannels-0.1.1/uv.lock +0 -48
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/16_colors.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/5_ramps.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/6_shades.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/Cyan Hot.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/Green Fire Blue.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/HiLo.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/ICA.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/ICA2.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/ICA3.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/Magenta Hot.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/Orange Hot.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/Rainbow RGB.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/Red Hot.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/Thermal.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/Yellow Hot.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/blue_orange_icb.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/brgbcmyw.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/cool.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/edges.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/gem.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/glasbey.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/glasbey_inverted.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/glasbey_on_dark.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/glow.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/mpl-inferno.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/mpl-magma.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/mpl-plasma.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/mpl-viridis.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/physics.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/royal.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/sepia.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/smart.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/thal.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/thallium.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/builtin_luts/unionjack.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/3color-BMR.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/3color-CGY.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/3color-RMB.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/3color-YGC.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/BOP blue.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/BOP orange.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/BOP purple.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/I Blue.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/I Bordeaux.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/I Cyan.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/I Forest.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/I Green.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/I Magenta.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/I Purple.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/I Red.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/I Yellow.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/NOTICE +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/OPF fresh.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/OPF orange.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/christ_luts/OPF purple.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/16_colors.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/3-3-2 RGB.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/3color-BMR.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/3color-CGY.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/3color-RMB.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/3color-YGC.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/5_ramps.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/6_shades.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/BOP blue.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/BOP orange.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/BOP purple.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Blue.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Cyan Hot.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Cyan.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Fire.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Grays.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Green Fire Blue.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Green.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/HiLo.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/I Blue.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/I Bordeaux.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/I Cyan.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/I Forest.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/I Green.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/I Magenta.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/I Purple.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/I Red.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/I Yellow.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/ICA.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/ICA2.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/ICA3.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Ice.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Magenta Hot.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Magenta.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/OIMB1.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/OIMB2.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/OIMB3.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/OPF fresh.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/OPF orange.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/OPF purple.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Orange Hot.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Rainbow RGB.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Red Hot.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Red%Green.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Red.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Spectrum.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Thermal.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Turbo.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Yellow Hot.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/Yellow.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/betterBlue.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/betterCyan.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/betterGreen.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/betterOrange.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/betterRed.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/betterYellow.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/blue_orange_icb.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/brgbcmyw.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/cool.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/edges.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/gem.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/glasbey.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/glasbey_inverted.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/glasbey_on_dark.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/glow.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/mpl-inferno.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/mpl-magma.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/mpl-plasma.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/mpl-viridis.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/phase.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/physics.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/royal.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/sepia.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/smart.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/thal.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/thallium.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/converted/unionjack.txt +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/zac_luts/OIMB1.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/zac_luts/OIMB2.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/zac_luts/OIMB3.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/zac_luts/betterBlue.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/zac_luts/betterCyan.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/zac_luts/betterGreen.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/zac_luts/betterOrange.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/zac_luts/betterRed.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/assets/zac_luts/betterYellow.lut +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/python/mergechannels/_blending.py +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/python/mergechannels/_luts.py +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/python/mergechannels/py.typed +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/src/blend.rs +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/src/cmaps.rs +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/src/colorize.rs +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/src/interface.rs +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/src/lib.rs +0 -0
- {mergechannels-0.1.1 → mergechannels-0.1.2}/src/normalize.rs +0 -0
|
@@ -8,8 +8,7 @@ name: CI
|
|
|
8
8
|
on:
|
|
9
9
|
push:
|
|
10
10
|
branches:
|
|
11
|
-
-
|
|
12
|
-
- mvp
|
|
11
|
+
- '*'
|
|
13
12
|
tags:
|
|
14
13
|
- '*'
|
|
15
14
|
pull_request:
|
|
@@ -24,50 +23,73 @@ jobs:
|
|
|
24
23
|
runs-on: ubuntu-latest
|
|
25
24
|
steps:
|
|
26
25
|
- uses: actions/checkout@v4
|
|
27
|
-
|
|
26
|
+
|
|
28
27
|
# Setup Rust toolchain
|
|
29
28
|
- name: Install Rust stable
|
|
30
29
|
uses: dtolnay/rust-toolchain@stable
|
|
31
30
|
with:
|
|
32
31
|
components: rustfmt, clippy
|
|
33
|
-
|
|
34
|
-
# Run Rust format check
|
|
32
|
+
|
|
35
33
|
- name: Check Rust formatting
|
|
36
34
|
run: cargo fmt --all -- --check
|
|
37
|
-
|
|
38
|
-
# Run Clippy
|
|
35
|
+
|
|
39
36
|
- name: Run Clippy
|
|
40
37
|
run: cargo clippy -- -D warnings
|
|
41
|
-
|
|
42
|
-
# Run Cargo tests
|
|
38
|
+
|
|
43
39
|
- name: Run Cargo tests
|
|
44
40
|
run: cargo test
|
|
45
|
-
|
|
46
|
-
# # Setup Python for testing
|
|
47
|
-
# - uses: actions/setup-python@v5
|
|
48
|
-
# with:
|
|
49
|
-
# python-version: 3.x
|
|
50
|
-
|
|
51
|
-
# Install UV
|
|
41
|
+
|
|
52
42
|
- name: Install UV
|
|
53
43
|
uses: astral-sh/setup-uv@v5
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
44
|
+
with:
|
|
45
|
+
enable-cache: true
|
|
46
|
+
|
|
47
|
+
- name: Install the project
|
|
48
|
+
run: uv sync --all-extras --dev
|
|
49
|
+
|
|
50
|
+
- name: Run pre-commit
|
|
51
|
+
shell: bash -l {0}
|
|
52
|
+
run: uv run pre-commit run --all-files
|
|
53
|
+
|
|
54
|
+
tox_tests:
|
|
55
|
+
name: Tox Tests (${{ matrix.python-version }}) # Add python version to name for clarity
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
strategy:
|
|
58
|
+
matrix:
|
|
59
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
60
|
+
fail-fast: true # Optional: prevent other matrix jobs from cancelling if one fails
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
|
|
64
|
+
# Set up the specific Python version for this matrix job
|
|
65
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
66
|
+
uses: actions/setup-python@v5
|
|
67
|
+
with:
|
|
68
|
+
python-version: ${{ matrix.python-version }}
|
|
69
|
+
|
|
70
|
+
# Install UV using the official action, enabling caching
|
|
71
|
+
- name: Install UV
|
|
72
|
+
uses: astral-sh/setup-uv@v5
|
|
73
|
+
with:
|
|
74
|
+
# Enable uv's cache for faster subsequent runs
|
|
75
|
+
enable-cache: true
|
|
76
|
+
|
|
77
|
+
# Install tox and tox-uv using uv tool install
|
|
78
|
+
# This installs them into an isolated environment managed by uv
|
|
79
|
+
- name: Install Tox with tox-uv plugin using UV
|
|
80
|
+
run: uv tool install tox --with tox-uv
|
|
81
|
+
|
|
82
|
+
# Run Tox using uvx
|
|
83
|
+
# uvx ensures that the 'tox' command installed via 'uv tool install' is used
|
|
84
|
+
- name: Run Tox tests via uvx
|
|
64
85
|
run: |
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
pytest
|
|
86
|
+
PY_VERSION=$(echo ${{ matrix.python-version }} | tr -d '.')
|
|
87
|
+
uvx tox -e py$PY_VERSION
|
|
68
88
|
|
|
69
|
-
|
|
70
|
-
|
|
89
|
+
|
|
90
|
+
build:
|
|
91
|
+
needs: [rust_checks_and_python_tests, tox_tests]
|
|
92
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
71
93
|
runs-on: ${{ matrix.platform.runner }}
|
|
72
94
|
strategy:
|
|
73
95
|
matrix:
|
|
@@ -104,6 +126,7 @@ jobs:
|
|
|
104
126
|
|
|
105
127
|
musllinux:
|
|
106
128
|
needs: rust_checks_and_python_tests
|
|
129
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
107
130
|
runs-on: ${{ matrix.platform.runner }}
|
|
108
131
|
strategy:
|
|
109
132
|
matrix:
|
|
@@ -136,6 +159,7 @@ jobs:
|
|
|
136
159
|
|
|
137
160
|
windows:
|
|
138
161
|
needs: rust_checks_and_python_tests
|
|
162
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
139
163
|
runs-on: ${{ matrix.platform.runner }}
|
|
140
164
|
strategy:
|
|
141
165
|
matrix:
|
|
@@ -164,6 +188,7 @@ jobs:
|
|
|
164
188
|
|
|
165
189
|
macos:
|
|
166
190
|
needs: rust_checks_and_python_tests
|
|
191
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
167
192
|
runs-on: ${{ matrix.platform.runner }}
|
|
168
193
|
strategy:
|
|
169
194
|
matrix:
|
|
@@ -191,6 +216,7 @@ jobs:
|
|
|
191
216
|
|
|
192
217
|
sdist:
|
|
193
218
|
needs: rust_checks_and_python_tests
|
|
219
|
+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
194
220
|
runs-on: ubuntu-latest
|
|
195
221
|
steps:
|
|
196
222
|
- uses: actions/checkout@v4
|
|
@@ -209,7 +235,7 @@ jobs:
|
|
|
209
235
|
name: Release
|
|
210
236
|
runs-on: ubuntu-latest
|
|
211
237
|
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
|
|
212
|
-
needs: [
|
|
238
|
+
needs: [build, musllinux, windows, macos, sdist]
|
|
213
239
|
permissions:
|
|
214
240
|
# Use to sign the release artifacts
|
|
215
241
|
id-token: write
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v4.6.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-toml
|
|
9
|
+
- id: check-added-large-files
|
|
10
|
+
|
|
11
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
12
|
+
rev: v0.3.3
|
|
13
|
+
hooks:
|
|
14
|
+
- id: ruff
|
|
15
|
+
types_or: [ python, pyi, jupyter ]
|
|
16
|
+
args: [ --fix ]
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mergechannels
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
7
|
Classifier: License :: OSI Approved :: MIT License
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
10
9
|
Classifier: Programming Language :: Python :: 3.9
|
|
11
10
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
11
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
-
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Requires-Dist: numpy>1.25.0
|
|
15
15
|
License-File: LICENSE
|
|
16
16
|
License: MIT
|
|
17
|
-
Requires-Python: >=3.
|
|
17
|
+
Requires-Python: >=3.9, <=3.13
|
|
18
18
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
19
19
|
|
|
20
20
|
[](https://github.com/zacswider/mergechannels/actions/workflows/CI.yml)
|
|
21
|
-

|
|
22
|
+

|
|
22
23
|

|
|
23
24
|
|
|
24
25
|
# mergechannels
|
|
@@ -59,7 +60,8 @@ plt.show()
|
|
|
59
60
|
print(colorized.shape, colorized.dtype)
|
|
60
61
|
>> (512, 512, 3) uint8
|
|
61
62
|
```
|
|
62
|
-

|
|
63
65
|
|
|
64
66
|
|
|
65
67
|
### apply a different colormap to each channel
|
|
@@ -93,7 +95,7 @@ d.imshow(
|
|
|
93
95
|
fig.tight_layout()
|
|
94
96
|
plt.show()
|
|
95
97
|
```
|
|
96
|
-

|
|
97
99
|
|
|
98
100
|
|
|
99
101
|
## Roadmap
|
|
@@ -110,3 +112,4 @@ mergechannels is currently incredibly simple. It can apply one or more colormaps
|
|
|
110
112
|
There are other great colormapping libraries available (e.g., [microfilm](https://github.com/guiwitz/microfilm), [cmap](https://github.com/pyapp-kit/cmap)) that are more feature-rich than this one, but which don't address my goals. My hope is that this project can fill an un-met niche and otherwise maintain full compatibility with these and similar libraries.
|
|
111
113
|
|
|
112
114
|
This project incorporates a number of colormaps that were hand-crafted by Christophe Leterrier and were originally distributed here under the MIT license: https://github.com/cleterrier/ChrisLUTs
|
|
115
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
[](https://github.com/zacswider/mergechannels/actions/workflows/CI.yml)
|
|
2
|
-

|
|
3
|
+

|
|
3
4
|

|
|
4
5
|
|
|
5
6
|
# mergechannels
|
|
@@ -40,7 +41,8 @@ plt.show()
|
|
|
40
41
|
print(colorized.shape, colorized.dtype)
|
|
41
42
|
>> (512, 512, 3) uint8
|
|
42
43
|
```
|
|
43
|
-

|
|
44
46
|
|
|
45
47
|
|
|
46
48
|
### apply a different colormap to each channel
|
|
@@ -74,7 +76,7 @@ d.imshow(
|
|
|
74
76
|
fig.tight_layout()
|
|
75
77
|
plt.show()
|
|
76
78
|
```
|
|
77
|
-

|
|
78
80
|
|
|
79
81
|
|
|
80
82
|
## Roadmap
|
|
@@ -90,4 +92,4 @@ mergechannels is currently incredibly simple. It can apply one or more colormaps
|
|
|
90
92
|
|
|
91
93
|
There are other great colormapping libraries available (e.g., [microfilm](https://github.com/guiwitz/microfilm), [cmap](https://github.com/pyapp-kit/cmap)) that are more feature-rich than this one, but which don't address my goals. My hope is that this project can fill an un-met niche and otherwise maintain full compatibility with these and similar libraries.
|
|
92
94
|
|
|
93
|
-
This project incorporates a number of colormaps that were hand-crafted by Christophe Leterrier and were originally distributed here under the MIT license: https://github.com/cleterrier/ChrisLUTs
|
|
95
|
+
This project incorporates a number of colormaps that were hand-crafted by Christophe Leterrier and were originally distributed here under the MIT license: https://github.com/cleterrier/ChrisLUTs
|
|
@@ -5,21 +5,29 @@ build-backend = "maturin"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "mergechannels"
|
|
7
7
|
license = { text = "MIT" }
|
|
8
|
-
requires-python = ">=3.
|
|
8
|
+
requires-python = ">=3.9, <=3.13"
|
|
9
9
|
classifiers = [
|
|
10
10
|
"Programming Language :: Rust",
|
|
11
11
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
12
12
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
13
13
|
"License :: OSI Approved :: MIT License",
|
|
14
14
|
"Programming Language :: Python :: 3",
|
|
15
|
-
"Programming Language :: Python :: 3.8",
|
|
16
15
|
"Programming Language :: Python :: 3.9",
|
|
17
16
|
"Programming Language :: Python :: 3.10",
|
|
18
17
|
"Programming Language :: Python :: 3.11",
|
|
19
18
|
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
20
|
]
|
|
21
21
|
dynamic = ["version"]
|
|
22
|
-
dependencies = ["numpy
|
|
22
|
+
dependencies = ["numpy>1.25.0"]
|
|
23
23
|
[tool.maturin]
|
|
24
24
|
features = ["pyo3/extension-module"]
|
|
25
25
|
python-source = "python"
|
|
26
|
+
|
|
27
|
+
[dependency-groups]
|
|
28
|
+
dev = [
|
|
29
|
+
"matplotlib>=3.7.5",
|
|
30
|
+
"pre-commit>=3.5.0",
|
|
31
|
+
"pytest-benchmark>=4.0.0",
|
|
32
|
+
"pytest>=8.3.5",
|
|
33
|
+
]
|
|
@@ -3,6 +3,9 @@ import mergechannels as mc
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
def test_apply_color_map():
|
|
6
|
+
'''
|
|
7
|
+
Test that the color map is applied correctly
|
|
8
|
+
'''
|
|
6
9
|
x = np.ones((1, 1), dtype=np.uint8)
|
|
7
10
|
rgb = mc.apply_color_map(x, 'betterBlue')
|
|
8
11
|
assert rgb.shape == (1,1,3)
|
|
@@ -23,6 +26,9 @@ def test_apply_color_map():
|
|
|
23
26
|
)
|
|
24
27
|
|
|
25
28
|
def test_apply_colors_and_merge_low_sum():
|
|
29
|
+
'''
|
|
30
|
+
Test that the colors are merged correctly with sum blending and low values
|
|
31
|
+
'''
|
|
26
32
|
x = np.ones((1, 1), dtype=np.uint8)
|
|
27
33
|
y = np.ones((1, 1), dtype=np.uint8)
|
|
28
34
|
rgb_sum = mc.apply_colors_and_merge_nc([x, y], ['betterBlue', 'betterOrange'], 'sum')
|
|
@@ -36,6 +42,9 @@ def test_apply_colors_and_merge_low_sum():
|
|
|
36
42
|
)
|
|
37
43
|
|
|
38
44
|
def test_apply_colors_and_merge_high_sum():
|
|
45
|
+
'''
|
|
46
|
+
Test that the colors are merged correctly with sum blending and high values
|
|
47
|
+
'''
|
|
39
48
|
x = np.ones((1, 1), dtype=np.uint8) * 255
|
|
40
49
|
y = np.ones((1, 1), dtype=np.uint8) * 255
|
|
41
50
|
rgb_sum = mc.apply_colors_and_merge_nc([x, y], ['betterBlue', 'betterOrange'], 'sum')
|
|
@@ -49,6 +58,9 @@ def test_apply_colors_and_merge_high_sum():
|
|
|
49
58
|
)
|
|
50
59
|
|
|
51
60
|
def test_apply_colors_and_merge_low_max():
|
|
61
|
+
'''
|
|
62
|
+
Test that the colors are merged correctly with max blending and low values
|
|
63
|
+
'''
|
|
52
64
|
x = np.ones((1, 1), dtype=np.uint8)
|
|
53
65
|
y = np.ones((1, 1), dtype=np.uint8)
|
|
54
66
|
rgb_max = mc.apply_colors_and_merge_nc([x, y], ['betterBlue', 'betterOrange'], 'max')
|
|
@@ -62,6 +74,9 @@ def test_apply_colors_and_merge_low_max():
|
|
|
62
74
|
)
|
|
63
75
|
|
|
64
76
|
def test_apply_colors_and_merge_high_max():
|
|
77
|
+
'''
|
|
78
|
+
Test that the colors are merged correctly with max blending and high values
|
|
79
|
+
'''
|
|
65
80
|
x = np.ones((1, 1), dtype=np.uint8) * 255
|
|
66
81
|
y = np.ones((1, 1), dtype=np.uint8) * 255
|
|
67
82
|
rgb_max = mc.apply_colors_and_merge_nc([x, y], ['betterBlue', 'betterOrange'], 'max')
|
|
@@ -75,6 +90,9 @@ def test_apply_colors_and_merge_high_max():
|
|
|
75
90
|
)
|
|
76
91
|
|
|
77
92
|
def test_apply_colors_and_merge_low_min():
|
|
93
|
+
'''
|
|
94
|
+
Test that the colors are merged correctly with min blending and low values
|
|
95
|
+
'''
|
|
78
96
|
x = np.ones((1, 1), dtype=np.uint8)
|
|
79
97
|
y = np.ones((1, 1), dtype=np.uint8)
|
|
80
98
|
rgb_min = mc.apply_colors_and_merge_nc([x, y], ['betterBlue', 'betterOrange'], 'min')
|
|
@@ -88,6 +106,9 @@ def test_apply_colors_and_merge_low_min():
|
|
|
88
106
|
)
|
|
89
107
|
|
|
90
108
|
def test_apply_colors_and_merge_high_min():
|
|
109
|
+
'''
|
|
110
|
+
Test that the colors are merged correctly with min blending and high values
|
|
111
|
+
'''
|
|
91
112
|
x = np.ones((1, 1), dtype=np.uint8) * 255
|
|
92
113
|
y = np.ones((1, 1), dtype=np.uint8) * 255
|
|
93
114
|
rgb_min = mc.apply_colors_and_merge_nc([x, y], ['betterBlue', 'betterOrange'], 'min')
|
|
@@ -101,6 +122,9 @@ def test_apply_colors_and_merge_high_min():
|
|
|
101
122
|
)
|
|
102
123
|
|
|
103
124
|
def test_apply_colors_and_merge_low_mean():
|
|
125
|
+
'''
|
|
126
|
+
Test that the colors are merged correctly with mean blending and low values
|
|
127
|
+
'''
|
|
104
128
|
x = np.ones((1, 1), dtype=np.uint8)
|
|
105
129
|
y = np.ones((1, 1), dtype=np.uint8)
|
|
106
130
|
rgb_mean = mc.apply_colors_and_merge_nc([x, y], ['betterBlue', 'betterOrange'], 'mean')
|
|
@@ -116,6 +140,9 @@ def test_apply_colors_and_merge_low_mean():
|
|
|
116
140
|
)
|
|
117
141
|
|
|
118
142
|
def test_apply_colors_and_merge_high_mean():
|
|
143
|
+
'''
|
|
144
|
+
Test that the colors are merged correctly with mean blending and high values
|
|
145
|
+
'''
|
|
119
146
|
x = np.ones((1, 1), dtype=np.uint8) * 255
|
|
120
147
|
y = np.ones((1, 1), dtype=np.uint8) * 255
|
|
121
148
|
rgb_mean = mc.apply_colors_and_merge_nc([x, y], ['betterBlue', 'betterOrange'], 'mean')
|
|
@@ -128,4 +155,4 @@ def test_apply_colors_and_merge_high_mean():
|
|
|
128
155
|
np.array(
|
|
129
156
|
[[[127, 168, 127]]]
|
|
130
157
|
)
|
|
131
|
-
)
|
|
158
|
+
)
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
from .mergechannels import ( # type: ignore
|
|
3
3
|
apply_color_map,
|
|
4
4
|
apply_colors_and_merge_nc,
|
|
5
|
-
)
|
|
5
|
+
)
|
|
6
6
|
|
|
7
7
|
from ._internal import merge
|
|
8
8
|
|
|
9
9
|
__all__ = [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
'apply_color_map',
|
|
11
|
+
'apply_colors_and_merge_nc',
|
|
12
|
+
'merge',
|
|
13
13
|
]
|
|
@@ -40,19 +40,8 @@ def merge(
|
|
|
40
40
|
f'Expected every array to have the same dtype, got {arr_dtypes}'
|
|
41
41
|
)
|
|
42
42
|
# endregion
|
|
43
|
-
|
|
44
|
-
match n_arrs:
|
|
45
|
-
case 1:
|
|
46
|
-
return apply_color_map(arr=arrs[0], cmap_name=colors[0])
|
|
47
|
-
case _:
|
|
48
|
-
return apply_colors_and_merge_nc(arrs, colors, blending)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
43
|
|
|
44
|
+
if n_arrs == 1:
|
|
45
|
+
return apply_color_map(arr=arrs[0], cmap_name=colors[0])
|
|
46
|
+
else:
|
|
47
|
+
return apply_colors_and_merge_nc(arrs, colors, blending)
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
|
|
2
|
+
exclude = [
|
|
3
|
+
".bzr",
|
|
4
|
+
".direnv",
|
|
5
|
+
".eggs",
|
|
6
|
+
".git",
|
|
7
|
+
".git-rewrite",
|
|
8
|
+
".hg",
|
|
9
|
+
".ipynb_checkpoints",
|
|
10
|
+
".mypy_cache",
|
|
11
|
+
".nox",
|
|
12
|
+
".pants.d",
|
|
13
|
+
".pyenv",
|
|
14
|
+
".pytest_cache",
|
|
15
|
+
".pytype",
|
|
16
|
+
".ruff_cache",
|
|
17
|
+
".svn",
|
|
18
|
+
".tox",
|
|
19
|
+
".venv",
|
|
20
|
+
".vscode",
|
|
21
|
+
"__pypackages__",
|
|
22
|
+
"_build",
|
|
23
|
+
"buck-out",
|
|
24
|
+
"build",
|
|
25
|
+
"dist",
|
|
26
|
+
"node_modules",
|
|
27
|
+
"site-packages",
|
|
28
|
+
"venv",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
line-length = 100
|
|
32
|
+
indent-width = 4
|
|
33
|
+
|
|
34
|
+
# Assume Python 3.11
|
|
35
|
+
target-version = "py311"
|
|
36
|
+
|
|
37
|
+
lint.select = [
|
|
38
|
+
"E4",
|
|
39
|
+
"E7",
|
|
40
|
+
"E9",
|
|
41
|
+
"F",
|
|
42
|
+
'W291', # trailing-whitespace
|
|
43
|
+
'W292', # no-newline-at-eof
|
|
44
|
+
'W293', # blank-line-at-eof
|
|
45
|
+
'D100', # missing module docstring
|
|
46
|
+
'D101', # missing class docstring
|
|
47
|
+
'D102', # missing method docstring
|
|
48
|
+
'D103', # missing function docstring
|
|
49
|
+
'D417', # missing argument descriptions
|
|
50
|
+
'E501', # line-too-long
|
|
51
|
+
'F621', # too many args in star unpacking
|
|
52
|
+
'Q', # flake8 quotes
|
|
53
|
+
]
|
|
54
|
+
|
|
55
|
+
lint.ignore = [
|
|
56
|
+
"PLE1205", # logging-too-many-args
|
|
57
|
+
"PLR0904", # too-many-public-methods
|
|
58
|
+
"PLR0911", # too-many-return-statements
|
|
59
|
+
"PLR0912", # too-many-branches
|
|
60
|
+
"PLR0913", # too-many-arguments
|
|
61
|
+
"PLR0914", # too-many-locals
|
|
62
|
+
"PLR0915", # too-many-statements
|
|
63
|
+
"PLR1702", # too-many-nested-blocks
|
|
64
|
+
"PLW0603", # global-statement
|
|
65
|
+
"PLW1514", # unspecified-encoding
|
|
66
|
+
'E741', # ambiguous-variable-name
|
|
67
|
+
'F722', # forward-annotation-syntax-error
|
|
68
|
+
'E722', # allow bare except
|
|
69
|
+
'D100', # missing module docstring
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
lint.fixable = ["ALL"]
|
|
73
|
+
lint.unfixable = []
|
|
74
|
+
|
|
75
|
+
[format]
|
|
76
|
+
quote-style = "single"
|
|
77
|
+
indent-style = "space"
|
|
78
|
+
skip-magic-trailing-comma = true
|
|
79
|
+
line-ending = "auto"
|
|
80
|
+
docstring-code-format = false
|
|
81
|
+
|
|
82
|
+
docstring-code-line-length = "dynamic"
|
|
83
|
+
|
|
84
|
+
[lint.flake8-quotes]
|
|
85
|
+
inline-quotes = 'single'
|
|
86
|
+
docstring-quotes = 'single'
|
|
@@ -27,7 +27,7 @@ for (i = 0; i < lutList.length; i++) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// Process built-in lookup tables
|
|
30
|
-
builtInLuts = newArray("Fire", "Grays", "Ice", "Spectrum", "3-3-2 RGB",
|
|
30
|
+
builtInLuts = newArray("Fire", "Grays", "Ice", "Spectrum", "3-3-2 RGB",
|
|
31
31
|
"Red", "Green", "Blue", "Cyan", "Magenta", "Yellow", "Red/Green");
|
|
32
32
|
|
|
33
33
|
for (i = 0; i < builtInLuts.length; i++) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# ///
|
|
7
7
|
|
|
8
8
|
'''
|
|
9
|
-
This script converts the luts in the `assets/converted` directory into
|
|
9
|
+
This script converts the luts in the `assets/converted` directory into
|
|
10
10
|
1) a lazy static hashmap that with the rgb values for each lut
|
|
11
11
|
2) a type hint file for the lut names so that the names are autocompleted in IDEs
|
|
12
12
|
|
|
@@ -18,12 +18,15 @@ import numpy as np
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def main():
|
|
21
|
+
'''
|
|
22
|
+
Build the lazy static hashmap and the type hint file for the lut names
|
|
23
|
+
'''
|
|
21
24
|
curr_file = Path(__file__).absolute()
|
|
22
|
-
luts_dir = curr_file.parent.parent /
|
|
23
|
-
lut_files = list(luts_dir.glob(
|
|
25
|
+
luts_dir = curr_file.parent.parent / 'assets' / 'converted'
|
|
26
|
+
lut_files = list(luts_dir.glob('*.txt'))
|
|
24
27
|
lut_data: dict[str, np.ndarray] = {}
|
|
25
28
|
for lut_file in lut_files:
|
|
26
|
-
with open(lut_file,
|
|
29
|
+
with open(lut_file, 'r') as f:
|
|
27
30
|
lut_vals = []
|
|
28
31
|
for line in f.readlines():
|
|
29
32
|
line_vals = np.array(line.strip().split('\t'), dtype='uint8')
|
|
@@ -32,28 +35,28 @@ def main():
|
|
|
32
35
|
lut = np.array(lut_vals, dtype='uint8')
|
|
33
36
|
assert lut.shape == (256, 3)
|
|
34
37
|
lut_data[lut_file.stem.replace('%', '/')] = lut
|
|
35
|
-
|
|
36
|
-
cmaps_file = curr_file.parent.parent /
|
|
38
|
+
|
|
39
|
+
cmaps_file = curr_file.parent.parent / 'src' / 'cmaps.rs'
|
|
37
40
|
assert cmaps_file.exists()
|
|
38
41
|
|
|
39
|
-
cmaps_file_lines =
|
|
40
|
-
cmaps_file_lines +=
|
|
41
|
-
cmaps_file_lines +=
|
|
42
|
-
cmaps_file_lines +=
|
|
43
|
-
cmaps_file_lines +=
|
|
42
|
+
cmaps_file_lines = ''
|
|
43
|
+
cmaps_file_lines += 'use lazy_static::lazy_static;\n'
|
|
44
|
+
cmaps_file_lines += 'use std::collections::HashMap;\n\n'
|
|
45
|
+
cmaps_file_lines += 'type Colormap = [[u8; 3]; 256];\n\n'
|
|
46
|
+
cmaps_file_lines += 'lazy_static! {\n'
|
|
44
47
|
cmaps_file_lines += "\tpub static ref CMAPS: HashMap<&'static str, Colormap> = {\n"
|
|
45
|
-
cmaps_file_lines +=
|
|
46
|
-
|
|
48
|
+
cmaps_file_lines += '\t\tlet mut m = HashMap::new();\n'
|
|
49
|
+
|
|
47
50
|
for lut_name, lut in lut_data.items():
|
|
48
51
|
cmaps_file_lines += f'\t\tm.insert("{lut_name}", [\n'
|
|
49
52
|
for i in range(256):
|
|
50
53
|
cmaps_file_lines += f'\t\t\t[{lut[i, 0]}, {lut[i, 1]}, {lut[i, 2]}],\n'
|
|
51
54
|
cmaps_file_lines += '\t\t]);\n\n'
|
|
52
|
-
cmaps_file_lines +=
|
|
53
|
-
cmaps_file_lines +=
|
|
54
|
-
cmaps_file_lines +=
|
|
55
|
+
cmaps_file_lines += '\t\tm'
|
|
56
|
+
cmaps_file_lines += '\t};'
|
|
57
|
+
cmaps_file_lines += '}'
|
|
55
58
|
|
|
56
|
-
with open(cmaps_file,
|
|
59
|
+
with open(cmaps_file, 'w') as f:
|
|
57
60
|
f.write(cmaps_file_lines)
|
|
58
61
|
|
|
59
62
|
lut_names_type_hint_file = curr_file.parent.parent / 'python' / 'mergechannels' / '_luts.py'
|
|
@@ -67,5 +70,5 @@ def main():
|
|
|
67
70
|
f.write(lut_names_lines)
|
|
68
71
|
|
|
69
72
|
|
|
70
|
-
if __name__ ==
|
|
71
|
-
main()
|
|
73
|
+
if __name__ == '__main__':
|
|
74
|
+
main()
|