aboutsummaryrefslogtreecommitdiff
path: root/include/lib/seg
diff options
context:
space:
mode:
Diffstat (limited to 'include/lib/seg')
-rw-r--r--include/lib/seg/mask_data.h32
-rw-r--r--include/lib/seg/util.h7
2 files changed, 20 insertions, 19 deletions
diff --git a/include/lib/seg/mask_data.h b/include/lib/seg/mask_data.h
index bbaf38c..91b9074 100644
--- a/include/lib/seg/mask_data.h
+++ b/include/lib/seg/mask_data.h
@@ -5,60 +5,60 @@
#include <lib/data/image_types.h>
#include <lib/monad.h>
-struct MaskData {
+typedef struct MaskData {
ImageMaskData_t label;
size_t area;
size_t perimeter;
-};
+} MaskData;
// Allocate Mask Data for Label
-struct MaskData* create_mask_data(ImageMaskData_t label);
+MaskData* create_mask_data(ImageMaskData_t label);
// Compare mask data labels
-bool_t compare_labels(struct MaskData* left, struct MaskData* right);
+bool_t compare_labels(MaskData* left, MaskData* right);
// Create AVL Mask node
-struct AVLNode* create_avl_mask_node(struct MaskData* data);
+AVLNode* create_avl_mask_node(MaskData* data);
// Insert MaskData into the AVL Tree
-struct Result insert_mask(struct AVLNode* node, struct MaskData* data);
+Result insert_mask(AVLNode* node, MaskData* data);
// Allocate a label's Mask data in a tree
// If it already exists, skip the allocation
-struct AVLNode* insert_mask_alloc(struct AVLNode* node, ImageMaskData_t label);
+AVLNode* insert_mask_alloc(AVLNode* node, ImageMaskData_t label);
// Print AVL Node Mask Data Label
-void print_label(struct AVLNode* root);
+void print_label(AVLNode* root);
// Increase the label's area
-bool_t increase_label_area(struct AVLNode* root, ImageMaskData_t label);
+bool_t increase_label_area(AVLNode* root, ImageMaskData_t label);
// Increase the label's perimeter
-bool_t increase_label_perimeter(struct AVLNode* root, ImageMaskData_t label);
+bool_t increase_label_perimeter(AVLNode* root, ImageMaskData_t label);
// Increase the label's area
// Create an AVL node if it doesn't exist
-struct AVLNode* increase_label_area_alloc(struct AVLNode* root, ImageMaskData_t label);
+AVLNode* increase_label_area_alloc(AVLNode* root, ImageMaskData_t label);
// Increase the label's perimeter
// Create an AVL node if it doesn't exist
-struct AVLNode* increase_label_perimeter_alloc(struct AVLNode* root, ImageMaskData_t label);
+AVLNode* increase_label_perimeter_alloc(AVLNode* root, ImageMaskData_t label);
// Comparison of ImageMaskData_ts
bool_t compare_image_mask_data_t(ImageMaskData_t* s1, ImageMaskData_t* s2);
// In-order traversal print pointer
-void print_in_order_image_mask_data_t(struct AVLNode* root);
+void print_in_order_image_mask_data_t(AVLNode* root);
// Check if ImageMaskData_t in AVLTree with ImageMaskData_t* data
-bool_t in_image_mask_data_t_tree(struct AVLNode* root, ImageMaskData_t value);
+bool_t in_image_mask_data_t_tree(AVLNode* root, ImageMaskData_t 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);
+AVLNode* get_small_labels(AVLNode* removal_tree, AVLNode* label_tree, size_t min_area, size_t min_perimeter);
// Get mask label data
-struct AVLNode* get_mask_data(ImageMaskData_t* masks, uint32_t width, uint32_t height);
+AVLNode* get_mask_data(ImageMaskData_t* masks, uint32_t width, uint32_t height);
// Filter out small masks in mask
void filter_small_masks(ImageMaskData_t* masks, uint32_t width, uint32_t height, size_t min_area, size_t min_perimeter);
diff --git a/include/lib/seg/util.h b/include/lib/seg/util.h
index 395c5cd..88389f6 100644
--- a/include/lib/seg/util.h
+++ b/include/lib/seg/util.h
@@ -2,6 +2,7 @@
#define INC_LIB_SEG_UTIL_H
#include <lib/bool.h>
+#include <lib/png.h>
#include <lib/data/image_types.h>
#include <stdint.h>
#include <stddef.h>
@@ -25,15 +26,15 @@ void closeup(ImageMaskData_t** mask, uint32_t width, uint32_t height, size_t cou
// Combine Label Masks
// For all empty spaces in the destination, put the extra label if it exists
// Allocates an array if destination is unallocated
-struct ImageMask* combine_masks(struct ImageMask *destination, struct ImageMask *extra_labels);
+ImageMask* combine_masks(ImageMask *destination, ImageMask *extra_labels);
// Process Tif File to Labels
// width, height will be overwritten with image dimensions
// starting_label_p will be incremented for each label found in the image
-struct ImageMask* tif_to_labels(char* tif_file_name, uint32_t *width, uint32_t *height, ImageMaskData_t *starting_label_p);
+ImageMask* tif_to_labels(char* tif_file_name, uint32_t *width, uint32_t *height, ImageMaskData_t *starting_label_p);
// Convert mask to bitmap
-struct bitmap_t* image_mask_data_to_bitmap(ImageMaskData_t* buffer, uint32_t width, uint32_t height);
+Bitmap* image_mask_data_to_bitmap(ImageMaskData_t* buffer, uint32_t width, uint32_t height);
// Reduce a mask to the contiguous regions
// Automatically update pointer to contiguous mask