-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Hekstra-Lab/mac-build
add a real build step to tests + test on mac + win
- Loading branch information
Showing
15 changed files
with
904 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import numpy as np | ||
from skimage.draw import random_shapes | ||
from skimage.segmentation import relabel_sequential | ||
|
||
from fast_overlap import overlap, overlap_parallel | ||
|
||
im_shape = (1024, 1024) | ||
min_shapes = 5 | ||
im1 = random_shapes(im_shape, 20, min_shapes=min_shapes, random_seed=0)[0] | ||
im1 = relabel_sequential(im1.sum(axis=-1))[0] | ||
im2 = random_shapes(im_shape, 20, min_shapes=min_shapes, random_seed=1995)[0] | ||
im2 = relabel_sequential(im2.sum(axis=-1))[0] | ||
shape = (int(np.max(im1) + 1), int(np.max(im2) + 1)) | ||
out = overlap_parallel(im1.astype(np.int32), im2.astype(np.int32), shape) | ||
print(out.sum()) | ||
out_serial = overlap(im1.astype(np.int32), im2.astype(np.int32), shape) | ||
|
||
# from IPython import embed | ||
# embed(colors="Linux") | ||
assert np.all(out == out_serial) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import fast_overlap | ||
|
||
print(fast_overlap.__version__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from pathlib import Path | ||
|
||
import numpy as np | ||
|
||
import fast_overlap | ||
|
||
ims = np.load(str(Path(__file__).parent / "test-ims.npy")) | ||
expected = np.load(str(Path(__file__).parent / "expected-overlap.npy")) | ||
shape = (int(np.max(ims[0]) + 1), int(np.max(ims[1]) + 1)) | ||
|
||
|
||
def test_overlap(): | ||
out = fast_overlap.overlap(ims[0].astype(np.int32), ims[1].astype(np.int32), shape) | ||
assert np.all(out == expected) | ||
|
||
|
||
def test_parallel_overlap(): | ||
out = fast_overlap.overlap_parallel( | ||
ims[0].astype(np.int32), ims[1].astype(np.int32), shape | ||
) | ||
assert np.all(out == expected) |