Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson committed Dec 15, 2023
2 parents a2b6f2c + b009106 commit 03f1c2d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/tests/test_IO/test_surfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@

from skimage import measure
from skimage.draw import ellipsoid

from brainglobe_utils.IO.surfaces import marching_cubes_to_obj

test_obj = (
Path(__file__).parent.parent.parent / "data" / "IO" / "obj" / "test.obj"
)


test_obj = Path(__file__).parent.parent.parent / "data" / "IO"/ "obj" / "test.obj"
def compare_text_files(a, b):
with open(a, 'r') as file1:
with open(a, "r") as file1:
a_contents = file1.readlines()
with open(b, 'r') as file2:
with open(b, "r") as file2:
b_contents = file2.readlines()
assert a_contents == b_contents


def test_marching_cubes_to_obj(tmp_path):

output_file = tmp_path / "test.obj"
ellip_base = ellipsoid(6, 10, 16, levelset=True)
marching_cubes_out = measure.marching_cubes(ellip_base, 0)
marching_cubes_to_obj(marching_cubes_out, output_file)
compare_text_files(output_file, test_obj)
compare_text_files(output_file, test_obj)

0 comments on commit 03f1c2d

Please sign in to comment.