From bbd903391cea261dfa93a8c5d12ff985f99115c6 Mon Sep 17 00:00:00 2001 From: EmmaRenauld Date: Mon, 9 Sep 2024 15:39:50 -0400 Subject: [PATCH] Test compress_sft --- .../tests/test_streamline_operations.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scilpy/tractograms/tests/test_streamline_operations.py b/scilpy/tractograms/tests/test_streamline_operations.py index 914309758..ab82144b2 100644 --- a/scilpy/tractograms/tests/test_streamline_operations.py +++ b/scilpy/tractograms/tests/test_streamline_operations.py @@ -67,8 +67,19 @@ def test_get_streamlines_as_linspaces(): def test_compress_sft(): - # toDo - pass + sft = load_tractogram(in_long_sft, in_ref) + compressed = compress_sft(sft, tol_error=0.01) + assert len(sft) == len(compressed) + + for s, sc in zip(sft.streamlines, compressed.streamlines): + # All streamlines should be shorter once compressed + assert len(sc) <= len(s) + + # Streamlines' endpoints should not be changed + assert np.allclose(s[0], sc[0]) + assert np.allclose(s[-1], sc[-1]) + + # Not testing more than that, as it uses Dipy's method, tested by Dipy def test_cut_invalid_streamlines():