-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d565dae
commit c99fa0b
Showing
9 changed files
with
68 additions
and
2 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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,61 @@ | ||
import pytest | ||
|
||
from ripplemapper.analyse import (add_a_star_contours, add_boundary_contours, | ||
add_chan_vese_contours, remove_small_bumps, | ||
remove_small_bumps_from_images) | ||
|
||
|
||
def test_add_boundary_contours(loaded_example_image): | ||
add_boundary_contours(loaded_example_image) | ||
assert len(loaded_example_image.contours) == 2 | ||
assert loaded_example_image.contours[0].method == 'Upper Boundary' | ||
assert loaded_example_image.contours[1].method == 'Lower Boundary' | ||
|
||
def test_add_a_star_contours(loaded_example_image): | ||
add_boundary_contours(loaded_example_image) | ||
add_a_star_contours(loaded_example_image) | ||
assert len(loaded_example_image.contours) == 3 | ||
assert loaded_example_image.contours[2].method == 'A* traversal' | ||
|
||
def test_add_chan_vese_contours(loaded_example_image): | ||
add_chan_vese_contours(loaded_example_image) | ||
assert len(loaded_example_image.contours) == 1 | ||
assert loaded_example_image.contours[0].method == 'Chan-Vese' | ||
|
||
def test_remove_small_bumps(loaded_example_contour): | ||
smoothed_contour = remove_small_bumps(loaded_example_contour) | ||
assert smoothed_contour.values.shape[1] <= loaded_example_contour.values.shape[1] | ||
|
||
def test_remove_small_bumps_from_images(loaded_example_image): | ||
add_boundary_contours(loaded_example_image) | ||
remove_small_bumps_from_images(loaded_example_image) | ||
assert len(loaded_example_image.contours) == 2 | ||
|
||
def test_add_boundary_contours_image_series(loaded_example_image_series): | ||
add_boundary_contours(loaded_example_image_series) | ||
for image in loaded_example_image_series.images: | ||
assert len(image.contours) == 2 | ||
assert image.contours[0].method == 'Upper Boundary' | ||
assert image.contours[1].method == 'Lower Boundary' | ||
|
||
def test_add_a_star_contours_image_series(loaded_example_image_series): | ||
add_boundary_contours(loaded_example_image_series) | ||
add_a_star_contours(loaded_example_image_series) | ||
for image in loaded_example_image_series.images: | ||
assert len(image.contours) == 3 | ||
assert image.contours[2].method == 'A* traversal' | ||
|
||
def test_add_chan_vese_contours_image_series(loaded_example_image_series): | ||
add_chan_vese_contours(loaded_example_image_series) | ||
for image in loaded_example_image_series.images: | ||
assert len(image.contours) == 1 | ||
assert image.contours[0].method == 'Chan-Vese' | ||
|
||
def test_remove_small_bumps_from_image_series(loaded_example_image_series): | ||
add_boundary_contours(loaded_example_image_series) | ||
remove_small_bumps_from_images(loaded_example_image_series) | ||
for image in loaded_example_image_series.images: | ||
assert len(image.contours) == 2 | ||
|
||
if __name__ == '__main__': | ||
pytest.main() |