diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 3d27610..25676b0 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -28,13 +28,13 @@ jobs: uses: docker/setup-qemu-action@v1 - name: Build wheels - uses: pypa/cibuildwheel@v2.19.1 + uses: pypa/cibuildwheel@v2.22.0 # to supply options, put them in 'env', like: env: CIBW_ARCHS_LINUX: ${{matrix.arch}} CIBW_BEFORE_BUILD: pip install numpy setuptools wheel cython CIBW_ARCHS_MACOS: "x86_64 arm64" - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: path: ./wheelhouse/*.whl \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bab383a..63e33c3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,7 @@ jobs: run: | python -m pip install --upgrade pip pip install cython numpy setuptools wheel - pip install -r requirements.txt pytest + pip install -r requirements.txt -r requirements-dev.txt pip install -e . - name: Test with pytest run: | diff --git a/automated_test.py b/automated_test.py index a0a653a..788acef 100644 --- a/automated_test.py +++ b/automated_test.py @@ -8,6 +8,11 @@ import kimimaro.skeletontricks from kimimaro.utility import moving_average +@pytest.fixture +def connectomics_data(): + import crackle + return crackle.load("benchmarks/connectomics.npy.ckl.gz") + def test_empty_image(): labels = np.zeros( (256, 256, 256), dtype=bool) skels = kimimaro.skeletonize(labels, fix_borders=True) @@ -502,7 +507,8 @@ def test_moving_average(): assert np.all(res == ans) assert len(ans) == len(data) - +def test_no_fix_branching(connectomics_data): + kimimaro.skeletonize(connectomics_data[:,:,100], fix_branching=False) diff --git a/benchmarks/README.md b/benchmarks/README.md index c03637b..bec2d41 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -1,6 +1,8 @@ Benchmarks ========== +To open `connectomics.npy.ckl.gz` you must use [`crackle-codec`](https://github.com/seung-lab/crackle). + Except where noted, these benchmarks were executed on an 2.8 GHz Dual-Core Intel Core i7 with 1600 MHz DDR3 RAM. The data source used was `connectomics.npy` which can be found in this repository. `connectomics.npy` is a 32-bit 512x512x512 cutout of mouse visual cortex at 16nm x 16nm x 40nm resolution that contains 2124 connected components including a partial cell body and a large glia fragment. Below, we compared the run time and peak memory usage of Kimimaro across many versions that contained performance significant updates. Due to the annoying length of each run, each value represents a single run, so there is some random perturbation around the true mean that can obscure the value of small improvements. Version 0.4.2 can be considered the first "feature complete" version that includes quality improvements like fix_branches, fix_borders, and a reasonable root selected for the cell body. diff --git a/benchmarks/benchmark.py b/benchmarks/benchmark.py index fdfabf0..571c8f0 100644 --- a/benchmarks/benchmark.py +++ b/benchmarks/benchmark.py @@ -1,8 +1,9 @@ import time import numpy as np import kimimaro +import crackle -labels = np.load("connectomics.npy") +labels = crackle.load("connectomics.npy.ckl.gz") s = time.time() skels = kimimaro.skeletonize( diff --git a/benchmarks/connectomics.npy.ckl.gz b/benchmarks/connectomics.npy.ckl.gz new file mode 100644 index 0000000..bceb440 Binary files /dev/null and b/benchmarks/connectomics.npy.ckl.gz differ diff --git a/benchmarks/connectomics.npy.lzma b/benchmarks/connectomics.npy.lzma deleted file mode 100644 index 0488f49..0000000 Binary files a/benchmarks/connectomics.npy.lzma and /dev/null differ diff --git a/kimimaro/trace.py b/kimimaro/trace.py index 62aea79..e41efbe 100644 --- a/kimimaro/trace.py +++ b/kimimaro/trace.py @@ -152,7 +152,7 @@ def trace( # pointers from each voxel to its parent. Then we can rapidly # compute multiple paths by simply hopping pointers using path_from_parents if not fix_branching: - parents = dijkstra3d.parental_field(PDRF, root, voxel_graph) + parents = dijkstra3d.parental_field(PDRF, root, voxel_graph=voxel_graph) del PDRF else: parents = PDRF diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..4536535 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,2 @@ +pytest +crackle-codec \ No newline at end of file