mmedian3d.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 */
00028 #include "image.h"    /* types des donnees utilises */
00029 #include "volume.h"   /* descripteurs et prototypes des fonctions de ima3D */
00030 #include "median3d.h"    /* complement pour les operateurs en cours de developpement */ 
00031 #include <stdlib.h>
00032 #include <math.h>
00033 #include <string.h>
00034 
00035 int main(int argc, char *argv[])
00036 {
00037   /* DECLARATIONS */
00038 
00039   /* images */ 
00040   ima3Du1 imscr;
00041   ima3Du1 imres;
00042 
00043 
00044   median3d_t tMasque;
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   
00050   char NomFicSortant [50];
00051   char NomFicEntrant[50];
00052 
00053 /* LECTURE PARAMETRES */
00054 
00055   /* debut: OBLIGATOIRE pour compatibilite avec les 3 modes de lecture de param */
00056   param_debut(argc, argv, &par0); 
00057   ptp = &par0;      /* regle : ptp pointe sur la structure du parametre suivant */
00058 
00059   /* operateurs: ptp est passe en argument, return fournit la nouvelle position */
00060   ptp = median3d_lect(&tMasque, ptp, ">>median3d question :");
00061 
00062   /* main : en cas de parametres lus dans le main */
00063 
00064   lec_param(">>entrer le chemin et le nom de l'image a traiter", ptp);
00065   strcpy(NomFicEntrant, ptp->rep);
00066   ptp = ptp->next;  
00067   lec_param(">>entrer le chemin et le nom de l'image resulat", ptp);
00068   strcpy(NomFicSortant, ptp->rep);
00069   ptp = ptp->next; 
00070   /* fin: sauvegarde des parametres utilises en mode MANUEL ou FICHIER */
00071   param_fin(argc, argv, &par0);
00072 
00073 
00074 /* INITIALISATION  */
00075 
00076   /* operateur */
00077   printf("\n fichier source %s",NomFicEntrant);
00078   printf("\n fichier dest %s\n",NomFicSortant);
00079   lect_ima3Du1 (NomFicEntrant,&imscr,ALL);
00080   printf (" format de l'image source %d %d %d\n",imscr.dimx,imscr.dimy,imscr.dimz);
00081   median3d_init(&tMasque,imscr,&imres);
00082   /* main : en cas de variable a allouer/initialiser dans le main  */ 
00083   // printf("\n fin init\n");
00084   /* CALCUL */
00085   if (imscr.dimx<tMasque.winX) tMasque.winX=imscr.dimx+imscr.dimx%2-1;
00086   if (imscr.dimy<tMasque.winY) tMasque.winY=imscr.dimy+imscr.dimy%2-1;
00087   if (imscr.dimz<tMasque.winZ) tMasque.winZ=imscr.dimz+imscr.dimz%2-1;
00088   median3d_calc(&tMasque,imscr,&imres); 
00089 
00090   printf("\n fin calcul avec le  masque %dx%dx%d, nomfichierRes: %s\n",
00091          tMasque.winX,tMasque.winY,tMasque.winZ,NomFicSortant);
00092 
00093 /* FREMETURE */
00094   ecr_ima3Du1 (NomFicSortant,&imres);
00095 }
00096 

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