Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals

volmin.c

Go to the documentation of this file.
00001 /************************************************************************* 00002 * $Id: volmin.c,v 1.1 2005/09/09 08:22:56 bellet Exp $ 00003 ************************************************************************** 00004 This software is governed by the CeCILL license under French law and 00005 abiding by the rules of distribution of free software. You can use, 00006 modify and/ or redistribute the software under the terms of the CeCILL 00007 license as circulated by CEA, CNRS and INRIA at the following URL 00008 "http://www.cecill.info". 00009 00010 As a counterpart to the access to the source code and rights to copy, 00011 modify and redistribute granted by the license, users are provided only 00012 with a limited warranty and the software's author, the holder of the 00013 economic rights, and the successive licensors have only limited 00014 liability. 00015 00016 In this respect, the user's attention is drawn to the risks associated 00017 with loading, using, modifying and/or developing or reproducing the 00018 software by the user in light of its specific status of free software, 00019 that may mean that it is complicated to manipulate, and that also 00020 therefore means that it is reserved for developers and experienced 00021 professionals having in-depth computer knowledge. Users are therefore 00022 encouraged to load and test the software's suitability as regards their 00023 requirements in conditions enabling the security of their systems and/or 00024 data to be ensured and, more generally, to use and operate it in the 00025 same conditions as regards security. 00026 00027 The fact that you are presently reading this means that you have had 00028 knowledge of the CeCILL license and that you accept its terms. 00029 00030 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 00031 l'Image). All rights reserved. See License.txt for details. 00032 00033 Version 1.0 05/09/2005 00034 *************************************************************************/ 00035 00036 /* 00037 * Description : volume non COMPLEXE 00038 */ 00039 00040 #include <stdio.h> 00041 #include <float.h> 00042 #include "idvol.h" 00043 #include "iderr.h" 00044 #include "idprint.h" 00045 00046 00047 /* 00048 * FUNCTION DESCRIPTION ************************************************** 00049 * 00050 * IdVolMinPlanX (fonction) 00051 * 00052 * RESUME: Calcule le Minimum d'un plan X d'un Vol non COMPLEX 00053 * 00054 * DESCRIPTION: Calcule le Minimum d'un plan X d'un Vol non COMPLEX 00055 * 00056 * SYNTAXE: double min = IdVolMinX (PPPVOLUME volume,int numPlanX); 00057 * 00058 * RETOUR: type : double 00059 * role : valeur min du plan. 00060 * 00061 * PARAMETRES: nom : vol 00062 * type : PPPVOLUME 00063 * role : Pointeur vers le Volume source 00064 * 00065 * nom : x 00066 * type: entier 00067 * role :numero du plan en X dont on calcule le min 00068 * 00069 * FICHIER: minvol.c 00070 * 00071 * EXEMPLE: 00072 * 00073 * ******************************************************** END DESCRIPTION 00074 */ 00075 00076 00088 #define CC(t1) mini = (double) ((t1)vol)[0][0][X]; \ 00089 for (i=0;i<Z;i++) for (j=0;j<Y;j++) \ 00090 { \ 00091 if (((t1)vol)[i][j][X]<mini) \ 00092 mini = (double) ((t1)vol)[i][j][X]; \ 00093 } 00094 00095 double 00096 IdVolMinPlanX(PPPVOLUME vol, int X) 00097 { 00098 double mini; 00099 int i, j, Y, Z; 00100 00101 Z = IdVolDimZ(vol); 00102 Y = IdVolDimY(vol); 00103 mini = FLT_MAX; 00104 switch (IdVolType(vol)) { 00105 case VOL_CHAR: 00106 CC(PPPVOLUME_CHAR); 00107 break; 00108 case VOL_UCHAR: 00109 CC(PPPVOLUME_UCHAR); 00110 break; 00111 case VOL_SHORT: 00112 CC(PPPVOLUME_SHORT); 00113 break; 00114 case VOL_USHORT: 00115 CC(PPPVOLUME_USHORT); 00116 break; 00117 case VOL_LONG: 00118 CC(PPPVOLUME_LONG); 00119 break; 00120 case VOL_ULONG: 00121 CC(PPPVOLUME_ULONG); 00122 break; 00123 case VOL_FLOAT: 00124 CC(PPPVOLUME_FLOAT); 00125 break; 00126 case VOL_DOUBLE: 00127 CC(PPPVOLUME_DOUBLE); 00128 break; 00129 default: 00130 IdPrintf 00131 ("Type %d non traitable par la fonction IdVolMinPlanX !\n", 00132 IdVolType(vol)); 00133 IdExit(0); 00134 } // switch 00135 00136 return (mini); 00137 } 00138 00139 /* 00140 * FUNCTION DESCRIPTION ************************************************** 00141 * 00142 * IdVolMinPlanY (fonction) 00143 * 00144 * RESUME: Calcule le Minimum d'un plan Y d'un Volume non COMPLEX 00145 * 00146 * DESCRIPTION: Calcule le Minimum d'un plan Y d'un Volume non COMPLEX 00147 * 00148 * SYNTAXE: double min = IdVolMinY (PPPVOLUME volume, int numPlanY); 00149 * 00150 * RETOUR: type : Double 00151 * acces : O 00152 * role : valeur min du plan. 00153 * 00154 * PARAMETRES: nom : vol 00155 * type : PPPVOLUME 00156 * acces : I, N 00157 * role : Pointeur vers le Volume source 00158 * 00159 * nom : y 00160 * type: entier 00161 * acces: I 00162 * role :numero du plan en Y dont on calcule le min 00163 * 00164 * VERSION: V1.00 00165 * 00166 * FICHIER: minvol.c 00167 * 00168 * EXEMPLE: 00169 * 00170 * ******************************************************** END DESCRIPTION 00171 */ 00172 00173 00186 #include <stdio.h> 00187 #include "idvol.h" 00188 00189 #define DD(t1) mini = (double) ((t1)vol)[0][Y][0]; \ 00190 for (i=0;i<Z;i++) for (k=0;k<X;k++) \ 00191 { \ 00192 if (((t1)vol)[i][Y][k]<mini) \ 00193 mini = (double) ((t1)vol)[i][Y][k]; \ 00194 } 00195 00196 double 00197 IdVolMinPlanY(PPPVOLUME vol, int Y) 00198 { 00199 double mini=0.; 00200 int i, k, X, Z; 00201 00202 X = IdVolDimX(vol); 00203 Z = IdVolDimZ(vol); 00204 switch (IdVolType(vol)) { 00205 case VOL_CHAR: 00206 DD(PPPVOLUME_CHAR); 00207 break; 00208 case VOL_UCHAR: 00209 DD(PPPVOLUME_UCHAR); 00210 break; 00211 case VOL_SHORT: 00212 DD(PPPVOLUME_SHORT); 00213 break; 00214 case VOL_USHORT: 00215 DD(PPPVOLUME_USHORT); 00216 break; 00217 case VOL_LONG: 00218 DD(PPPVOLUME_LONG); 00219 break; 00220 case VOL_FLOAT: 00221 DD(PPPVOLUME_FLOAT); 00222 break; 00223 case VOL_DOUBLE: 00224 DD(PPPVOLUME_DOUBLE); 00225 break; 00226 default: 00227 IdPrintf 00228 ("Type %d non traitable par la fonction IdVolMinPlanY !\n", 00229 IdVolType(vol)); 00230 IdExit(0); 00231 } // switch 00232 00233 return (mini); 00234 } 00235 00236 /* 00237 * FUNCTION DESCRIPTION ************************************************** 00238 * 00239 * IdVolMinPlanZ (fonction) 00240 * 00241 * RESUME: Calcule le Minimum d'un plan Z d'un Volume non COMPLEX 00242 * 00243 * DESCRIPTION: Calcule le Minimum d'un plan Z d'un Volume non COMPLEX 00244 * 00245 * SYNTAXE: double min = IdVolMinZ (PPPVOLUME volume,int numPlanZ); 00246 * 00247 * RETOUR: type : Double 00248 * acces : O 00249 * role : valeur min du plan. 00250 * 00251 * PARAMETRES: nom : vol 00252 * type : PPPVOLUME 00253 * acces : I, N 00254 * role : Pointeur vers le Volume source 00255 * 00256 * nom : y 00257 * type: entier 00258 * acces: I 00259 * role :numero du plan en Z dont on calcule le min 00260 * 00261 * VERSION: V1.00 00262 * 00263 * FICHIER: minvol.c 00264 * 00265 * EXEMPLE: 00266 * 00267 * ******************************************************** END DESCRIPTION 00268 */ 00269 00281 #include <stdio.h> 00282 #include "idvol.h" 00283 00284 #define EE(t1) mini = (double) ((t1)vol)[Z][0][0]; \ 00285 for (j=0;j<Y;j++) for (k=0;k<X;k++) \ 00286 { \ 00287 if (((t1)vol)[Z][j][k]<mini) \ 00288 mini = (double) ((t1)vol)[Z][j][k]; \ 00289 } 00290 00291 double 00292 IdVolMinPlanZ(PPPVOLUME vol, int Z) 00293 { 00294 double mini=0.; 00295 int j, k, X, Y; 00296 00297 X = IdVolDimX(vol); 00298 Y = IdVolDimY(vol); 00299 switch (IdVolType(vol)) { 00300 case VOL_CHAR: 00301 EE(PPPVOLUME_CHAR); 00302 break; 00303 case VOL_UCHAR: 00304 EE(PPPVOLUME_UCHAR); 00305 break; 00306 case VOL_SHORT: 00307 EE(PPPVOLUME_SHORT); 00308 break; 00309 case VOL_USHORT: 00310 EE(PPPVOLUME_USHORT); 00311 break; 00312 case VOL_LONG: 00313 EE(PPPVOLUME_LONG); 00314 break; 00315 case VOL_FLOAT: 00316 EE(PPPVOLUME_FLOAT); 00317 break; 00318 case VOL_DOUBLE: 00319 EE(PPPVOLUME_DOUBLE); 00320 break; 00321 default: 00322 IdPrintf 00323 ("Type %d non traitable par la fonction IdVolMinPlanZ !\n", 00324 IdVolType(vol)); 00325 IdExit(0); 00326 } // switch 00327 00328 return (mini); 00329 } 00330 00331 /* 00332 * FUNCTION DESCRIPTION ************************************************** 00333 * 00334 * IdVolMinima (fonction) 00335 * 00336 * RESUME: Calcule le Minimum d'un volume non COMPLEX 00337 * 00338 * DESCRIPTION: Calcule le Minimum d'un volume non COMPLEX 00339 * 00340 * SYNTAXE: double min = IdVolMinima (PPPVOLUME volume); 00341 * 00342 * RETOUR: type : Double 00343 * acces : O 00344 * role : valeur min du volume. 00345 * 00346 * PARAMETRES: nom : vol 00347 * type : PPPVOLUME 00348 * acces : I, N 00349 * role : Pointeur vers le volume source 00350 * 00351 * VERSION: V1.00 00352 * 00353 * FICHIER: minvol.c 00354 * 00355 * EXEMPLE: 00356 * 00357 * ******************************************************** END DESCRIPTION 00358 */ 00359 00371 #include <stdio.h> 00372 #include "idvol.h" 00373 00374 #define FF(t1) mini = (double) ((t1)vol)[0][0][0]; \ 00375 for (t=0;t<Z;t++) for (i=0;i<Y;i++) for (j=0;j<X;j++) \ 00376 { \ 00377 if (((t1)vol)[t][i][j]<mini) \ 00378 mini = (double) ((t1)vol)[t][i][j]; \ 00379 } 00380 00381 00382 double 00383 IdVolMinima(PPPVOLUME vol) 00384 { 00385 double mini=0.; 00386 int i, j, t, X, Y, Z; 00387 00388 X = IdVolDimX(vol); 00389 Y = IdVolDimY(vol); 00390 Z = IdVolDimZ(vol); 00391 00392 switch (IdVolType(vol)) { 00393 case VOL_CHAR: 00394 FF(PPPVOLUME_CHAR); 00395 break; 00396 case VOL_UCHAR: 00397 FF(PPPVOLUME_UCHAR); 00398 break; 00399 case VOL_SHORT: 00400 FF(PPPVOLUME_SHORT); 00401 break; 00402 case VOL_USHORT: 00403 FF(PPPVOLUME_USHORT); 00404 break; 00405 case VOL_LONG: 00406 FF(PPPVOLUME_LONG); 00407 break; 00408 case VOL_FLOAT: 00409 FF(PPPVOLUME_FLOAT); 00410 break; 00411 case VOL_DOUBLE: 00412 FF(PPPVOLUME_DOUBLE); 00413 break; 00414 default: 00415 IdPrintf 00416 ("Type %d non traitable par la fonction IdVolMinima !\n", 00417 IdVolType(vol)); 00418 IdExit(0); 00419 } // switch 00420 00421 return (mini); 00422 }

Generated on Wed Oct 19 09:28:34 2005 for SIMRI3D by doxygen 1.3.7