From 62d95dcd31d679da63b494a86df736fb9ee08d14 Mon Sep 17 00:00:00 2001 From: Jiaming Guo Date: Tue, 17 Jan 2017 14:45:11 -0600 Subject: [PATCH] fixed resample bugs --- stim/biomodels/centerline.h | 2 +- stim/biomodels/network.h | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/stim/biomodels/centerline.h b/stim/biomodels/centerline.h index 1aa7563..4b3b5bf 100644 --- a/stim/biomodels/centerline.h +++ b/stim/biomodels/centerline.h @@ -227,7 +227,7 @@ public: } } else // length of the segment is now less than standard deviation, push the ending point of the segment and proceed to the next point in the fiber - new_c.push_back(at(f+1)); + new_c.push_back(at(f)); } new_c.push_back(at(N-1)); //add the last point on the fiber to the new fiber list //centerline newFiber(newPointList); diff --git a/stim/biomodels/network.h b/stim/biomodels/network.h index 97f34a1..4559390 100644 --- a/stim/biomodels/network.h +++ b/stim/biomodels/network.h @@ -46,7 +46,7 @@ __global__ void d_findedge(size_t* I, size_t n, unsigned* R, size_t* E, size_t n #endif //hard-coded factor -int threshold_fac = 10; +int threshold_fac = 0; namespace stim{ /** This is the a class that interfaces with gl_spider in order to store the currently @@ -782,15 +782,20 @@ public: unsigned int id = 0; // split value for(unsigned e = 0; e < E.size(); e++){ // for every edge for(unsigned p = 0; p < E[e].size() - 1; p++){ // for every point in each edge + int t = E[e].length() / sigma * 2; + if (t <= 20) + threshold_fac = E[e].size(); + else + threshold_fac = (E[e].length() / sigma * 2)/10; if(relation[e][p] != relation[e][p + 1]){ // find the nearest edge changing point id = p + 1; // if there is no change in NN - if(id < E[e].size()/threshold_fac || (E[e].size() - id) < E[e].size()/threshold_fac) // set tolerance to 10, tentatively--should find out the mathematical threshold! + if(id < threshold_fac || (E[e].size() - id) < threshold_fac) id = E[e].size() - 1; // extreme situation is not acceptable else break; } if(p == E[e].size() - 2) // if there is no splitting index, set the id to the last point index of current edge - id = p + 1; + id = E[e].size() - 1; } //unsigned errormag_id = E[e].nmags() - 1; T G = 0; // test to see whether it has its nearest neighbor -- libgit2 0.21.4