diff options
author | Christian C <cc@localhost> | 2025-03-05 20:18:59 -0800 |
---|---|---|
committer | Christian C <cc@localhost> | 2025-03-05 20:18:59 -0800 |
commit | 9389fa47a068c167b8074d082fb3bdbeec79bdff (patch) | |
tree | 2e7123bc8cf45ce53005fc5d38ebf9b5849997d3 /src/lib/seg/mask_data.c | |
parent | 5b3cb257506f3fbe8c5ad3ea8aedb87d51e4c87c (diff) |
Filter small labels
Diffstat (limited to 'src/lib/seg/mask_data.c')
-rw-r--r-- | src/lib/seg/mask_data.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/seg/mask_data.c b/src/lib/seg/mask_data.c index 2ff58a8..2f3a51a 100644 --- a/src/lib/seg/mask_data.c +++ b/src/lib/seg/mask_data.c @@ -190,6 +190,21 @@ void print_in_order_uint16_t(struct AVLNode* root) } } +// Check if uint16_t in AVLTree with uint16_t* data +bool_t in_uint16_t_tree(struct AVLNode* root, uint16_t value) +{ + if (root == NULL) { + return FALSE; + } + if (*((uint16_t*)root->data) == value) { + return TRUE; + } else if (value < *((uint16_t*)root->data)) { + return in_uint16_t_tree(root->left, value); + } else { + return in_uint16_t_tree(root->right, value); + } +} + // Filter out small masks // Assumption: Contiguous labeling struct AVLNode* get_small_labels(struct AVLNode* removal_tree, struct AVLNode* label_tree, size_t min_area, size_t min_perimeter) |