Main Page   Compound List   File List   Compound Members   File Members  

chain_ringwidths.c File Reference

Measures ring widths and brightness profiles. More...

#include <math.h>
#include "junkmath.h"
#include "sadie_byte.h"
#include "sadie_short.h"
#include "chain.h"
#include "mosaic.h"
#include "trees_profile.h"
#include <stdio.h>

Compounds

struct  boundarycontext
struct  BOUNDER
struct  boundpoint
 A point in a temporary temporary ring boundary representation. More...

struct  imagecontext
struct  rbnode
struct  RECTANGLE
 A rectangle aligned with the x and y axes. More...

struct  SUMSTATE
struct  WIDTHS

Defines

#define crashandburn(e)   {fprintf(stderr,"Panic: %s!\n",e) ;exit(-2) ;} \
 Stopgap error handler.

#define INIT_LEN   512
 Initial size of the extensible ring width array.

#define NOT_AN_ANGLE   -HUGE_VAL
 Missing boundary angles and ring widths.

#define TINY   (1e-16)
 Threshold for judging the equality of angles and distances.

#define MISSING_BRIGHTNESS   DARKNESS
 Missing brightness profile value (which may also be a data value).

#define MID_GRAY   ((PIXEL)127.0)
 Median of range of possible brightness values.

#define NCOEFF   4
 Number of polynomial coefficients to derive temporary warped subimages.

#define NPOINTS   4
 Number of control points used to derive temporary warped subimages.

#define MAX_BOUND_ANGLE   (0.45*M_PI)
 Maximum allowed difference between boundary angles from different methods.

#define SEARCH_TOLERANCE   0.35
 Angular interval within which to search for points on a boundary.

#define MATCH_TOLERANCE   0.125
 Tolerance for accepting the angles associated with points as equal.

#define MEASURE_TOLERANCE   0.083333333
 Match the angles associated with points to the line connecting them.

#define SRADIUS   5
 Number of points defining local neighborhoods on boundaries.

#define SUBIMAGE_MARGIN_FRACTION   0.125
 Fractional size of the margin at the edge of the warped subimage.

#define mosaic_point(M, I, R, C)   (M->data[0][R - I->voffset[C]][C])
 Accesses a point in a mosaic image through its index.

#define project_on_principal_axis(P, A, X, Y, Z)
 Projects a point onto the principal axis of a boundary.

#define rb_balance(U, D)
 Help re-balance a red-black tree.

#define make_rotator(U, D)
 Generates either of the two node-rotation functions for a red-black tree.


Typedefs

typedef boundpoint BOUNDPOINT
 A point in a temporary temporary ring boundary representation.


Detailed Description

Measures ring widths and brightness profiles.

We're assuming that all the previous phases of TREES are complete: that it has acquired images, assembled them into a mosaic, and identified the ring boundaries. This has one interface visible to the rest of TREES, the function CHAIN_RINGWIDTHS,

Author:
University of Arizona Digital Image Analysis Lab
Date:
2003
Version:
Id:
chain_ringwidths.c,v 1.14 2003/05/21 00:37:00 mmunro Exp


Define Documentation

#define crashandburn      {fprintf(stderr,"Panic: %s!\n",e) ;exit(-2) ;} \
 

Stopgap error handler.

This doesn't just abort the functions defined in this file, or the thread running them, but the entire process running TREES.

#define make_rotator U,
 
 

Value:

static void \
rb_rotate_##U (RBNODE**root, RBNODE*sub)  \
{ \
  RBNODE * tmp; \
  tmp = sub->D; \
  sub->D = tmp->U; \
  if(tmp->U != NULL)  \
    tmp->U->parent = sub; \
  tmp->parent = sub->parent; \
  if(sub == *root) \
    { \
      *root = tmp; \
    } \
  else if (sub == sub->parent->U) \
    { \
      sub->parent->U = tmp; \
    } \
  else \
    { \
      sub->parent->D = tmp; \
    } \
  tmp->U = sub; \
  sub->parent = tmp; \
} \
Generates either of the two node-rotation functions for a red-black tree.

The two rotations are completely symmetrical, except that the roles of right and left nodes are interchanged, so this macro is a code template for generating either a right or a left rotation (note that the function names are part of what's substituted). A rotation essentially operates on a group of three nodes, initially at three different levels in the tree. Two of the nodes move closer to the root, one in the opposite direction, so we end up with just two levels after the transformation.

Parameters:
U  either right or left.
D  either right or left (but differing from U).
See also:
rb_rebalance

#define MID_GRAY   ((PIXEL)127.0)
 

Median of range of possible brightness values.

This assumes an 8-bit grayscale, and should really be an image-specific variable.

#define mosaic_point M,
I,
R,
     (M->data[0][R - I->voffset[C]][C])
 

Accesses a point in a mosaic image through its index.

Parameters:
M  mosaic image data.
I  mosaic image index.
R  row (y) position.
C  column (x) position.

#define NOT_AN_ANGLE   -HUGE_VAL
 

Missing boundary angles and ring widths.

The values are outside the range possible for actual data.

#define project_on_principal_axis P,
A,
X,
Y,
 
 

Value:

X = P->xpos - A->centroid.xpos; \
  Y = P->ypos - A->centroid.ypos; \
  Z = Y*cos(A->centroid.theta) + X*sin(A->centroid.theta)
Projects a point onto the principal axis of a boundary.

Parameters:
P  the point to project.
A  the boundary with the axis to project it onto.
X  x displacement from boundary centroid.
Y  y displacement from boundary centroid.
Z  distance from centroid to projected position.

#define rb_balance U,
 
 

Value:

tmp = sub->parent->parent->D; \
if((tmp!=NULL) &&(tmp->rbcolor==red) ) \
  { \
    sub->parent->rbcolor = black; \
    tmp->rbcolor = black; \
    sub->parent->parent->rbcolor = red; \
    sub = sub->parent->parent; \
  } \
else \
  { \
    if (sub == sub->parent->D) \
      { \
        sub = sub->parent; \
        rb_rotate_##U (root,sub) ; \
      } \
    sub->parent->rbcolor = black; \
    sub->parent->parent->rbcolor = red; \
    rb_rotate_##D (root, sub->parent->parent) ; \
  } \
Help re-balance a red-black tree.

Re-balancing involves two operations that are completely symmetrical, except that the roles of left and right links are interchanged, so this macro can generate the code for either operation. Rebalancing depends on the parent of the parent of the node being considerd, and the adjustment may be a simple re-coloring of nodes, or it may involve changing their relative positions (with the current node moving closer to the root), in which case we distinguish two sub-cases, depending on whether the current node and its immediate parent change places, before it changes levels.

Parameters:
U  either right or left.
D  either right or left (but differing from U).
See also:
rb_rebalance


Generated on Tue Jun 22 14:32:08 2004 for trees by doxygen1.2.18