Authored by David Mayerich
1 parent e21d1051

### bug fixes for NetMets

Showing 4 changed files with 104 additions and 42 deletions
stim/biomodels/centerline.h

 ... ... @@ -190,7 +190,7 @@ public: 190 190 stim::vec3 p; //- intermediate point to be added 191 191 stim::vec3 p1; // p1 - starting point of an segment on the fiber, 192 192 stim::vec3 p2; // p2 - ending point, 193 - double sum=0; //distance summation 193 + //double sum=0; //distance summation 194 194 195 195 size_t N = size(); 196 196 ... ...
stim/biomodels/network.h

 ... ... @@ -33,16 +33,15 @@ class network{ 33 33 public: 34 34 unsigned v[2]; //unique id's designating the starting and ending 35 35 // default constructor 36 - edge() : cylinder() 37 - { 36 + edge() : cylinder() { 38 37 v[1] = (unsigned)(-1); v[0] = (unsigned)(-1); 39 38 } 40 39 /// Constructor - creates an edge from a list of points by calling the stim::fiber constructor 41 40 42 41 ///@param p is an array of positions in space 43 - edge(std::vector< stim::vec3 > p) : cylinder(p){} 42 + edge(centerline p) : cylinder(p){} 44 43 45 - /// Copy constructor creates an edge from a fiber 44 + /// Copy constructor creates an edge from a cylinder 46 45 edge(stim::cylinder f) : cylinder(f) {} 47 46 48 47 /// Resamples an edge by calling the fiber resampling function ... ... @@ -291,7 +290,7 @@ public: 291 290 std::vector< stim::vec > c; //allocate an array of points for the vessel centerline 292 291 O.getLine(l, c); //get the fiber centerline 293 292 294 - std::vector< stim::vec3 > c3(c.size()); 293 + stim::centerline c3(c.size()); 295 294 for(size_t j = 0; j < c.size(); j++) 296 295 c3[j] = c[j]; 297 296 ... ... @@ -431,7 +430,7 @@ public: 431 430 432 431 /// @param A is the network to compare to - the field is generated for A 433 432 /// @param sigma is the user-defined tolerance value - smaller values provide a stricter comparison 434 - stim::network compare(stim::network A, float sigma, int device){ 433 + stim::network compare(stim::network A, float sigma, int device = -1){ 435 434 436 435 stim::network R; //generate a network storing the result of the comparison 437 436 R = (*this); //initialize the result with the current network ... ... @@ -471,6 +470,7 @@ public: 471 470 T* queryPt = new T[3]; 472 471 for(unsigned e = 0; e < R.E.size(); e++){ //for each edge in A 473 472 R.E[e].add_mag(0); //add a new magnitude for the metric 473 + size_t errormag_id = R.E[e].nmags() - 1; //get the id for the new magnitude 474 474 475 475 for(unsigned p = 0; p < R.E[e].size(); p++){ //for each point in the edge 476 476 ... ... @@ -479,7 +479,7 @@ public: 479 479 kdt.search(queryPt, 1, nnIdx, dists); //find the distance between A and the current network 480 480 481 481 m1 = 1.0f - gaussianFunction((T)dists[0], sigma); //calculate the metric value based on the distance 482 - R.E[e].set_mag(m1, p, 1); //set the error for the second point in the segment 482 + R.E[e].set_mag(errormag_id, p, m1); //set the error for the second point in the segment 483 483 484 484 } 485 485 } ... ...
stim/visualization/cylinder.h