Commit 62d95dcd31d679da63b494a86df736fb9ee08d14
1 parent
457c060f
fixed resample bugs
Showing
2 changed files
with
9 additions
and
4 deletions
Show diff stats
stim/biomodels/centerline.h
@@ -227,7 +227,7 @@ public: | @@ -227,7 +227,7 @@ public: | ||
227 | } | 227 | } |
228 | } | 228 | } |
229 | 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 | 229 | 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 |
230 | - new_c.push_back(at(f+1)); | 230 | + new_c.push_back(at(f)); |
231 | } | 231 | } |
232 | new_c.push_back(at(N-1)); //add the last point on the fiber to the new fiber list | 232 | new_c.push_back(at(N-1)); //add the last point on the fiber to the new fiber list |
233 | //centerline newFiber(newPointList); | 233 | //centerline newFiber(newPointList); |
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 | @@ -46,7 +46,7 @@ __global__ void d_findedge(size_t* I, size_t n, unsigned* R, size_t* E, size_t n | ||
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | //hard-coded factor | 48 | //hard-coded factor |
49 | -int threshold_fac = 10; | 49 | +int threshold_fac = 0; |
50 | 50 | ||
51 | namespace stim{ | 51 | namespace stim{ |
52 | /** This is the a class that interfaces with gl_spider in order to store the currently | 52 | /** This is the a class that interfaces with gl_spider in order to store the currently |
@@ -782,15 +782,20 @@ public: | @@ -782,15 +782,20 @@ public: | ||
782 | unsigned int id = 0; // split value | 782 | unsigned int id = 0; // split value |
783 | for(unsigned e = 0; e < E.size(); e++){ // for every edge | 783 | for(unsigned e = 0; e < E.size(); e++){ // for every edge |
784 | for(unsigned p = 0; p < E[e].size() - 1; p++){ // for every point in each edge | 784 | for(unsigned p = 0; p < E[e].size() - 1; p++){ // for every point in each edge |
785 | + int t = E[e].length() / sigma * 2; | ||
786 | + if (t <= 20) | ||
787 | + threshold_fac = E[e].size(); | ||
788 | + else | ||
789 | + threshold_fac = (E[e].length() / sigma * 2)/10; | ||
785 | if(relation[e][p] != relation[e][p + 1]){ // find the nearest edge changing point | 790 | if(relation[e][p] != relation[e][p + 1]){ // find the nearest edge changing point |
786 | id = p + 1; // if there is no change in NN | 791 | id = p + 1; // if there is no change in NN |
787 | - 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! | 792 | + if(id < threshold_fac || (E[e].size() - id) < threshold_fac) |
788 | id = E[e].size() - 1; // extreme situation is not acceptable | 793 | id = E[e].size() - 1; // extreme situation is not acceptable |
789 | else | 794 | else |
790 | break; | 795 | break; |
791 | } | 796 | } |
792 | if(p == E[e].size() - 2) // if there is no splitting index, set the id to the last point index of current edge | 797 | if(p == E[e].size() - 2) // if there is no splitting index, set the id to the last point index of current edge |
793 | - id = p + 1; | 798 | + id = E[e].size() - 1; |
794 | } | 799 | } |
795 | //unsigned errormag_id = E[e].nmags() - 1; | 800 | //unsigned errormag_id = E[e].nmags() - 1; |
796 | T G = 0; // test to see whether it has its nearest neighbor | 801 | T G = 0; // test to see whether it has its nearest neighbor |