vidaIO  5.1.2
vidaio.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef VIDAIO_KERNEL_VIDAIO_H
35 #define VIDAIO_KERNEL_VIDAIO_H
36 
37 /* #ifndef bool_t
38 #define bool_t int
39 #endif
40 
41 #ifndef enum_t
42 #define enum_t int
43 #endif */
44 /* BUG : ces definitions essayaient de corriger un probleme sur Solaris 2.5:
45  on ne pouvait pas inclure <rpc/xdr.h> directement.
46  En fait il faut inclure <rpc/rpc.h> avant ou a la place (cf manpage).
47  (cette modif n'etait pas propre et provoquait des warnings sur
48  Solaris 2.7)
49 */
50 
51 #include <stdio.h>
53 #include <vidaIO/kernel/shfjData.h>
54 
55 #define PROCESSOR_SPARC (char) 0
56 #define PROCESSOR_MIPS (char) 1
57 #define vOUT_OF_RANGE " Normalizing out of rounding error range."
58 
59 
60 #ifdef __cplusplus
61  extern "C" {
62 #endif
63 
64 
65 typedef struct AnalyzeDb AnaHdr;
66 
67 
68 typedef struct
69 {
70  char mode[4];
71  int size_x,size_y,size_z,size_t;
72  float psize_x,psize_y,psize_z,psize_t;
74  int type;
75  float scale,offset;
76  int unite;
77 }consigne;
78 
79 
80 typedef struct
81 {
82  FILE *fpi; /* pointeur de fichier sur .vimg */
83  FILE *fph; /* pointeur de fichier sur .vhdr */
84  FILE *fpf; /* pointeur de fichier sur .vinfo */
85  AnaHdr *ana_db; /* pointeur sur la strt analyze xdr */
86  S_DATA *shfj_db; /* ptr sur la str base de data SHFJ */
87  int ref_count; /* Not used */
88  consigne *consign; /* Ptr sur les cons lien entre */
89  /*vidaopen et vidaread ou vidawrite */
90 }VIDAim;
91 
92 
93 extern char *VidaAlloc(VIDAim *vp);
94 extern VIDAim *VidaOpen(const char *nom_fic,consigne *cons);
95 extern int VidaClose(VIDAim *vp);
96 extern int VidaRead(char *buf,int slice,int frame,VIDAim *vp);
97 extern int VidaWrite(char *buf,int slice,int frame,VIDAim *vp);
98 extern consigne *VidaConsigne( int, ... );
99 extern int VidaAbsMin(); /* pour tout le fic exprime en short */
100 extern int VidaAbsMax(); /* pour tout le fic exprime en short */
101 extern int VidaAbsZero(); /* pour tout le fic exprime en short */
102 
103 
104 /*************************************************************
105  Definititon des masques de controle et des type de formats
106  Convention de nommage : FORMmemoire_type_FORMdisque
107  Exemple : FORMmemoire est FX ou FL
108  FORMdisque est FX ou FL
109  type est int short char ou float
110 *************************************************************/
111 #define MSK_INT_FX 0x010000
112 #define FX_INT_FL MSK_INT_FX + 1
113 #define FX_INT_FX MSK_INT_FX + 2
114 #define MSK_SHORT_FX 0x020000
115 #define FX_SHORT_FL MSK_SHORT_FX + 1
116 #define FX_SHORT_FX MSK_SHORT_FX + 2
117 #define MSK_SHORT_FL 0x040000
118 #define FL_SHORT_FL MSK_SHORT_FL + 1
119 #define MSK_FLOAT_FL 0x080000
120 #define FL_FLOAT_FL MSK_FLOAT_FL + 1
121 
122 #define STRETCH_AROUND_ZERO 1
123 #define STRETCH_ANYWAY 2
124 
125 
126 /***********************************************************************
127  Definititon des entrees possible de VidaConsigne() dans le va_arg de
128  vidaconsigne cf le formalisme de XView
129 ***********************************************************************/
130 #define VMODE 1 /* Desc mode d'ouverture de l'image */
131 #define VMDTYPE 3 /* Desc type de l'image */
132 #define VSIZE_X 4 /* Desc sizex de l'image */
133 #define VSIZE_Y 5 /* Desc sizey de l'image */
134 #define VSIZE_Z 6 /* Desc sizez de l'image */
135 #define VSIZE_T 7 /* Desc sizet de l'image */
136 #define VSCALE_SHIFT 8 /* Desc type de l'image */
137 #define VSIZE_PX 9 /* Taille X en mm */
138 #define VSIZE_PY 10 /* Taille Y en mm */
139 #define VSIZE_PZ 11 /* Taille Z en mm */
140 #define VSIZE_PT 12 /* Taille T en mm */
141 #define VUNITE 13 /* unite de quantification */
142 
143 /**************************************
144  Definititon des macros fonctions
145 **************************************/
146 #define VIDA_VIMG(v) v->fpi
147 #define VIDA_VHDR(v) (v->consign->mode == VIDA_LEC : v->fph; NULL)
148 #define VIDA_VINFO(v) (v->consign->mode == VIDA_LEC : v->fpf; NULL)
149 #define VIDA_X(v) v->ana_db->img.dim[1]
150 #define VIDA_Y(v) v->ana_db->img.dim[2]
151 #define VIDA_Z(v) v->ana_db->img.dim[3]
152 #define VIDA_T(v) v->ana_db->img.dim[4]
153 #define VIDA_PX(v) v->ana_db->img.pixdim[1]
154 #define VIDA_PY(v) v->ana_db->img.pixdim[2]
155 #define VIDA_PZ(v) v->ana_db->img.pixdim[3]
156 #define VIDA_PT(v) v->ana_db->img.pixdim[4]
157 #define VIDA_TYPE(v) v->consign->type
158 #define VIDA_UNITE(v) v->consign->unite
159 
160 
161 #ifdef __cplusplus
162  }
163 #endif
164 
165 #endif
Definition: vidaio.h:81
S_DATA * shfj_db
Definition: vidaio.h:86
consigne * consign
Definition: vidaio.h:88
FILE * fpi
Definition: vidaio.h:82
int ref_count
Definition: vidaio.h:87
FILE * fph
Definition: vidaio.h:83
FILE * fpf
Definition: vidaio.h:84
AnaHdr * ana_db
Definition: vidaio.h:85
float offset
Definition: vidaio.h:75
int type
Definition: vidaio.h:74
int scale_shift
Definition: vidaio.h:73
float psize_t
Definition: vidaio.h:72
int unite
Definition: vidaio.h:76
int size_t
Definition: vidaio.h:71
int VidaClose(VIDAim *vp)
char * VidaAlloc(VIDAim *vp)
int VidaAbsMax()
int VidaAbsZero()
int VidaAbsMin()
VIDAim * VidaOpen(const char *nom_fic, consigne *cons)
int VidaWrite(char *buf, int slice, int frame, VIDAim *vp)
consigne * VidaConsigne(int,...)
int VidaRead(char *buf, int slice, int frame, VIDAim *vp)