sistoras.c

Go to the documentation of this file.
00001 /*
00002 *    Copyright (c) 2007. The BATI team. All right reserved.
00003 *
00004 *    This file is part of BATI library.
00005 *
00006 *    BATI library is free software: you can redistribute it and/or modify
00007 *    it under the terms of the GNU General Public License as published by
00008 *    the Free Software Foundation, either version 3 of the License, or
00009 *    (at your option) any later version.
00010 *
00011 *    BATI library  is distributed in the hope that it will be useful,
00012 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 *    GNU General Public License for more details.
00015 *
00016 *    You should have received a copy of the GNU General Public License
00017 *    along with BATI library.  If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 #include <stdio.h>
00020 #include <string.h>
00021 
00022 #include "volume.h" 
00023 #include "image.h"
00024 #include "proto2D.h"
00025 
00026 
00042 #define XY 1
00043 #define XZ 2
00044 #define YZ 3
00045 
00046 
00047 
00048 
00049 
00050 
00051 /*programme principal*/
00052 main(argc,argv)
00053     int argc;
00054     char *argv[];
00055 {
00056 
00057   ima3Du1  ima;
00058   imau1 out;
00059   int x, y, z, s=1, t=XY;
00060   write_ima_t wri;   
00061   param par0, *ptp;
00062   char nomloc[200];
00063   
00064 
00065   /*lecture des paramètres*/
00066   param_debut(argc, argv, &par0); 
00067   ptp = &par0;      
00068 
00069   lec_param("fichier volume xt:", ptp);
00070   strcpy(nomloc, ptp->rep);
00071   ptp = ptp->next;  
00072 
00073   lec_param("Orientation [1=XY,2=XZ,3=YZ]:", ptp);
00074   t = atoi(ptp->rep);
00075   ptp = ptp->next;
00076 
00077   lec_param("Numero de la section [0..dim-1]:", ptp);
00078   s = atoi(ptp->rep);
00079   ptp = ptp->next;
00080 
00081   ptp = write_ima_lect(&wri, ptp, "Fichier rasterfile:");
00082   param_fin(argc, argv, &par0);
00083 
00084 
00085   /*traitement*/
00086   switch(t){
00087   case XY:
00088     {
00089       printf("XY\n");
00090       lect_ima3Du1( nomloc, &ima, ONE, s);
00091       out.nr=ima.dimx;
00092       out.nc=ima.dimy;
00093       alloc_imau1(&out);
00094       for(x=0; x<out.nr; x++)
00095         for(y=0; y<out.nc; y++)
00096           out.p[x][y] = ima.data[0][y][x];
00097       break;
00098     }
00099   case XZ:
00100     {
00101       lect_ima3Du1(argv[1], &ima, ALL);
00102       out.nr=ima.dimx;
00103       out.nc=ima.dimz;
00104       alloc_imau1(&out);
00105       for(x=0; x<out.nr; x++)
00106         for(z=0; z<out.nc; z++)
00107           out.p[x][z] = ima.data[z][s][x];
00108       break;
00109         }
00110   case YZ:
00111     {
00112       lect_ima3Du1(argv[1], &ima, ALL);
00113       out.nr=ima.dimy;
00114       out.nc=ima.dimz;
00115       alloc_imau1(&out);
00116       for(y=0; y<out.nr; y++)
00117         for(z=0; z<out.nc; z++)
00118           out.p[y][z] = ima.data[z][y][s];
00119       break;
00120         }
00121   }
00122   
00123   /*sauvegarde de l'image*/
00124   write_ima_init( &wri);
00125 
00126   /*libération mémoire*/
00127   write_imau1_ferm( &wri, out);
00128   liberer_ima3Du1(&ima);
00129  
00130 }

Generated on Tue Apr 22 13:31:06 2008 for volume by  doxygen 1.5.3