00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00033 #include "image.h"
00034 #include "proto2D.h"
00035 #include "histo.h"
00036
00037 int main(int argc, char *argv[]){
00038
00039
00040
00041 imau1 im0u1;
00042 imau2 im0u2;
00043 imafl im0fl;
00044 imau1 mas;
00045
00046
00047 read_ima_t rea, reamas;
00048 histo_t hist;
00049
00050
00051 param par0, *ptp;
00052 char nommas[200];
00053 int l, t0;
00054
00055
00056
00057
00058 param_debut(argc, argv, &par0);
00059 ptp = &par0;
00060 ptp = read_ima_lect(&rea, ptp, ">> image initiale :");
00061 ptp = histo_lect(&hist, ptp, ">> histograme :");
00062
00063
00064 lec_param(">> nom image masque type u1 (.ima|.ras), 0 si aucun masque :", ptp);
00065 strcpy(nommas, ptp->rep);
00066 ptp = ptp->next;
00067 if( hist.ngm >= 0){
00068 l = strlen(nommas);
00069 do
00070 l--;
00071 while(nommas[l] != '.' && l>0);
00072 if( l>0 ){
00073 strncpy(reamas.nom, nommas, l);
00074 reamas.nom[l] = '\0';
00075 strcpy(reamas.ext, nommas+l+1);
00076 }
00077 else{
00078 printf("\n>>mhisto ERREUR : nom image masque incomplet (extension?)\n");
00079 exit(1);
00080 }
00081 }
00082 param_fin(argc, argv, &par0);
00083
00084
00085
00086
00087
00088 if( hist.ngm >= 0)
00089 read_imau1_init(&reamas, &mas);
00090
00091 if( !strcmp(rea.ext, "ima") || !strcmp(rea.ext, "ras")){
00092 t0 = 1;
00093 read_imau1_init(&rea, &im0u1);
00094 histou1_init(&hist, im0u1, mas);
00095 }
00096 else if(!strcmp(rea.ext, "imw")){
00097 t0 = 2;
00098 read_imau2_init(&rea, &im0u2);
00099 histou2_init(&hist, im0u2, mas);
00100 }
00101 else if(!strcmp(rea.ext, "imf")){
00102 t0 = 4;
00103 read_imafl_init(&rea, &im0fl);
00104 histofl_init(&hist, im0fl, mas);
00105 }
00106 else{
00107 printf("\n >>mhisto ERREUR : extension %s inconnue\n", rea.ext);
00108 exit(0);
00109 }
00110
00111
00112 switch(t0){
00113 case 1 :
00114 histou1_calc(&hist, im0u1, mas);
00115 break;
00116 case 2 :
00117 histou2_calc(&hist, im0u2, mas);
00118 break;
00119 case 4 :
00120 histofl_calc(&hist, im0fl, mas);
00121 break;
00122 }
00123
00124
00125
00126
00127 histo_ferm(&hist);
00128 }
00129
00130