Initial snark14m import
[snark14.git] / src / snark / check_if_iroi.c
1 /*
2  ***********************************************************
3  $SNARK_Header: S N A R K  1 4 - A PICTURE RECONSTRUCTION PROGRAM $
4  $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/check_if_iroi.c $
5  $LastChangedRevision: 85 $
6  $Date: 2014-07-02 16:07:08 -0400 (Wed, 02 Jul 2014) $
7  $Author: agulati $
8  ***********************************************************
9
10  Previously part of SuperSNARK
11  */
12
13 #include <string.h>
14 #include <strings.h>
15
16 #include "check_if_iroi.h"
17 #include "experimenter.h"
18 #include "errorc.h"
19 #include "analyze.h"
20 #include "getfom.h"
21
22 void check_if_iroi(char * anaflname, //name of ANALYSIS file
23                 int * iroi_used //flag to be set if IROI fom is to be used
24                 )
25 {
26         int stru, poin, hitr, usr1, usr2, usr3, usr4, usr5, iroi;
27
28         char string[MAXLINESIZE], key1[50], line[MAXLINESIZE], key2[50],
29                         keywrd1[50], keywrd2[50];
30
31         FILE *anafl; //ANALYSIS file
32
33         *iroi_used = 0;
34
35         //open anaflname for reading
36         strcpy(line, "In check_if_iroi.c: error in file");
37         sprintf(line, "%s %s at line ", line, anaflname);
38
39         if ((anafl = fopen(anaflname, "r")) == NULL)
40         {
41                 errorc("in check_if_iroi.c: error in opening file ", anaflname);
42         }
43
44         while (fgets(string, sizeof(string), anafl) != NULL)
45         {
46                 if (strncasecmp(string, "comp", 4) == 0)
47                 {
48                         if ((strcasestr(string, "IROI") != NULL))
49                         {
50                                 *iroi_used = 1;
51                         }
52                 }
53
54         }
55
56         fclose(anafl);
57
58         return;
59
60 } //end of check_if_iroi ( )
61