2 ***********************************************************
4 $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/trm6.cpp $
5 $LastChangedRevision: 122 $
6 $Date: 2014-07-09 18:18:59 -0400 (Wed, 09 Jul 2014) $
8 ***********************************************************
12 #include "DistanceMeasureWSQD.h"
19 DistanceMeasureWSQD::DistanceMeasureWSQD() :
20 DistanceMeasurePixel("weighted squared distance") {
22 DistanceMeasureWSQD::~DistanceMeasureWSQD() {
25 REAL DistanceMeasureWSQD::calculateDistanceForPixel(REAL* reconPixel,
26 INTEGER* list, REAL* weight) {
28 // variables needed during computation of the current residual
43 // compute current residual
44 for (int np = 0; np < GeoPar.prjnum; np++) {
45 REAL rinc = GeoPar.pinc;
46 Anglst.getang(np, &theta, &sinth, &costh);
49 rinc = GeoPar.pinc * MAX0(fabs(sinth), fabs(costh));
52 for (int nr = GeoPar.fusray; nr <= GeoPar.lusray; nr++) {
53 raysum = Anglst.prdta(np, nr);
54 psum = pseudo(reconPixel, np, nr, list, weight, &numb, &snorm,
58 // pseudo already evaluates the values for weight/number of affected pixel
60 // ATTENTION: no other operations on weight/numb are allowed between pseudo and this calculation
62 for (int i = 0; i < numb; i++) {
66 if (raylen > Consts.zero) {
67 if (linef && !GeoPar.line)
69 if (!linef && GeoPar.line)
71 wsqd += pow(psum - raysum, 2) / raylen;