/**
 * \file segmentation.h
 * \brief Header for segmentation.c
 *
 *
 *  \ingroup corefiles
 * \date Jun 3, 2009
 * \author Alexander Pimenov
 */

#ifndef SEGMENTATION_H_
#define SEGMENTATION_H_
#ifdef __cplusplus
	extern "C" {
#endif

#include "g12buffer.h"
#include "datatypes.h"

#define NO_PARENT ((uint32_t)-1)

/**
 * \brief This structure describes the segment in the segmented image
 *
 *
 */
typedef struct Segment_TAG {
	int count;   /**< \brief the size of the segment in pixels*/
	int sumx;    /**< \brief the sum of all the x coordinates. sumx/count will give the x-coordiante of the center */
	int sumy;    /**< \brief the sum of all the y coordinates. sumy/count will give the y-coordiante of the center */
	double weightx;
	double weighty;
	uint32_t parent; /**< \brief the parent segment. This is used to merge segments in one-path segmentation algorithms. */
} Segment;


VECTOR_GENERIC_PROTOTYPE(Segment);

typedef vector_Segment *segmentList;

segmentList getPoints(G12Buffer *buf, int threshold);
segmentList filterCloseSegments(segmentList segments, int distance);

#ifdef __cplusplus
	} // 	extern "C"
#endif
#endif /* SEGMENTATION_H_ */
