Program: gdcm
Module: $RCSfile: gdcmFile.cxx,v $
Language: C++
- Date: $Date: 2005/07/22 03:33:13 $
- Version: $Revision: 1.256 $
+ Date: $Date: 2005/07/24 00:24:46 $
+ Version: $Revision: 1.261 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include <vector>
#include <stdio.h> //sscanf
#include <stdlib.h> // for atoi
-#include <math.h> // for powf
+#include <math.h> // for pow
namespace gdcm
{
RLEInfo = new RLEFramesInfo;
JPEGInfo = new JPEGFragmentsInfo;
- Load( filename ); // gdcm::Document is first Loaded, then the 'File part'
+ SetFileName( filename );
+ Load( ); // gdcm::Document is first Loaded, then the 'File part'
}
/**
}
+// FIXME. Seriously who wrote that !
+// Haven't you ever heard of so called reference in c++
Res File::VerfCriterion(int typeCriterion, float criterionNew, Res res)
{
- float type = res.first;
float criterion = res.second;
if (criterionNew < criterion)
{
return res;
}
-float File::CalculLikelyhood2Vec(vector3D refA, vector3D refB,
- vector3D ori1, vector3D ori2)
+inline double square_dist(vector3D const &v1, vector3D const & v2)
+{
+ double res;
+ res = (v1.x - v2.x)*(v1.x - v2.x) +
+ (v1.y - v2.y)*(v1.y - v2.y) +
+ (v1.z - v2.z)*(v1.z - v2.z);
+ return res;
+}
+
+float File::CalculLikelyhood2Vec(vector3D const & refA, vector3D const &refB,
+ vector3D const & ori1, vector3D const &ori2)
{
// # ------------------------- Purpose : -----------------------------------
// # - This function determines the orientation similarity of two planes.
vector3D ori3 = ProductVectorial(ori1,ori2);
vector3D refC = ProductVectorial(refA,refB);
- float res = powf(refC.x-ori3.x, 2.) +
- powf(refC.y-ori3.y, 2.) +
- powf(refC.z-ori3.z, 2.);
+ double res = square_dist(refC, ori3);
/*
// ori3=self.ProductVectorial(ori1,ori2)
return sqrt(res);
}
-vector3D File::ProductVectorial(vector3D vec1, vector3D vec2)
+vector3D File::ProductVectorial(vector3D const & vec1, vector3D const & vec2)
{
// # ------------------------- Purpose : -----------------------------------
// # ------------------------- Other : -------------------------------------
vector3D vec3;
- vec3.x = vec1.y*vec3.z - vec1.z*vec2.y;
+ vec3.x = vec1.y*vec2.z - vec1.z*vec2.y;
vec3.y = -( vec1.x*vec2.z - vec1.z*vec2.x);
vec3.z = vec1.x*vec2.y - vec1.y*vec2.x;
/*