mmoy2D.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 */
00028 #include "image.h"
00029 #include "proto2D.h"
00030 
00031 int main(int argc, char *argv[]){
00032   /* images */ 
00033   imau1 im0u1, moyampu1;          
00034   imau2 im0u2, moyampu2;          
00035   imafl im0fl, moyampfl;          
00036   /* operateurs */
00037   read_ima_t  rea;
00038   moy2D_t     moy;
00039   write_ima_t wri;
00040  /* main : variables et parametres propres au main*/
00041   param par0, *ptp;      /* tete et pointeur pour la chaine de parametres */
00042   int t0;
00043 
00044 /* LECTURE PARAMETRES */
00045   param_debut(argc, argv, &par0); 
00046   ptp = &par0;
00047   ptp = read_ima_lect(&rea, ptp, ">> image initiale (u1|u2|fl) :");
00048   ptp = write_ima_lect(&wri, ptp, ">> image resultat(meme type) :");
00049   ptp = moy2D_lect(&moy, ptp, ">> fenetre de moyennage :");
00050   param_fin(argc, argv, &par0);
00051 
00052 /* INITIALISATION  */
00053  if( !strcmp(rea.ext, "ima") || !strcmp(rea.ext, "ras")){
00054       t0 = 1;
00055       read_imau1_init(&rea, &im0u1);  
00056       moy2Du1_init(&moy, im0u1, &moyampu1);
00057   }
00058   else if(!strcmp(rea.ext, "imw")){
00059       t0 = 2;
00060       read_imau2_init(&rea, &im0u2);
00061       moy2Du2_init(&moy, im0u2, &moyampu2);
00062   }
00063   else if(!strcmp(rea.ext, "imf")){
00064       t0 = 4;
00065       read_imafl_init(&rea, &im0fl);
00066       moy2Dfl_init(&moy, im0fl, &moyampfl);
00067   }
00068   else{
00069       printf("\n>>moy2D ERREUR : extension %s inconnue\n", rea.ext);
00070       exit(0);
00071   }
00072   write_ima_init(&wri);
00073  
00074 /* CALCUL */
00075   switch(t0){
00076   case 1 :      
00077       moy2Du1_calc(&moy, im0u1, &moyampu1);
00078       break;
00079   case 2 :
00080       moy2Du2_calc(&moy, im0u2, &moyampu2);
00081       break;
00082   case 4 :
00083       moy2Dfl_calc(&moy, im0fl, &moyampfl);
00084       break;
00085   }
00086   
00087 /* FREMETURE */
00088   switch(t0){
00089   case 1 :      
00090       write_imau1_ferm(&wri, moyampu1);
00091       break;
00092   case 2 :      
00093       write_imau2_ferm(&wri, moyampu2);
00094       break;
00095   case 4 :      
00096       write_imafl_ferm(&wri, moyampfl);
00097       break;
00098   }
00099 }
00100 
00101 
00102 

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