aboutsummaryrefslogtreecommitdiff
path: root/include/lib
diff options
context:
space:
mode:
Diffstat (limited to 'include/lib')
-rw-r--r--include/lib/color.h4
-rw-r--r--include/lib/monad.h2
-rw-r--r--include/lib/seg/mask_data.h6
-rw-r--r--include/lib/seg/util.h11
-rw-r--r--include/lib/time.h2
5 files changed, 19 insertions, 6 deletions
diff --git a/include/lib/color.h b/include/lib/color.h
index 5e7128b..1bc9393 100644
--- a/include/lib/color.h
+++ b/include/lib/color.h
@@ -7,11 +7,11 @@
// Color Equal to Background
// Background: zeros in RGB, alpha can be whatever
-bool_t color_zero(uint8_t* color1, size_t channels);
+bool_t color_zero(const uint8_t* color1, size_t channels);
// Color Equality
// Determine if two colors are identical
-bool_t color_equal(uint8_t* color1, uint8_t* color2, size_t channels);
+bool_t color_equal(const uint8_t* color1, const uint8_t* color2, size_t channels);
// Print out the `channels` length color vector
void print_color(uint8_t* color, size_t channels);
diff --git a/include/lib/monad.h b/include/lib/monad.h
index 4a68e0a..74db079 100644
--- a/include/lib/monad.h
+++ b/include/lib/monad.h
@@ -1,6 +1,8 @@
#ifndef INC_LIB_MONAD_H
#define INC_LIB_MONAD_H
+#include <lib/bool.h>
+
struct Result {
void* data;
bool_t success;
diff --git a/include/lib/seg/mask_data.h b/include/lib/seg/mask_data.h
index f2803e6..8e2ae3a 100644
--- a/include/lib/seg/mask_data.h
+++ b/include/lib/seg/mask_data.h
@@ -56,4 +56,10 @@ bool_t in_uint16_t_tree(struct AVLNode* root, uint16_t value);
// Assumption: Contiguous labeling
struct AVLNode* get_small_labels(struct AVLNode* removal_tree, struct AVLNode* label_tree, size_t min_area, size_t min_perimeter);
+// Get mask label data
+struct AVLNode* get_mask_data(uint16_t* masks, uint32_t width, uint32_t height);
+
+// Filter out small masks in mask
+void filter_small_masks(uint16_t* masks, uint32_t width, uint32_t height, size_t min_area, size_t min_perimeter);
+
#endif
diff --git a/include/lib/seg/util.h b/include/lib/seg/util.h
index fcafff6..c54b0e0 100644
--- a/include/lib/seg/util.h
+++ b/include/lib/seg/util.h
@@ -13,13 +13,13 @@ size_t xy_to_coord(size_t x, size_t y, uint32_t width, uint32_t height);
bool_t is_on_mask_boundary(uint16_t* mask, uint32_t width, uint32_t height, size_t x, size_t y);
// Dilate masks by one 4-connected pixel
-uint16_t* dilate(uint16_t* mask, uint32_t width, uint32_t height);
+void dilate(uint16_t** mask, uint32_t width, uint32_t height);
// Erode masks by one 4-connected pixel
-uint16_t* erode(uint16_t* mask, uint32_t width, uint32_t height);
+void erode(uint16_t** mask, uint32_t width, uint32_t height);
// Close up masks by N-pixels
-uint16_t* closeup(uint16_t* mask, uint32_t width, uint32_t height, size_t count);
+void closeup(uint16_t** mask, uint32_t width, uint32_t height, size_t count);
// Combine Label Masks
// For all empty spaces in the destination, put the extra label if it exists
@@ -34,4 +34,9 @@ uint16_t* tif_to_labels(char* tif_file_name, uint32_t *width, uint32_t *height,
// Convert mask to bitmap
struct bitmap_t* uint16_to_bitmap(uint16_t* buffer, uint32_t width, uint32_t height);
+// Reduce a mask to the contiguous regions
+// Automatically update pointer to contiguous mask
+// Freeing previous mask
+void reduce_contiguous_regions(uint16_t** masks_p, uint32_t width, uint32_t height, uint16_t* total_labels);
+
#endif
diff --git a/include/lib/time.h b/include/lib/time.h
index 9d69b44..1adf428 100644
--- a/include/lib/time.h
+++ b/include/lib/time.h
@@ -7,7 +7,7 @@
// Difference in Time
// Compute the difference between timespec structs
-double diff_time(struct timespec *time1, struct timespec *time0);
+double diff_time(const struct timespec *time1, const struct timespec *time0);
// Get Current Time
void get_time(struct timespec *ts);