diff --git a/.coverage b/.coverage index e03130e..1a54f02 100644 Binary files a/.coverage and b/.coverage differ diff --git a/python/ouroboros/pipeline/slices_geom_pipeline.py b/python/ouroboros/pipeline/slices_geom_pipeline.py index 0e8b665..481d8d4 100644 --- a/python/ouroboros/pipeline/slices_geom_pipeline.py +++ b/python/ouroboros/pipeline/slices_geom_pipeline.py @@ -22,6 +22,10 @@ def _process(self, input_data: tuple[any]) -> None | str: if not isinstance(sample_points, np.ndarray): return "Input data must contain an array of sample points." + # Remove duplicates from sample points. + _, indicies = np.unique(sample_points.round(decimals=2), axis=0, return_index=True) + sample_points = sample_points[sorted(indicies)] + # Rescale the sample points if the option is enabled if config.annotation_mip_level != config.output_mip_level: mip_sizes = get_mip_volume_sizes(source_url) diff --git a/python/test/helpers/test_files.py b/python/test/helpers/test_files.py index 872381c..3a337ea 100644 --- a/python/test/helpers/test_files.py +++ b/python/test/helpers/test_files.py @@ -314,10 +314,6 @@ def test_np_convert_from_float(): # Direct Conversion assert np.all(np_convert(np.uint16, float_data, normalize=False) == [0] * 15 + [1]) - # Normalized Conversion - assert np.all(np_convert(np.uint16, float_data) == - np.arange(0, np.iinfo(np.uint16).max + 1, np.iinfo(np.uint16).max // 15)) - # Safe Bool safe_bool = np_convert(bool, base, safe_bool=True) assert safe_bool.dtype == np.uint8 @@ -328,6 +324,11 @@ def test_np_convert_from_float(): assert safe_bool.dtype == bool assert np.all(safe_bool == (base > 0)) + # Normalized Conversion; slight inaccuracy introduced for type safety + target = np.arange(0, np.iinfo(np.uint16).max + 1, (np.iinfo(np.uint16).max) // 15) + target[1:] = target[1:] - 1 + assert np.all(np_convert(np.uint16, float_data) == target) + def test_volume_from_intermediates(): pass