00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00028 #include "image.h"
00029 #include "volume.h"
00030 #include "M_coocur.h"
00031 #include <stdlib.h>
00032 #include <math.h>
00033 #include <string.h>
00034
00035 extern GlcmAttribute attributes[];
00036 int main(int argc, char *argv[])
00037 {
00038
00039
00040
00041 ima3Du1 imscr;
00042 ima3Dd *imres[total_attributes];
00043 int i, s;
00044
00045 Mcoocur_t des;
00046
00047
00048 param par0, *ptp;
00049
00050 char *NomFicSortant;
00051 char *NomFicEntrant;
00052 char *tmp, *tmp2;
00053
00054
00055
00056
00057 param_debut(argc, argv, &par0);
00058 ptp = &par0;
00059
00060
00061 ptp = Mcoocur_lect(&des, ptp, ">>Matrice de coocurance question :");
00062
00063
00064
00065 lec_param(">>entrer le chemin et le nom de l'image a traiter", ptp);
00066 NomFicEntrant = strdup(ptp->rep);
00067 ptp = ptp->next;
00068 lec_param(">>entrer le chemin et le nom de l'image resultat", ptp);
00069 s = strlen(ptp->rep);
00070 NomFicSortant = (char *) malloc(s + 1 + 3);
00071
00072
00073 strcpy(NomFicSortant, ptp->rep);
00074 tmp2 = strrchr(NomFicSortant, '.');
00075 if (tmp2 == 0)
00076 tmp2 = NomFicSortant + strlen(NomFicSortant);
00077 strcpy(tmp2, "_%s");
00078 tmp2 += 3;
00079 tmp = strrchr(ptp->rep, '.');
00080 if (tmp != 0)
00081 strcpy(tmp2, tmp);
00082 tmp2 -= 2;
00083 ptp = ptp->next;
00084
00085 param_fin(argc, argv, &par0);
00086
00087 printf("fin de la lecture\n");
00088
00089
00090
00091
00092
00093 lect_volume_u1( NomFicEntrant, &imscr);
00094 printf("Lecture image OK\n");
00095 Mcoocur_init(&des, &imscr, imres);
00096 printf("init OK\n");
00097
00098
00099
00100 Mcoocur_calc(&des, &imscr, imres);
00101 printf("calc OK\n");
00102
00103
00104
00105
00106 tmp = (char *) malloc(s + 1 + 4 + 1);
00107 for (i = 0; i < total_attributes; i++)
00108 if (des.do_output[i]) {
00109 snprintf(tmp, s + 4 + 1, NomFicSortant, attributes[i].short_name);
00110 ecr_ima3Dd(tmp, imres[i]);
00111 }
00112 }