1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
#include <viaio/VImage.h>
#include <viaio/VGraph.h>
#include <viaio/Volumes.h>
#ifdef __cplusplus
extern "C" {
#endif
/*!
\struct SNode
\brief data struct for representing nodes in a graph.
\param VShort <b> col</b> column index
\param VShort <b>row</b> row index
\param VShort <b>band</b> slice (band) index
\param VShort <b>label</b> node label
\par Author:
Gabriele Lohmann, MPI-CBS
*/
typedef struct SNodeStruct {
VNodeBaseRec base;
VShort type;
VShort col;
VShort row;
VShort band;
VShort label;
} SNodeRec, *SNode;
/*!
\struct FNode
\brief data struct for representing nodes in a graph.
\param VFloat <b>x</b> column index
\param VFloat <b>y</b> row index
\param VFloat <b>z</b> slice (band) index
\param VFloat <b>val</b> node label
\par Author:
Gabriele Lohmann, MPI-CBS
*/
typedef struct FNodeStruct {
VNodeBaseRec base;
VFloat type;
VFloat x;
VFloat y;
VFloat z;
VFloat label;
} FNodeRec, *FNode;
/*!
\struct VoxelList
\brief data struct for representing voxels.
\param short <b>b</b> slice (band) index
\param short <b>r</b> row index
\param short <b>c</b> column index
\par Author:
Gabriele Lohmann, MPI-CBS
*/
typedef struct {
short b;
short r;
short c;
} Voxel, *VoxelList;
/*!
\struct PixelList
\brief data struct for representing pixels.
\param short <b>r</b> row index
\param short <b>c</b> column index
\par Author:
Gabriele Lohmann, MPI-CBS
*/
typedef struct {
short r;
short c;
} Pixel, *PixelList;
/*!
\struct VPoint
\brief data struct for representing labelled voxels. The label is a float value.
\param short <b>b</b> slice (band) index
\param short <b>r</b> row index
\param short <b>c</b> column index
\param float <b>val</b> label value
\par Author:
Gabriele Lohmann, MPI-CBS
*/
typedef struct {
short b;
short r;
short c;
float val;
} VPoint;
/*!
\struct XPoint
\brief data struct for representing 3D points.
\param float <b>x</b> slice (band) index
\param float <b>y</b> row index
\param float <b>z</b> column index
\par Author:
Gabriele Lohmann, MPI-CBS
*/
typedef struct pointStruct{
float x;
float y;
float z;
} XPoint;
/*
** access to a pixel
*/
#define VPixelIndex(image, i) \
((VPointer) ((char *) (VImageData(image) + (i) * VPixelSize (image))))
/*
** fast implementation of rounding
*/
#define VRintPos(x) ((int)((x) + 0.5))
#define VRintNeg(x) ((int)((x) - 0.5))
#define VRint(x) ((x) >= 0 ? VRintPos(x) : VRintNeg(x))
#define VFloor(x) ((x) >= 0 ? (int)((x+0.000001)) : (int)((x) - 0.999999))
#define VCeilPos(x) (VRint((x)) == (x) ? (x) : (int)(x+0.99999))
#define VCeilNeg(x) (VRint((x)) == (x) ? (x) : (int)(x+0.00001))
#define VCeil(x) ((x) >= 0 ? VCeilPos(x) : VCeilNeg(x))
/*
** some other stuff
*/
#define VSqr(x) ((x) * (x))
#define VAbs(x) ((x) > 0 > ? (x) : -(x))
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
|