Skip to content

Commit

Permalink
rm length -1 flag, + px_2_nm value, adjusts some output skeletons
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGamill-Sheffield committed Oct 9, 2024
1 parent bf5f392 commit 6be2ec7
Showing 1 changed file with 55 additions and 59 deletions.
114 changes: 55 additions & 59 deletions tests/tracing/test_pruning.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,24 @@
[
pytest.param(
"skeleton_loop1",
-1,
49,
90,
"min",
"abs",
np.asarray([[6, 33], [34, 18], [89, 29], [104, 77], [109, 105]]),
np.asarray(
[
[43, 50],
[43, 51],
[43, 52],
[43, 53],
[43, 54],
[44, 55],
[45, 56],
[46, 57],
[47, 58],
[48, 59],
[49, 60],
[49, 61],
[49, 62],
[50, 60],
Expand All @@ -59,6 +70,7 @@
[58, 71],
[59, 58],
[59, 72],
[60, 58],
[60, 59],
[60, 73],
[61, 60],
Expand Down Expand Up @@ -166,14 +178,15 @@
[102, 102],
[102, 103],
[102, 104],
[102, 105],
]
),
id="skeleton loop 1",
# marks=pytest.mark.skip(),
),
pytest.param(
"skeleton_loop2",
-1,
37.8,
90,
"min",
"abs",
Expand Down Expand Up @@ -405,7 +418,7 @@
),
pytest.param(
"skeleton_linear1",
-1,
42,
90,
"min",
"abs",
Expand All @@ -421,7 +434,9 @@
[10, 119],
[11, 114],
[11, 120],
[11, 121],
[12, 114],
[12, 121],
[13, 114],
[14, 113],
[15, 112],
Expand All @@ -432,6 +447,7 @@
[20, 107],
[21, 107],
[22, 106],
[22, 107],
[23, 105],
[24, 31],
[24, 104],
Expand Down Expand Up @@ -517,8 +533,10 @@
[53, 70],
[53, 71],
[53, 78],
[54, 36],
[54, 67],
[54, 79],
[55, 35],
[55, 36],
[55, 66],
[55, 80],
Expand Down Expand Up @@ -558,14 +576,28 @@
[64, 43],
[64, 50],
[64, 84],
[65, 43],
[65, 44],
[65, 45],
[65, 46],
[65, 47],
[65, 48],
[65, 49],
[65, 84],
[66, 31],
[66, 32],
[66, 33],
[66, 34],
[66, 35],
[66, 36],
[66, 37],
[66, 38],
[66, 39],
[66, 40],
[66, 41],
[66, 42],
[66, 84],
[67, 30],
[67, 84],
[68, 85],
[69, 85],
Expand Down Expand Up @@ -619,7 +651,7 @@
),
pytest.param(
"skeleton_linear2",
-1,
10,
90,
"min",
"abs",
Expand Down Expand Up @@ -717,7 +749,7 @@
),
pytest.param(
"skeleton_linear3",
-1,
31,
90,
"min",
"abs",
Expand All @@ -740,8 +772,12 @@
),
np.asarray(
[
[15, 62],
[15, 63],
[16, 63],
[17, 63],
[17, 82],
[17, 83],
[18, 62],
[18, 83],
[19, 62],
Expand Down Expand Up @@ -776,8 +812,10 @@
[33, 82],
[34, 62],
[34, 81],
[34, 109],
[35, 62],
[35, 80],
[35, 109],
[36, 62],
[36, 79],
[37, 63],
Expand Down Expand Up @@ -912,7 +950,7 @@
),
pytest.param(
"pruning_skeleton",
-1,
10,
90,
"min",
"abs",
Expand Down Expand Up @@ -974,6 +1012,7 @@ def topostats_pruner(
return topostatsPrune(
img_skeleton["img"],
img_skeleton["skeleton"],
1,
max_length,
height_threshold,
method_values,
Expand Down Expand Up @@ -1098,50 +1137,6 @@ def test_prune_by_length(
id="Pruning by length and height disabled",
# marks=pytest.mark.skip(),
),
pytest.param(
"pruning_skeleton",
-1,
None,
"min",
"abs",
np.asarray(
[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
],
dtype=np.uint8,
),
id="Prune by default length pruning enabled (15% of overall length) removes branch",
# marks=pytest.mark.skip(),
),
pytest.param(
"pruning_skeleton",
25,
Expand All @@ -1153,8 +1148,8 @@ def test_prune_by_length(
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
Expand Down Expand Up @@ -1183,7 +1178,7 @@ def test_prune_by_length(
],
dtype=np.uint8,
),
id="Length pruning enabled (25) removes everything!?!? Do we need a sanity check for this?",
id="Length pruning enabled (25) removes everything bar the branching node.",
# marks=pytest.mark.skip(),
),
pytest.param(
Expand Down Expand Up @@ -1360,7 +1355,7 @@ def test_prune_by_length(
dtype=np.uint8,
),
id="Height pruning based on minimum, height threshold mean - threshold (1.0e-19) difference",
marks=pytest.mark.skip(),
# marks=pytest.mark.skip(),
),
pytest.param(
"pruning_skeleton",
Expand Down Expand Up @@ -1425,6 +1420,7 @@ def topostats_pruner(
return topostatsPrune(
img_skeleton["img"],
img_skeleton["skeleton"],
1,
max_length,
height_threshold,
method_values,
Expand Down Expand Up @@ -1504,7 +1500,7 @@ def test_prune_skeleton(
]
),
},
-1,
10,
9,
"min",
"abs",
Expand Down Expand Up @@ -1602,7 +1598,7 @@ def test_prune_skeleton(
]
),
},
-1,
10,
9,
"min",
"abs",
Expand Down Expand Up @@ -1708,7 +1704,7 @@ def test_prune_skeleton(
]
),
},
-1,
10,
9,
"min",
"abs",
Expand Down Expand Up @@ -1827,7 +1823,7 @@ def test_prune_skeleton(
]
),
},
-1,
10,
10,
"min",
"abs",
Expand Down Expand Up @@ -1955,7 +1951,7 @@ def test_prune_skeleton(
]
),
},
-1,
10,
9,
"min",
"abs",
Expand Down

0 comments on commit 6be2ec7

Please sign in to comment.