vol.h
Go to the documentation of this file.
00001 /******************************************************************************
00002   Copyright (c)  2003,2004 by Turku PET Centre
00003 
00004   vol.h - definitions for vol.c
00005 
00006   Version:
00007   2003-12-18 Vesa Oikonen
00008     Added 3D structures VOL and SVOL and related functions.
00009   2004-01-29 VO
00010     Added functions vol2img() and svol2img.
00011   2004-08-23 VO
00012     Some Doxygen style comments.
00013 
00014 
00015 
00016 ******************************************************************************/
00017 #ifndef _VOL_H
00018 #define _VOL_H
00019 /*****************************************************************************/
00020 int VOL_TEST;
00021 /*****************************************************************************/
00022 
00023 /*****************************************************************************/
00024 typedef struct {
00025   int x;  /* [1..dimx] */
00026   int y;  /* [1..dimy] */
00027   int z;  /* [1..dimz] */
00028 } VOL_PIXEL;
00029 typedef struct {
00030   int x1, x2;  /* [1..dimx] */
00031   int y1, y2;  /* [1..dimy] */
00032   int z1, z2;  /* [1..dimz] */
00033 } VOL_RANGE;  
00034 /*****************************************************************************/
00035   
00036 /*****************************************************************************/
00037 /*
00038  *  3D volume data structure - 4-byte float voxels
00039  */
00040 typedef struct {
00041 
00043   char status;
00045   char *statmsg;
00047   int orientation;
00049   float sizex, sizey, sizez;
00051   unsigned short int dimx, dimy, dimz;
00053   float *_vxl, *_col, **_row, ***_pln;
00055   float ***v, ***plane, **row, *column, *voxel;
00056 
00057 } VOL;
00058 /*****************************************************************************/
00059 /*
00060  *  3D volume data structure - 2-byte short int voxels
00061  */
00062 typedef struct {
00063 
00065   char status;
00067   char *statmsg;
00069   int orientation;
00071   float sizex, sizey, sizez;
00073   unsigned short int dimx, dimy, dimz;
00075   float scale_factor;
00077   short int *_vxl, *_col, **_row, ***_pln;
00079   short int ***v, ***plane, **row, *column, *voxel;
00080 
00081 } SVOL;
00082 /*****************************************************************************/
00083 
00084 /*****************************************************************************/
00085 /*
00086  *  Function definitions
00087  */
00088 /* 4-byte floats */
00089 extern void volInit(VOL *vol);
00090 extern void volEmpty(VOL *vol);
00091 extern int volAllocate(VOL *vol, int planes, int rows, int columns);
00092 extern int img2vol(IMG *img, VOL *vol, int frame);
00093 extern int vol2img(VOL *vol, IMG *img, int frame);
00094 extern void volInfo(VOL *vol, FILE *fp);
00095 extern void volContents(VOL *vol, VOL_RANGE r, FILE *fp);
00096 extern int volMax(VOL *vol, VOL_RANGE r, VOL_PIXEL *p, float *maxv);
00097 extern int volAvg(VOL *vol, VOL_RANGE r, float *avg);
00098 /* 2-byte short ints */
00099 extern void svolInit(SVOL *svol);
00100 extern void svolEmpty(SVOL *svol);
00101 extern int svolAllocate(SVOL *svol, int planes, int rows, int columns);
00102 extern int img2svol(IMG *img, SVOL *svol, int frame);
00103 extern int svol2img(SVOL *svol, IMG *img, int frame);
00104 extern void svolInfo(SVOL *svol, FILE *fp);
00105 /*****************************************************************************/
00106 
00107 /*****************************************************************************/
00108 #endif /* _VOL_H */
00109