mbidon_u1.c

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 */
00030 #include "image.h"    /* types des donnees manipulees dans ima2D */
00031 #include "proto2D.h"  /* descripteurs et prototypes des fonctions de ima2D */
00032 #include "bidon.h"    /* complement pour les operateurs en cours de developpt */ 
00033 #include <stdlib.h>
00034 
00035 int main(int argc, char *argv[]){
00036 
00037 /* DECLARATIONS */
00038 
00039   /* images */ 
00040   imau1 im0, imres;
00041 
00042   /* operateurs */
00043   read_ima_t rea;
00044   bidon_t bid;
00045   write_ima_t wri;   
00046 
00047   /* main : variables et parametres propres au main*/
00048   param par0, *ptp;      /* tete et pointeur pour la chaine de parametres */
00049   int iloc;              
00050   float floc;
00051   char  nomloc[200];
00052 
00053   
00054 /* LECTURE PARAMETRES */
00055 
00056   /* debut: OBLIGATOIRE pour compatibilite avec les 3 modes de lecture de param */
00057   param_debut(argc, argv, &par0); 
00058   ptp = &par0;      /* regle : ptp pointe sur la structure du parametre suivant */
00059 
00060   /* operateurs: ptp est passe en argument, return fournit la nouvelle position */
00061   ptp = read_ima_lect(&rea, ptp, ">> image initiale numero 1 :");
00062   ptp = bidon_lect(&bid, ptp, ">> parametre bidon :");
00063   ptp = write_ima_lect(&wri, ptp,  ">> image resultat numero 1 :");
00064 
00065   /* main : en cas de parametres lus dans le main */
00066   lec_param(">>main, entier iloc", ptp);
00067   iloc = atoi(ptp->rep);
00068   ptp = ptp->next;
00069   lec_param(">>main, float floc", ptp);
00070   floc = (float)atof(ptp->rep);
00071   ptp = ptp->next;
00072   lec_param(">>main, chaine de caracteres nomloc", ptp);
00073   strcpy(nomloc, ptp->rep);
00074   ptp = ptp->next;  
00075 
00076   /* fin: sauvegarde des parametres utilises en mode MANUEL ou FICHIER */
00077   param_fin(argc, argv, &par0);
00078 
00079 
00080 /* INITIALISATION  */
00081 
00082   /* operateur */
00083   read_imau1_init(&rea, &im0);
00084   bidonu1_init(&bid, im0, &imres);
00085   write_ima_init(&wri);
00086 
00087   /* main : en cas de variable a allouer/initialiser dans le main  */ 
00088 
00089    
00090 /* CALCUL */
00091    bidonu1_calc(&bid, im0, &imres); 
00092    printf("\n partie calcul, iloc=%d, floc=%f, nomloc=%s\n", iloc, floc, nomloc);
00093   /* pas de read_imau1_calc, write_imau1_calc : lecture, ecriture en une fois */
00094 
00095 
00096 /* FREMETURE */
00097   write_imau1_ferm(&wri, imres);
00098   
00099 }
00100 

Generated on Tue Apr 22 13:31:04 2008 for ima2D by  doxygen 1.5.3