amitk_point

## amitk_point amitk_point |

## Synopsis

    enum                AmitkView;
    enum                AmitkAxis;
    enum                AmitkDim;
    enum                AmitkLengthUnit;
    #define             AMITK_TYPE_POINT
    #define             AMITK_TYPE_VOXEL
    #define             AMITK_TYPE_PIXEL
    #define             AMITK_TYPE_CANVAS_POINT
    #define             AMITK_TYPE_AXES
                        AmitkPoint;
                        AmitkVoxel;
                        AmitkPixel;
                        AmitkCanvasPoint;
    GType               amitk_point_get_type                (void);
    AmitkPoint*         amitk_point_copy                    (const AmitkPoint *point);
    void                amitk_point_free                    (AmitkPoint *point);
    AmitkPoint          amitk_point_read_xml                (xmlNodePtr nodes,
                                                             gchar *descriptor,
                                                             gchar **perror_buf);
    void                amitk_point_write_xml               (xmlNodePtr node,
                                                             gchar *descriptor,
                                                             AmitkPoint point);
    GType               amitk_voxel_get_type                (void);
    AmitkVoxel*         amitk_voxel_copy                    (const AmitkVoxel *voxel);
    void                amitk_voxel_free                    (AmitkVoxel *voxel);
    AmitkVoxel          amitk_voxel_read_xml                (xmlNodePtr nodes,
                                                             gchar *descriptor,
                                                             gchar **perror_buf);
    void                amitk_voxel_write_xml               (xmlNodePtr node,
                                                             gchar *descriptor,
                                                             AmitkVoxel voxel);
    GType               amitk_pixel_get_type                (void);
    AmitkPixel*         amitk_pixel_copy                    (const AmitkPixel *pixel);
    void                amitk_pixel_free                    (AmitkPixel *pixel);
    GType               amitk_canvas_point_get_type         (void);
    AmitkCanvasPoint*   amitk_canvas_point_copy             (const AmitkCanvasPoint *point);
    void                amitk_canvas_point_free             (AmitkCanvasPoint *point);
    typedef             AmitkAxes;
    GType               amitk_axes_get_type                 (void);
    AmitkAxes*          amitk_axes_copy                     (const AmitkAxes *axes);
    void                amitk_axes_free                     (AmitkAxes *axes);
    void                amitk_axes_copy_in_place            (AmitkAxes dest_axes,
                                                             const AmitkAxes src_axes);
    void                amitk_axes_transpose                (AmitkAxes axes);
    void                amitk_axes_mult                     (const AmitkAxes const_axes1,
                                                             const AmitkAxes const_axes2,
                                                             AmitkAxes dest_axes);
    void                amitk_axes_make_orthonormal         (AmitkAxes axes);
    void                amitk_axes_rotate_on_vector         (AmitkAxes axes,
                                                             AmitkPoint vector,
                                                             amide_real_t theta);
    AmitkPoint          amitk_axes_get_orthogonal_axis      (const AmitkAxes axes,
                                                             const AmitkView which_view,
                                                             const AmitkLayout which_layout,
                                                             const AmitkAxis which_axis);
    AmitkPoint          amitk_axes_get_normal_axis          (const AmitkAxes axes,
                                                             const AmitkView which_view);
    typedef             AmitkCorners;
    GType               amitk_corners_get_type              (void);
    void                amitk_corners_free                  (AmitkCorners *corners);
    AmitkCorners*       amitk_corners_copy                  (const AmitkCorners *corners);
    #define             EPSILON
    #define             CLOSE
    #define             EMPTY
    #define             SIGMA_TO_FWHM
    #define             SIGMA_TO_FWTM
    #define             REAL_EQUAL                          (x,y)
    #define             EQUAL_ZERO                          (fp1)
    #define             REAL_CLOSE                          (x,y)
    #define             POINT_EQUAL                         (point1,point2)
    #define             VOXEL_EQUAL                         (voxel1,voxel2)
    #define             VOXEL_TO_POINT                      (vox, vox_size, real)
    #define             POINT_TO_VOXEL                      (real, vox_size, frame, gate, vox)
    #define             VOXEL_CORNER                        (vox, vox_size, corner)
    #define             POINT_MAX                           (point1)
    #define             POINT_DOT_PRODUCT                   (point1,point2)
    #define             POINT_MAGNITUDE                     (point)
    #define             POINT_ABS                           (point1,point2)
    #define             POINT_ADD                           (point1,point2,point3)
    #define             POINT_SUB                           (point1,point2,point3)
    #define             POINT_MULT                          (point1,point2,point3)
    #define             POINT_DIV                           (point1,point2,point3)
    #define             POINT_DIFF                          (point1,point2,point3)
    #define             POINT_CMULT                         (cm,point1,point3)
    #define             POINT_CROSS_PRODUCT                 (point1, point2, point3)
    #define             POINT_MADD                          (cm,point1,dm,point2,point3)
    AmitkPoint          canvas_point_2_point                (AmitkPoint volume_corner,
                                                             gint width,
                                                             gint height,
                                                             gdouble x_offset,
                                                             gdouble y_offset,
                                                             AmitkCanvasPoint canvas_cpoint);
    AmitkCanvasPoint    point_2_canvas_point                (AmitkPoint volume_corner,
                                                             gint width,
                                                             gint height,
                                                             gdouble x_offset,
                                                             gdouble y_offset,
                                                             AmitkPoint canvas_point);
    void                voxel_print                         (gchar *message,
                                                             const AmitkVoxel voxel);
    amide_intpoint_t    voxel_get_dim                       (const AmitkVoxel voxel,
                                                             const AmitkDim which_dim);
    void                voxel_set_dim                       (AmitkVoxel *voxel,
                                                             const AmitkDim which_dim,
                                                             amide_intpoint_t value);
    void                point_print                         (gchar *message,
                                                             const AmitkPoint point);
    AmitkPoint          point_rotate_on_vector              (const AmitkPoint in,
                                                             const AmitkPoint vector,
                                                             const amide_real_t theta);
    amide_real_t        point_get_component                 (const AmitkPoint point,
                                                             const AmitkAxis which_axis);
    void                point_set_component                 (AmitkPoint *point,
                                                             const AmitkAxis which_axis,
                                                             const amide_real_t value);
    extern              const AmitkPoint zero_point;
    #define             ONE_POINT
    extern              const AmitkPoint one_point;
    extern              const AmitkPoint ten_point;
    extern              const AmitkVoxel zero_voxel;
    #define             ONE_VOXEL
    extern              const AmitkVoxel one_voxel;
    extern              const AmitkAxes base_axes;
    const gchar*        amitk_view_get_name                 (const AmitkView view);
    const gchar*        amitk_dim_get_name                  (const AmitkDim dim);
    const gchar*        amitk_axis_get_name                 (const AmitkAxis axis);
    const gchar*        amitk_length_unit_get_name          (const AmitkLengthUnit length_unit);

## Description

## Details

### enum AmitkView

    typedef enum {
      AMITK_VIEW_TRANSVERSE,
      AMITK_VIEW_CORONAL,
      AMITK_VIEW_SAGITTAL,
      AMITK_VIEW_NUM
    } AmitkView;

### enum AmitkAxis

    typedef enum {
      AMITK_AXIS_X,
      AMITK_AXIS_Y,
      AMITK_AXIS_Z,
      AMITK_AXIS_NUM
    } AmitkAxis;

### enum AmitkDim

    typedef enum {
      AMITK_DIM_X,
      AMITK_DIM_Y,
      AMITK_DIM_Z,
      AMITK_DIM_G,
      AMITK_DIM_T,
      AMITK_DIM_NUM
    } AmitkDim;

### enum AmitkLengthUnit

    typedef enum {
      AMITK_LENGTH_UNIT_MM,
      AMITK_LENGTH_UNIT_CM,
      AMITK_LENGTH_UNIT_M,
      AMITK_LENGTH_UNIT_INCHES,
      AMITK_LENGTH_UNIT_FEET,
      AMITK_LENGTH_UNIT_NUM
    } AmitkLengthUnit;

### AMITK_TYPE_POINT

    #define	AMITK_TYPE_POINT		(amitk_point_get_type ())

### AMITK_TYPE_VOXEL

    #define AMITK_TYPE_VOXEL                (amitk_voxel_get_type ())

### AMITK_TYPE_PIXEL

    #define AMITK_TYPE_PIXEL                (amitk_pixel_get_type ())

### AMITK_TYPE_CANVAS_POINT

    #define AMITK_TYPE_CANVAS_POINT         (amitk_canvas_point_get_type ())

### AMITK_TYPE_AXES

    #define AMITK_TYPE_AXES                 (amitk_axes_get_type ())

### AmitkPoint

    typedef struct {
      amide_real_t x;
      amide_real_t y;
      amide_real_t z;
    } AmitkPoint;

### AmitkVoxel

    typedef struct {
      amide_intpoint_t x;
      amide_intpoint_t y;
      amide_intpoint_t z;
      amide_intpoint_t g;
      amide_intpoint_t t;
    } AmitkVoxel;

### AmitkPixel

    typedef struct {
      amide_intpoint_t x;
      amide_intpoint_t y;
    } AmitkPixel;

### AmitkCanvasPoint

    typedef struct {
      amide_real_t x;
      amide_real_t y;
    } AmitkCanvasPoint;

### amitk_point_get_type ()

    GType               amitk_point_get_type                (void);

Returns : |

### amitk_point_copy ()

    AmitkPoint*         amitk_point_copy                    (const AmitkPoint *point);

`point` : |
Returns : |

### amitk_point_free ()

    void                amitk_point_free                    (AmitkPoint *point);

`point` : |

### amitk_point_read_xml ()

    AmitkPoint          amitk_point_read_xml                (xmlNodePtr nodes,
                                                             gchar *descriptor,
                                                             gchar **perror_buf);

`nodes` : |
`descriptor` : |
`perror_buf` : |
Returns : |

### amitk_point_write_xml ()

    void                amitk_point_write_xml               (xmlNodePtr node,
                                                             gchar *descriptor,
                                                             AmitkPoint point);

`node` : |
`descriptor` : |
`point` : |

### amitk_voxel_get_type ()

    GType               amitk_voxel_get_type                (void);

Returns : |

### amitk_voxel_copy ()

    AmitkVoxel*         amitk_voxel_copy                    (const AmitkVoxel *voxel);

`voxel` : |
Returns : |

### amitk_voxel_free ()

    void                amitk_voxel_free                    (AmitkVoxel *voxel);

`voxel` : |

### amitk_voxel_read_xml ()

    AmitkVoxel          amitk_voxel_read_xml                (xmlNodePtr nodes,
                                                             gchar *descriptor,
                                                             gchar **perror_buf);

`nodes` : |
`descriptor` : |
`perror_buf` : |
Returns : |

### amitk_voxel_write_xml ()

    void                amitk_voxel_write_xml               (xmlNodePtr node,
                                                             gchar *descriptor,
                                                             AmitkVoxel voxel);

`node` : |
`descriptor` : |
`voxel` : |

### amitk_pixel_get_type ()

    GType               amitk_pixel_get_type                (void);

Returns : |

### amitk_pixel_copy ()

    AmitkPixel*         amitk_pixel_copy                    (const AmitkPixel *pixel);

`pixel` : |
Returns : |

### amitk_pixel_free ()

    void                amitk_pixel_free                    (AmitkPixel *pixel);

`pixel` : |

### amitk_canvas_point_get_type ()

    GType               amitk_canvas_point_get_type         (void);

Returns : |

### amitk_canvas_point_copy ()

    AmitkCanvasPoint*   amitk_canvas_point_copy             (const AmitkCanvasPoint *point);

`point` : |
Returns : |

### amitk_canvas_point_free ()

    void                amitk_canvas_point_free             (AmitkCanvasPoint *point);

`point` : |

### AmitkAxes

    typedef AmitkPoint AmitkAxes[AMITK_AXIS_NUM];

### amitk_axes_get_type ()

    GType               amitk_axes_get_type                 (void);

Returns : |

### amitk_axes_copy ()

    AmitkAxes*          amitk_axes_copy                     (const AmitkAxes *axes);

`axes` : |
Returns : |

### amitk_axes_free ()

    void                amitk_axes_free                     (AmitkAxes *axes);

`axes` : |

### amitk_axes_copy_in_place ()

    void                amitk_axes_copy_in_place            (AmitkAxes dest_axes,
                                                             const AmitkAxes src_axes);

`dest_axes` : |
`src_axes` : |

### amitk_axes_transpose ()

    void                amitk_axes_transpose                (AmitkAxes axes);

`axes` : |

### amitk_axes_mult ()

    void                amitk_axes_mult                     (const AmitkAxes const_axes1,
                                                             const AmitkAxes const_axes2,
                                                             AmitkAxes dest_axes);

`const_axes1` : |
`const_axes2` : |
`dest_axes` : |

### amitk_axes_make_orthonormal ()

    void                amitk_axes_make_orthonormal         (AmitkAxes axes);

`axes` : |

### amitk_axes_rotate_on_vector ()

    void                amitk_axes_rotate_on_vector         (AmitkAxes axes,
                                                             AmitkPoint vector,
                                                             amide_real_t theta);

`axes` : |
`vector` : |
`theta` : |

### amitk_axes_get_orthogonal_axis ()

    AmitkPoint          amitk_axes_get_orthogonal_axis      (const AmitkAxes axes,
                                                             const AmitkView which_view,
                                                             const AmitkLayout which_layout,
                                                             const AmitkAxis which_axis);

`axes` : |
`which_view` : |
`which_layout` : |
`which_axis` : |
Returns : |

### amitk_axes_get_normal_axis ()

    AmitkPoint          amitk_axes_get_normal_axis          (const AmitkAxes axes,
                                                             const AmitkView which_view);

`axes` : |
`which_view` : |
Returns : |

### AmitkCorners

    typedef AmitkPoint AmitkCorners[2];

### amitk_corners_get_type ()

    GType               amitk_corners_get_type              (void);

Returns : |

### amitk_corners_free ()

    void                amitk_corners_free                  (AmitkCorners *corners);

`corners` : |

### amitk_corners_copy ()

    AmitkCorners*       amitk_corners_copy                  (const AmitkCorners *corners);

`corners` : |
Returns : |

### EPSILON

    #define EPSILON 1.4901161193847656e-08 /* what's close enough to be equal.... */

### CLOSE

    #define CLOSE 0.0001 /* within 0.01% */

### EMPTY

    #define EMPTY 0.0

### SIGMA_TO_FWHM

    #define SIGMA_TO_FWHM 2.354820045

### SIGMA_TO_FWTM

    #define SIGMA_TO_FWTM 4.291932053

### REAL_EQUAL()

    #define REAL_EQUAL(x,y) (fabs(x-y)/MAX(MAX(fabs(x),fabs(y)),DBL_MIN) < EPSILON)

`x` : |
`y` : |

### EQUAL_ZERO()

    #define EQUAL_ZERO(fp1) (REAL_EQUAL((fp1), 0.0))

`fp1` : |

### REAL_CLOSE()

    #define REAL_CLOSE(x,y) (fabs(x-y)/MAX(MAX(fabs(x),fabs(y)),DBL_MIN) < CLOSE)

`x` : |
`y` : |

### POINT_EQUAL()

    #define             POINT_EQUAL(point1,point2)

`point1` : |
`point2` : |

### VOXEL_EQUAL()

    #define             VOXEL_EQUAL(voxel1,voxel2)

`voxel1` : |
`voxel2` : |

### VOXEL_TO_POINT()

    #define             VOXEL_TO_POINT(vox, vox_size, real)

`vox` : |
`vox_size` : |
`real` : |

### POINT_TO_VOXEL()

    #define             POINT_TO_VOXEL(real, vox_size, frame, gate, vox)

`real` : |
`vox_size` : |
`frame` : |
`gate` : |
`vox` : |

### VOXEL_CORNER()

    #define             VOXEL_CORNER(vox, vox_size, corner)

`vox` : |
`vox_size` : |
`corner` : |

### POINT_MAX()

    #define POINT_MAX(point1) (MAX( MAX((point1).x, (point1).y), (point1).z))

`point1` : |

### POINT_DOT_PRODUCT()

    #define POINT_DOT_PRODUCT(point1,point2) ((point1).x*(point2).x+(point1).y*(point2).y+(point1).z*(point2).z)

`point1` : |
`point2` : |

### POINT_MAGNITUDE()

    #define POINT_MAGNITUDE(point) (sqrt(POINT_DOT_PRODUCT((point), (point))))

`point` : |

### POINT_ABS()

    #define             POINT_ABS(point1,point2)

`point1` : |
`point2` : |

### POINT_ADD()

    #define             POINT_ADD(point1,point2,point3)

`point1` : |
`point2` : |
`point3` : |

### POINT_SUB()

    #define             POINT_SUB(point1,point2,point3)

`point1` : |
`point2` : |
`point3` : |

### POINT_MULT()

    #define             POINT_MULT(point1,point2,point3)

`point1` : |
`point2` : |
`point3` : |

### POINT_DIV()

    #define             POINT_DIV(point1,point2,point3)

`point1` : |
`point2` : |
`point3` : |

### POINT_DIFF()

    #define             POINT_DIFF(point1,point2,point3)

`point1` : |
`point2` : |
`point3` : |

### POINT_CMULT()

    #define             POINT_CMULT(cm,point1,point3)

`cm` : |
`point1` : |
`point3` : |

### POINT_CROSS_PRODUCT()

    #define             POINT_CROSS_PRODUCT(point1, point2, point3)

`point1` : |
`point2` : |
`point3` : |

### POINT_MADD()

    #define             POINT_MADD(cm,point1,dm,point2,point3)

`cm` : |
`point1` : |
`dm` : |
`point2` : |
`point3` : |

### canvas_point_2_point ()

    AmitkPoint          canvas_point_2_point                (AmitkPoint volume_corner,
                                                             gint width,
                                                             gint height,
                                                             gdouble x_offset,
                                                             gdouble y_offset,
                                                             AmitkCanvasPoint canvas_cpoint);

`volume_corner` : |
`width` : |
`height` : |
`x_offset` : |
`y_offset` : |
`canvas_cpoint` : |
Returns : |

### point_2_canvas_point ()

    AmitkCanvasPoint    point_2_canvas_point                (AmitkPoint volume_corner,
                                                             gint width,
                                                             gint height,
                                                             gdouble x_offset,
                                                             gdouble y_offset,
                                                             AmitkPoint canvas_point);

`volume_corner` : |
`width` : |
`height` : |
`x_offset` : |
`y_offset` : |
`canvas_point` : |
Returns : |

### voxel_print ()

    void                voxel_print                         (gchar *message,
                                                             const AmitkVoxel voxel);

`message` : |
`voxel` : |

### voxel_get_dim ()

    amide_intpoint_t    voxel_get_dim                       (const AmitkVoxel voxel,
                                                             const AmitkDim which_dim);

`voxel` : |
`which_dim` : |
Returns : |

### voxel_set_dim ()

    void                voxel_set_dim                       (AmitkVoxel *voxel,
                                                             const AmitkDim which_dim,
                                                             amide_intpoint_t value);

`voxel` : |
`which_dim` : |
`value` : |

### point_print ()

    void                point_print                         (gchar *message,
                                                             const AmitkPoint point);

`message` : |
`point` : |

### point_rotate_on_vector ()

    AmitkPoint          point_rotate_on_vector              (const AmitkPoint in,
                                                             const AmitkPoint vector,
                                                             const amide_real_t theta);

`in` : |
`vector` : |
`theta` : |
Returns : |

### point_get_component ()

    amide_real_t        point_get_component                 (const AmitkPoint point,
                                                             const AmitkAxis which_axis);

`point` : |
`which_axis` : |
Returns : |

### point_set_component ()

    void                point_set_component                 (AmitkPoint *point,
                                                             const AmitkAxis which_axis,
                                                             const amide_real_t value);

`point` : |
`which_axis` : |
`value` : |

### zero_point

    extern const AmitkPoint zero_point;

### ONE_POINT

    #define ONE_POINT {1.0,1.0,1.0}

### one_point

    extern const AmitkPoint one_point;

### ten_point

    extern const AmitkPoint ten_point;

### zero_voxel

    extern const AmitkVoxel zero_voxel;

### ONE_VOXEL

    #define ONE_VOXEL {1,1,1,1,1}

### one_voxel

    extern const AmitkVoxel one_voxel;

### base_axes

    extern const AmitkAxes base_axes;

### amitk_view_get_name ()

    const gchar*        amitk_view_get_name                 (const AmitkView view);

`view` : |
Returns : |

### amitk_dim_get_name ()

    const gchar*        amitk_dim_get_name                  (const AmitkDim dim);

`dim` : |
Returns : |

### amitk_axis_get_name ()

    const gchar*        amitk_axis_get_name                 (const AmitkAxis axis);

`axis` : |
Returns : |

### amitk_length_unit_get_name ()

    const gchar*        amitk_length_unit_get_name          (const AmitkLengthUnit length_unit);

`length_unit` : |
Returns : |