2 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
6 * A PICTURE RECONSTRUCTION PROGRAM *
8 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
10 stru_acc.c,v 1.4 2009/06/01 03:33:26 jklukowska Exp
12 Previously part of SuperSNARK
16 #include "experimenter.h"
18 #include "read_eval_recon1.h"
19 #include "read_eval_phantom1.h"
21 /* ----------------------------- stru_acc.c -------------------------------
23 This function computes the structural accuracy.
26 itr1 - array of length niters containing the iteration numbers for the
28 itr2 - array of length niters containing the iteration numbers for the
30 niters - number of iterations to be compared
31 keywrd1 - string containing the keyword which defines the first algorithm.
32 keywrd2 - string containing the keyword which defines the second algorithm.
35 str_acc1 - array of length niters containing the structural accuracy for
37 str_acc2 - array of length niters containing the structural accuracy for
42 void stru_acc(int* itr1, int* itr2, int niters, char* keywrd1, char* keywrd2, double* str_acc1, double* str_acc2)
43 //int *itr1,*itr2,niters;
44 //char *keywrd1,*keywrd2;
45 //double *str_acc1,*str_acc2;
47 double *phantom, *recon1, *recon2;
48 int *regions, numstr, i, j, *strarea;
50 /* read in abnormality index for phantom structures */
52 read_eval_phantom1(®ions, &numstr, &phantom, &strarea);
54 /* allocate memory to store abnormality indexes for
55 structures in the reconstructions*/
57 recon1 = (double *) malloc(numstr * sizeof (double));
58 recon2 = (double *) malloc(numstr * sizeof (double));
60 for (i = 0; i < niters; i++) { /* read in abnormality indexes for structures in
61 the reconstructions. Initialize the arrays
62 which will store the structural accuracy */
64 read_eval_recon1(&itr1[i], keywrd1, numstr, recon1);
65 read_eval_recon1(&itr2[i], keywrd2, numstr, recon2);
68 for (j = 0; j < numstr; j++) { /* compute structural accuracy for both algorithms */
70 str_acc1[i] = str_acc1[i] + fabs(recon1[j] - phantom[j]);
71 str_acc2[i] = str_acc2[i] + fabs(recon2[j] - phantom[j]);
73 str_acc1[i] = -str_acc1[i] / numstr; /* structural */
74 str_acc2[i] = -str_acc2[i] / numstr; /* accuracy */
77 free(phantom); /* free memory for next function call */