Initial snark14m import
[snark14.git] / src / snark / sec_cri1.cpp
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/sec_cri1.cpp $
5  $LastChangedRevision: 107 $
6  $Date: 2014-07-07 12:06:15 -0400 (Mon, 07 Jul 2014) $
7  $Author: olangthaler $
8  ***********************************************************
9  */
10
11 #include "sec_cri1.h"
12 #include "math.h"
13 #include "anglst.h"
14 #include "blob.h"
15
16 using namespace std;
17
18 REAL sec_cri1_class::Run(REAL* image)
19 {
20         INTEGER dimensions = GeoPar.nelem;
21         // pixels over which to iterate (skip last line and new bottom right pixel)
22         INTEGER pixelcount = GeoPar.area - dimensions - 2;
23
24         REAL tau = 0;
25         for (INTEGER i = 1; i < pixelcount; i++)
26         {
27                 // skip right-most column
28                 if (i % (dimensions) == 0) continue;
29
30                 tau += sqrt(pow(image[i - 1] - image[i - 1 + dimensions], 2) + pow(image[i - 1] - image[i], 2));
31         }
32
33         return tau;
34 }