# segment.c File Reference

`#include "magick/studio.h"`
`#include "magick/color.h"`
`#include "magick/colorspace.h"`
`#include "magick/exception.h"`
`#include "magick/exception-private.h"`
`#include "magick/image.h"`
`#include "magick/image-private.h"`
`#include "magick/memory_.h"`
`#include "magick/monitor.h"`
`#include "magick/quantize.h"`
`#include "magick/quantum.h"`
`#include "magick/quantum-private.h"`
`#include "magick/segment.h"`
`#include "magick/string_.h"`

## Data Structures

struct | _ExtentPacket
struct | _Cluster
struct | _IntervalTree
struct | _ZeroCrossing

## Defines

#define | MaxDimension 3
#define | DeltaTau 0.5f
#define | WeightingExponent 2.5
#define | SegmentPower(ratio) pow(ratio,(double) (1.0/(weighting_exponent-1.0)));
#define | Tau 5.2f
#define | SegmentImageTag "Segment/Image"

## Typedefs

typedef struct _ExtentPacket | ExtentPacket
typedef struct _Cluster | Cluster
typedef struct _IntervalTree | IntervalTree
typedef struct _ZeroCrossing | ZeroCrossing

## Functions

static MagickRealType | OptimalTau (const long *, const double, const double, const double, const double, short *)
static long | DefineRegion (const short *, ExtentPacket *)
static void | InitializeHistogram (const Image *, long **, ExceptionInfo *)
static void | ScaleSpace (const long *, const MagickRealType, MagickRealType *)
static void | ZeroCrossHistogram (MagickRealType *, const MagickRealType, short *)
static MagickBooleanType | Classify (Image *image, short **extrema, const MagickRealType cluster_threshold, const MagickRealType weighting_exponent, const MagickBooleanType verbose)
static long | MagickAbsoluteValue (const long x)
static long | MagickMax (const long x, const long y)
static long | MagickMin (const long x, const long y)
static void | ConsolidateCrossings (ZeroCrossing *zero_crossing, const unsigned long number_crossings)
static void | DerivativeHistogram (const MagickRealType *histogram, MagickRealType *derivative)
MagickExport MagickPixelPacket | GetImageDynamicThreshold (const Image *image, const double cluster_threshold, const double smooth_threshold, ExceptionInfo *exception)
static void | InitializeList (IntervalTree **list, long *number_nodes, IntervalTree *node)
static void | MeanStability (IntervalTree *node)
static void | Stability (IntervalTree *node)
static IntervalTree * | InitializeIntervalTree (const ZeroCrossing *zero_crossing, const unsigned long number_crossings)
static void | ActiveNodes (IntervalTree **list, long *number_nodes, IntervalTree *node)
static void | FreeNodes (IntervalTree *node)
MagickExport MagickBooleanType | SegmentImage (Image *image, const ColorspaceType colorspace, const MagickBooleanType verbose, const double cluster_threshold, const double smooth_threshold)

## Variables

static const int | Blue = 2
static const int | Green = 1
static const int | Red = 0
static const int | SafeMargin = 3
static const int | TreeLength = 600

## Define Documentation

#define DeltaTau 0.5f

#define MaxDimension 3

#define SegmentImageTag "Segment/Image"

#define SegmentPower | ( | ratio |  | ) | pow(ratio,(double) (1.0/(weighting_exponent-1.0)));

#define Tau 5.2f

#define WeightingExponent 2.5

## Typedef Documentation

typedef struct _Cluster Cluster

typedef struct _ExtentPacket ExtentPacket

typedef struct _IntervalTree IntervalTree

typedef struct _ZeroCrossing ZeroCrossing

## Function Documentation

static void ActiveNodes | ( | IntervalTree ** | list,
|  | long * | number_nodes,
|  | IntervalTree * | node |
| ) |  |  | `[static]`

static MagickBooleanType Classify | ( | Image * | image,
|  | short ** | extrema,
|  | const MagickRealType | cluster_threshold,
|  | const MagickRealType | weighting_exponent,
|  | const MagickBooleanType | verbose |
| ) |  |  | `[static]`

static void ConsolidateCrossings | ( | ZeroCrossing * | zero_crossing,
|  | const unsigned long | number_crossings |
| ) |  |  | `[static]`

static long DefineRegion | ( | const short * | extrema,
|  | ExtentPacket * | extents |
| ) |  |  | `[static]`

static void DerivativeHistogram | ( | const MagickRealType * | histogram,
|  | MagickRealType * | derivative |
| ) |  |  | `[static]`

static void FreeNodes | ( | IntervalTree * | node | ) | `[static]`

MagickExport MagickPixelPacket GetImageDynamicThreshold | ( | const Image * | image,
|  | const double | cluster_threshold,
|  | const double | smooth_threshold,
|  | ExceptionInfo * | exception |
| ) |  |  |

static void InitializeHistogram | ( | const Image * | image,
|  | long ** | histogram,
|  | ExceptionInfo * | exception |
| ) |  |  | `[static]`

static IntervalTree* InitializeIntervalTree | ( | const ZeroCrossing * | zero_crossing,
|  | const unsigned long | number_crossings |
| ) |  |  | `[static]`

static void InitializeList | ( | IntervalTree ** | list,
|  | long * | number_nodes,
|  | IntervalTree * | node |
| ) |  |  | `[static]`

static long MagickAbsoluteValue | ( | const long | x | ) | `[inline, static]`

static long MagickMax | ( | const long | x,
|  | const long | y |
| ) |  |  | `[inline, static]`

static long MagickMin | ( | const long | x,
|  | const long | y |
| ) |  |  | `[inline, static]`

static void MeanStability | ( | IntervalTree * | node | ) | `[static]`

static MagickRealType OptimalTau | ( | const long * | histogram,
|  | const | double,
|  | const | double,
|  | const | double,
|  | const | double,
|  | short * | extrema |
| ) |  |  | `[static]`

static void ScaleSpace | ( | const long * | histogram,
|  | const | MagickRealType,
|  | MagickRealType * | scale_histogram |
| ) |  |  |

MagickExport MagickBooleanType SegmentImage | ( | Image * | image,
|  | const ColorspaceType | colorspace,
|  | const MagickBooleanType | verbose,
|  | const double | cluster_threshold,
|  | const double | smooth_threshold |
| ) |  |  |

static void Stability | ( | IntervalTree * | node | ) | `[static]`

static void ZeroCrossHistogram | ( | MagickRealType * | second_derivative,
|  | const | MagickRealType,
|  | short * | crossings |
| ) |  |  |

## Variable Documentation

const int Blue = 2`[static]`

const int Green = 1`[static]`

const int Red = 0`[static]`

const int SafeMargin = 3`[static]`

const int TreeLength = 600`[static]`