// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #include #include "../image_analysis/spot_finding/SpotUtils.h" TEST_CASE("FilterSpuriousHighResolutionSpots") { std::vector spots; spots.push_back(SpotToSave{.x = 1, .y = 2, .intensity = 3, .d_A = 18.0, .indexed = false}); spots.push_back(SpotToSave{.x = 1, .y = 2, .intensity = 3, .d_A = 20.0, .indexed = false}); spots.push_back(SpotToSave{.x = 1, .y = 2, .intensity = 3, .d_A = 30.0, .indexed = false}); spots.push_back(SpotToSave{.x = 1, .y = 2, .intensity = 3, .d_A = 6.0, .indexed = false}); spots.push_back(SpotToSave{.x = 1, .y = 2, .intensity = 3, .d_A = 2.0, .indexed = false}); spots.push_back(SpotToSave{.x = 1, .y = 2, .intensity = 3, .d_A = 1.9, .indexed = false}); spots.push_back(SpotToSave{.x = 1, .y = 2, .intensity = 3, .d_A = 1.3, .indexed = false}); FilterSpuriousHighResolutionSpots(spots, 1.57); // roughly 0.25 in 1/d REQUIRE(spots.size() == 4); // Spots are sorted by resolution CHECK(spots[0].d_A == Catch::Approx(30.0)); CHECK(spots[1].d_A == Catch::Approx(20.0)); CHECK(spots[2].d_A == Catch::Approx(18.0)); CHECK(spots[3].d_A == Catch::Approx(6.0)); }