vol.h
Go to the documentation of this file.
1 /******************************************************************************
2  Copyright (c) 2003,2004 by Turku PET Centre
3 
4  vol.h - definitions for vol.c
5 
6  Version:
7  2003-12-18 Vesa Oikonen
8  Added 3D structures VOL and SVOL and related functions.
9  2004-01-29 VO
10  Added functions vol2img() and svol2img.
11  2004-08-23 VO
12  Some Doxygen style comments.
13 
14 
15 
16 ******************************************************************************/
17 #ifndef _VOL_H
18 #define _VOL_H
19 /*****************************************************************************/
21 /*****************************************************************************/
22 
23 /*****************************************************************************/
24 typedef struct {
25  int x; /* [1..dimx] */
26  int y; /* [1..dimy] */
27  int z; /* [1..dimz] */
28 } VOL_PIXEL;
29 typedef struct {
30  int x1, x2; /* [1..dimx] */
31  int y1, y2; /* [1..dimy] */
32  int z1, z2; /* [1..dimz] */
33 } VOL_RANGE;
34 /*****************************************************************************/
35 
36 /*****************************************************************************/
37 /*
38  * 3D volume data structure - 4-byte float voxels
39  */
40 typedef struct {
41 
43  char status;
45  char *statmsg;
49  float sizex, sizey, sizez;
51  unsigned short int dimx, dimy, dimz;
53  float *_vxl, *_col, **_row, ***_pln;
55  float ***v, ***plane, **row, *column, *voxel;
56 
57 } VOL;
58 /*****************************************************************************/
59 /*
60  * 3D volume data structure - 2-byte short int voxels
61  */
62 typedef struct {
63 
65  char status;
67  char *statmsg;
71  float sizex, sizey, sizez;
73  unsigned short int dimx, dimy, dimz;
75  float scale_factor;
77  short int *_vxl, *_col, **_row, ***_pln;
79  short int ***v, ***plane, **row, *column, *voxel;
80 
81 } SVOL;
82 /*****************************************************************************/
83 
84 /*****************************************************************************/
85 /*
86  * Function definitions
87  */
88 /* 4-byte floats */
89 extern void volInit(VOL *vol);
90 extern void volEmpty(VOL *vol);
91 extern int volAllocate(VOL *vol, int planes, int rows, int columns);
92 extern int img2vol(IMG *img, VOL *vol, int frame);
93 extern int vol2img(VOL *vol, IMG *img, int frame);
94 extern void volInfo(VOL *vol, FILE *fp);
95 extern void volContents(VOL *vol, VOL_RANGE r, FILE *fp);
96 extern int volMax(VOL *vol, VOL_RANGE r, VOL_PIXEL *p, float *maxv);
97 extern int volAvg(VOL *vol, VOL_RANGE r, float *avg);
98 /* 2-byte short ints */
99 extern void svolInit(SVOL *svol);
100 extern void svolEmpty(SVOL *svol);
101 extern int svolAllocate(SVOL *svol, int planes, int rows, int columns);
102 extern int img2svol(IMG *img, SVOL *svol, int frame);
103 extern int svol2img(SVOL *svol, IMG *img, int frame);
104 extern void svolInfo(SVOL *svol, FILE *fp);
105 /*****************************************************************************/
106 
107 /*****************************************************************************/
108 #endif /* _VOL_H */
109