diff options
Diffstat (limited to 'src/lib')
-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) |