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 240 if(cL.size() < 4){} ///if the size of the fiber is less then 4 we do nothing.
241 241 else{
242 242 setMatrix(1); ///finds the current transformation matrix
  243 +
243 244 DrawLongCylinder(n, l_template, l_square); ///Draw the cylinder.
244 245 stim::cylinder<float> cyl(cL, cM);
245 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 735 gl_spider
735 736 (int samples = 1089, int samplespos = 441,int samplesmag = 144)
736 737 {
737   -// std::cout << "I ran this constructor" << std::endl;
738 738 p = stim::vec3<float>(0.0, 0.0, 0.0);
739 739 d = stim::vec3<float>(0.0, 0.0, 1.0);
740 740 m = 1.0;
... ... @@ -1015,7 +1015,6 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1015 1015 void
1016 1016 setSeedMag(float mag)
1017 1017 {
1018   -// std::cout << "sMag: " << mag << std::endl;
1019 1018 seedsmags.push(mag);
1020 1019 }
1021 1020  
... ... @@ -1028,7 +1027,6 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1028 1027 void
1029 1028 setSeed(float x, float y, float z)
1030 1029 {
1031   -// std::cout << "sPos: " << x << " " << y << " " << z << std::endl;
1032 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 1037 void
1040 1038 setSeedVec(float x, float y, float z)
1041 1039 {
1042   -// std::cout << "sDir: " << x << " " << y << " " << z << std::endl;
1043 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 1372 // cL.push_back(curSeed);
1376 1373 // cM.push_back(curSeedMag);
1377 1374 // cD.push_back(curSeedMag);
1378   - std::cout << p << m << std::endl;
1379 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 1560 {
1565 1561 //starting (seed) position and magnitude.
1566 1562 stim::vec3<float> spos = getPosition();
1567   - stim::vec<float> smag = getMagnitude();
  1563 + float smag = getMagnitude();
1568 1564 stim::vec3<float> sdir = getDirection();
1569 1565  
1570 1566 Bind();
... ... @@ -1590,7 +1586,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1590 1586 running = false;
1591 1587 branchDetection2();
1592 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 1590 break;
1595 1591 } else {
1596 1592 //Have we found the edge of the map?
... ... @@ -1602,7 +1598,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1602 1598 running = false;
1603 1599 branchDetection2();
1604 1600 addToNetwork(cL, cM);
1605   - std::cout << "I hit and edge" << std::endl;
  1601 + std::cerr << "I hit and edge" << std::endl;
1606 1602 break;
1607 1603 }
1608 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 1614 running = false;
1619 1615 branchDetection2();
1620 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 1618 break;
1623 1619 }
1624 1620 else
... ... @@ -1626,7 +1622,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
1626 1622 h = selectObject(p, getDirection(), m);
1627 1623 //Have we hit something previously traced?
1628 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 1626 running = false;
1631 1627 branchDetection2();
1632 1628 addToNetwork(cL, cM);
... ...
stim/visualization/cylinder.h
... ... @@ -221,13 +221,8 @@ class cylinder
221 221 : centerline<T>(inP)
222 222 {
223 223 std::vector<stim::vec<T> > temp;
224   - stim::vec<T> zero;
  224 + stim::vec<T> zero(0.0,0.0);
225 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 226 init(inP, temp);
232 227 }
233 228  
... ...