Commit f61d9c41 authored by Baptiste Esteban's avatar Baptiste Esteban
Browse files

Add a test for the MToS function

parent 2fcf9e57
...@@ -65,6 +65,29 @@ static mln::image2d<std::uint16_t> depth_map_ref = { ...@@ -65,6 +65,29 @@ static mln::image2d<std::uint16_t> depth_map_ref = {
{3, 2, 3, 1, 1, 1, 3, 2, 3}, // {3, 2, 3, 1, 1, 1, 3, 2, 3}, //
}; };
static std::vector<int> parent_ref = {-1, 0, 1, 1, 3, 3, 3, 3, 3, 3, 1, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 21, 21, 10};
static mln::image2d<int> nodemap_ref = {
{0, 0, 0, 0, 2, 1, 1, 1, 4, 3, 3, 3, 6, 3, 3, 3, 7}, //
{0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3}, //
{0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3}, //
{0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3}, //
{23, 1, 1, 1, 1, 1, 1, 1, 8, 3, 3, 3, 3, 3, 3, 3, 9}, //
{21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3}, //
{21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3}, //
{21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3}, //
{22, 21, 21, 21, 21, 1, 1, 1, 1, 1, 1, 1, 11, 1, 1, 1, 3}, //
{21, 10, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1}, //
{21, 10, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1}, //
{21, 10, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1}, //
{21, 10, 10, 10, 19, 10, 10, 10, 10, 10, 10, 10, 12, 10, 10, 10, 14}, //
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, //
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, //
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, //
{20, 10, 10, 10, 17, 10, 10, 10, 10, 10, 10, 10, 16, 10, 10, 10, 18}, //
};
TEST(Morpho, GoS) TEST(Morpho, GoS)
{ {
mln::morpho::component_tree<> trees[3]; mln::morpho::component_tree<> trees[3];
...@@ -112,29 +135,6 @@ TEST(Morpho, DepthMap) ...@@ -112,29 +135,6 @@ TEST(Morpho, DepthMap)
TEST(Morpho, Satmaxtree) TEST(Morpho, Satmaxtree)
{ {
std::vector<int> parent_ref = {-1, 0, 1, 1, 3, 3, 3, 3, 3, 3, 1, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 21, 21, 10};
mln::image2d<int> nodemap_ref = {
{0, 0, 0, 0, 2, 1, 1, 1, 4, 3, 3, 3, 6, 3, 3, 3, 7}, //
{0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3}, //
{0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3}, //
{0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3}, //
{23, 1, 1, 1, 1, 1, 1, 1, 8, 3, 3, 3, 3, 3, 3, 3, 9}, //
{21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3}, //
{21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3}, //
{21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3}, //
{22, 21, 21, 21, 21, 1, 1, 1, 1, 1, 1, 1, 11, 1, 1, 1, 3}, //
{21, 10, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1}, //
{21, 10, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1}, //
{21, 10, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 10, 1, 1, 1, 1}, //
{21, 10, 10, 10, 19, 10, 10, 10, 10, 10, 10, 10, 12, 10, 10, 10, 14}, //
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, //
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, //
{10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, //
{20, 10, 10, 10, 17, 10, 10, 10, 10, 10, 10, 10, 16, 10, 10, 10, 18}, //
};
// Test satmaxtree computation from depth map // Test satmaxtree computation from depth map
auto [t, nm] = mln::morpho::details::satmaxtree(depth_map_ref, {0, 0}); auto [t, nm] = mln::morpho::details::satmaxtree(depth_map_ref, {0, 0});
...@@ -145,3 +145,13 @@ TEST(Morpho, Satmaxtree) ...@@ -145,3 +145,13 @@ TEST(Morpho, Satmaxtree)
ASSERT_IMAGES_EQ_EXP(nm, nodemap_ref); ASSERT_IMAGES_EQ_EXP(nm, nodemap_ref);
} }
TEST(Morpho, MToS)
{
auto [t, nm] = mln::morpho::mtos(input, {0, 0});
for (int i = 0; i < (int)parent_ref.size(); i++)
ASSERT_EQ(t.parent[i], parent_ref[i]);
ASSERT_IMAGES_EQ_EXP(nm, nodemap_ref);
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment