00001
00010 #include <stdio.h>
00011 #include <stdlib.h>
00012 #include <math.h>
00013 #include <string.h>
00014 #include <inrimage/image.h>
00015 #include "interpolation.h"
00016
00021 static char Ucmd[]=
00022 "[img3D] [-texture=texture2D] [-time time_level] [-no-repere] [-fdf] [-Subdivmax N] [-nIsoSf nb_isosurfs] [-epsilon E]";
00023
00027 static char Udetail[]=
00028 "affiche l'image en 3D avec openGL, en plaquant l'image texture2D sur l'image en fil de fer, a moins que soit donnee l'option\
00029 fdf(fil de fer). L'image sera basee sur un nombre de subdivisions maximal N precise par -nbSubdivmax, valant 128 par defaut.\
00030 Dans le cas ou on charge un fichier de distance, on pourra preciser un nombre d'isosurfaces voulu, ainsi qu'epsilon la marge\
00031 de decision pour le calcul des isosurfaces";
00032
00033 extern void imerror(int code,char * format,...);
00034
00035 int main(int argc,char ** argv)
00036 {
00037 char img[80],texture2D[80];
00038 int texture_flag=0,time_flag;
00039 int repere_flag=0,fil_de_fer_flag=0,nbSubdiv_max;
00040
00041 char ** noms_images=NULL;
00042 int nb_images=1,nb_voulu=0;
00043 float marge=0;
00044 texture2D[0]='\0';
00045
00046 inr_init(argc,argv,"1.0",Ucmd,Udetail);
00047
00048
00049 infileopt(img);
00050 noms_images=(char **)realloc(noms_images,nb_images*sizeof(char*));
00051 noms_images[nb_images-1]=(char *)malloc(80*sizeof(char));
00052 strcpy(noms_images[nb_images-1],img);
00053
00054 while(infileopt(img))
00055 {
00056 nb_images++;
00057 noms_images=(char **)realloc(noms_images,nb_images*sizeof(char*));
00058 noms_images[nb_images-1]=(char *)malloc(80*sizeof(char));
00059 strcpy(noms_images[nb_images-1],img);
00060 }
00061
00062
00063 if (!nb_images)
00064 {
00065 printf("image d'entree manquante\n");
00066 iusage_(Ucmd,Udetail);
00067 }
00068
00069
00070
00071 if (!igetopt1("-time","%i",&time_flag))
00072 time_flag=0;
00073 texture_flag=igetopt1("-texture","%s",texture2D);
00074 repere_flag=igetopt0("-no-repere");
00075 fil_de_fer_flag=igetopt0("-fdf");
00076 if (!igetopt1("-Subdivmax","%d",&nbSubdiv_max))
00077 nbSubdiv_max=128;
00078 if (!igetopt1("-nIsoSf","%d",&nb_voulu))
00079 nb_voulu=0;
00080 if (!igetopt1("-epsilon","%f",&marge))
00081 marge=-1;
00082
00083
00084 if(tstopts())
00085 iusage_(Ucmd,Udetail);
00086
00087 visualisation(noms_images,nb_images,texture2D,texture_flag,time_flag,repere_flag,fil_de_fer_flag,nbSubdiv_max,nb_voulu,marge,argc,argv);
00088
00089 return EXIT_SUCCESS;
00090 }