Commit a36c385045865d354d3a9876fa97057fc194c2ae

Authored by Pavel Govyadinov
1 parent 09049866

fixed the bug that cause the segfault

Showing 2 changed files with 7 additions and 16 deletions   Show diff stats
stim/gl/gl_spider.h
@@ -240,6 +240,7 @@ class gl_spider // : public virtual gl_texture<T> @@ -240,6 +240,7 @@ class gl_spider // : public virtual gl_texture<T>
240 if(cL.size() < 4){} ///if the size of the fiber is less then 4 we do nothing. 240 if(cL.size() < 4){} ///if the size of the fiber is less then 4 we do nothing.
241 else{ 241 else{
242 setMatrix(1); ///finds the current transformation matrix 242 setMatrix(1); ///finds the current transformation matrix
  243 +
243 DrawLongCylinder(n, l_template, l_square); ///Draw the cylinder. 244 DrawLongCylinder(n, l_template, l_square); ///Draw the cylinder.
244 stim::cylinder<float> cyl(cL, cM); 245 stim::cylinder<float> cyl(cL, cM);
245 std::vector< stim::vec<float> > result = find_branch(cylinder_texID, GL_TEXTURE_2D, n*l_square, (cL.size()-1)*l_template); ///find all the centers in cuda 246 std::vector< stim::vec<float> > result = find_branch(cylinder_texID, GL_TEXTURE_2D, n*l_square, (cL.size()-1)*l_template); ///find all the centers in cuda
@@ -734,7 +735,6 @@ class gl_spider // : public virtual gl_texture&lt;T&gt; @@ -734,7 +735,6 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
734 gl_spider 735 gl_spider
735 (int samples = 1089, int samplespos = 441,int samplesmag = 144) 736 (int samples = 1089, int samplespos = 441,int samplesmag = 144)
736 { 737 {
737 -// std::cout << "I ran this constructor" << std::endl;  
738 p = stim::vec3<float>(0.0, 0.0, 0.0); 738 p = stim::vec3<float>(0.0, 0.0, 0.0);
739 d = stim::vec3<float>(0.0, 0.0, 1.0); 739 d = stim::vec3<float>(0.0, 0.0, 1.0);
740 m = 1.0; 740 m = 1.0;
@@ -1015,7 +1015,6 @@ class gl_spider // : public virtual gl_texture&lt;T&gt; @@ -1015,7 +1015,6 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1015 void 1015 void
1016 setSeedMag(float mag) 1016 setSeedMag(float mag)
1017 { 1017 {
1018 -// std::cout << "sMag: " << mag << std::endl;  
1019 seedsmags.push(mag); 1018 seedsmags.push(mag);
1020 } 1019 }
1021 1020
@@ -1028,7 +1027,6 @@ class gl_spider // : public virtual gl_texture&lt;T&gt; @@ -1028,7 +1027,6 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1028 void 1027 void
1029 setSeed(float x, float y, float z) 1028 setSeed(float x, float y, float z)
1030 { 1029 {
1031 -// std::cout << "sPos: " << x << " " << y << " " << z << std::endl;  
1032 seeds.push(stim::vec<float>(x, y, z)); 1030 seeds.push(stim::vec<float>(x, y, z));
1033 } 1031 }
1034 1032
@@ -1039,7 +1037,6 @@ class gl_spider // : public virtual gl_texture&lt;T&gt; @@ -1039,7 +1037,6 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1039 void 1037 void
1040 setSeedVec(float x, float y, float z) 1038 setSeedVec(float x, float y, float z)
1041 { 1039 {
1042 -// std::cout << "sDir: " << x << " " << y << " " << z << std::endl;  
1043 seedsvecs.push(stim::vec<float>(x, y, z)); 1040 seedsvecs.push(stim::vec<float>(x, y, z));
1044 } 1041 }
1045 1042
@@ -1375,7 +1372,6 @@ class gl_spider // : public virtual gl_texture&lt;T&gt; @@ -1375,7 +1372,6 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1375 // cL.push_back(curSeed); 1372 // cL.push_back(curSeed);
1376 // cM.push_back(curSeedMag); 1373 // cM.push_back(curSeedMag);
1377 // cD.push_back(curSeedMag); 1374 // cD.push_back(curSeedMag);
1378 - std::cout << p << m << std::endl;  
1379 traceLine(p, m, min_cost); 1375 traceLine(p, m, min_cost);
1380 } 1376 }
1381 } 1377 }
@@ -1564,7 +1560,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt; @@ -1564,7 +1560,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1564 { 1560 {
1565 //starting (seed) position and magnitude. 1561 //starting (seed) position and magnitude.
1566 stim::vec3<float> spos = getPosition(); 1562 stim::vec3<float> spos = getPosition();
1567 - stim::vec<float> smag = getMagnitude(); 1563 + float smag = getMagnitude();
1568 stim::vec3<float> sdir = getDirection(); 1564 stim::vec3<float> sdir = getDirection();
1569 1565
1570 Bind(); 1566 Bind();
@@ -1590,7 +1586,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt; @@ -1590,7 +1586,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1590 running = false; 1586 running = false;
1591 branchDetection2(); 1587 branchDetection2();
1592 addToNetwork(cL, cM); 1588 addToNetwork(cL, cM);
1593 - std::cout << "the cost of " << cost << " > " << min_cost << std::endl; 1589 + std::cerr << "the cost of " << cost << " > " << min_cost << std::endl;
1594 break; 1590 break;
1595 } else { 1591 } else {
1596 //Have we found the edge of the map? 1592 //Have we found the edge of the map?
@@ -1602,7 +1598,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt; @@ -1602,7 +1598,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1602 running = false; 1598 running = false;
1603 branchDetection2(); 1599 branchDetection2();
1604 addToNetwork(cL, cM); 1600 addToNetwork(cL, cM);
1605 - std::cout << "I hit and edge" << std::endl; 1601 + std::cerr << "I hit and edge" << std::endl;
1606 break; 1602 break;
1607 } 1603 }
1608 //If this is the first step in the trace, 1604 //If this is the first step in the trace,
@@ -1618,7 +1614,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt; @@ -1618,7 +1614,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1618 running = false; 1614 running = false;
1619 branchDetection2(); 1615 branchDetection2();
1620 addToNetwork(cL, cM); 1616 addToNetwork(cL, cM);
1621 - std::cout << "The templates are too big" << std::endl; 1617 + std::cerr << "The templates are too big" << std::endl;
1622 break; 1618 break;
1623 } 1619 }
1624 else 1620 else
@@ -1626,7 +1622,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt; @@ -1626,7 +1622,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1626 h = selectObject(p, getDirection(), m); 1622 h = selectObject(p, getDirection(), m);
1627 //Have we hit something previously traced? 1623 //Have we hit something previously traced?
1628 if(h != -1){ 1624 if(h != -1){
1629 - std::cout << "I hit the fiber " << h << std::endl; 1625 + std::cerr << "I hit the fiber " << h << std::endl;
1630 running = false; 1626 running = false;
1631 branchDetection2(); 1627 branchDetection2();
1632 addToNetwork(cL, cM); 1628 addToNetwork(cL, cM);
stim/visualization/cylinder.h
@@ -221,13 +221,8 @@ class cylinder @@ -221,13 +221,8 @@ class cylinder
221 : centerline<T>(inP) 221 : centerline<T>(inP)
222 { 222 {
223 std::vector<stim::vec<T> > temp; 223 std::vector<stim::vec<T> > temp;
224 - stim::vec<T> zero; 224 + stim::vec<T> zero(0.0,0.0);
225 temp.resize(inM.size(), zero); 225 temp.resize(inM.size(), zero);
226 - for(int i = 0; i < inM.size(); i++)  
227 - {  
228 - std::cerr << inP[i] << " " << inM[i] << std::endl;  
229 - temp[i][0] = inM[i];  
230 - }  
231 init(inP, temp); 226 init(inP, temp);
232 } 227 }
233 228