Commit 035d798f5b89a6f60dab19e6c5c24ef2c1f73fd6
1 parent
ac430567
modified the spider to have a separate buffer for each of the predictor correcto…
…r algorithms. Now using ~400 position and ~100 size templates.
Showing
3 changed files
with
88 additions
and
65 deletions
Show diff stats
stim/cuda/spider_cost.cuh
@@ -150,7 +150,7 @@ namespace stim{ | @@ -150,7 +150,7 @@ namespace stim{ | ||
150 | 150 | ||
151 | // stringstream name; //for debugging | 151 | // stringstream name; //for debugging |
152 | // name << "Test.bmp"; | 152 | // name << "Test.bmp"; |
153 | -// stim::gpu2image<float>(print, name.str(),16,218,0,1); | 153 | +// stim::gpu2image<float>(print, name.str(),16,218,0,256); |
154 | 154 | ||
155 | t.UnmapCudaTexture(); | 155 | t.UnmapCudaTexture(); |
156 | cleanUP(); | 156 | cleanUP(); |
stim/gl/gl_spider.h
@@ -74,11 +74,15 @@ class gl_spider : public virtual gl_texture<T> | @@ -74,11 +74,15 @@ class gl_spider : public virtual gl_texture<T> | ||
74 | 74 | ||
75 | GLuint mfboID; //buffer object for magnitude adjustment. | 75 | GLuint mfboID; //buffer object for magnitude adjustment. |
76 | GLuint mtexbufferID; //texture object for magnitude adjustment. | 76 | GLuint mtexbufferID; //texture object for magnitude adjustment. |
77 | - GLuint bfboId; //buffer object for position adjustment. | 77 | + GLuint bfboID; //buffer object for position adjustment. |
78 | GLuint btexbufferID; //buffer object for position adjustment. | 78 | GLuint btexbufferID; //buffer object for position adjustment. |
79 | 79 | ||
80 | int numSamples; //The number of templates in the buffer. | 80 | int numSamples; //The number of templates in the buffer. |
81 | - float stepsize = 4.0; //Step size. | 81 | + int numSamplesPos; |
82 | + int numSamplesMag; | ||
83 | + | ||
84 | +// float stepsize = 4.0; //Step size. | ||
85 | + float stepsize = 3.0; //Step size. | ||
82 | int current_cost; //variable to store the cost of the current step. | 86 | int current_cost; //variable to store the cost of the current step. |
83 | 87 | ||
84 | 88 | ||
@@ -113,7 +117,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -113,7 +117,7 @@ class gl_spider : public virtual gl_texture<T> | ||
113 | { | 117 | { |
114 | setMatrix(); //create the transformation matrix. | 118 | setMatrix(); //create the transformation matrix. |
115 | glCallList(dList); //move the templates to p, d, m. | 119 | glCallList(dList); //move the templates to p, d, m. |
116 | - int best = getCost(); //find min cost. | 120 | + int best = getCost(texbufferID,numSamples); //find min cost. |
117 | stim::vec<float> next( //find next vector. | 121 | stim::vec<float> next( //find next vector. |
118 | dV[best][0]*S[0]*R[0], | 122 | dV[best][0]*S[0]*R[0], |
119 | dV[best][1]*S[1]*R[1], | 123 | dV[best][1]*S[1]*R[1], |
@@ -135,7 +139,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -135,7 +139,7 @@ class gl_spider : public virtual gl_texture<T> | ||
135 | { | 139 | { |
136 | setMatrix(); //create the transformation matrix. | 140 | setMatrix(); //create the transformation matrix. |
137 | glCallList(dList+1); //move the templates to p, d, m. | 141 | glCallList(dList+1); //move the templates to p, d, m. |
138 | - int best = getCost(); //find min cost. | 142 | + int best = getCost(ptexbufferID, numSamplesPos); //find min cost. |
139 | stim::vec<float> next( //find next position. | 143 | stim::vec<float> next( //find next position. |
140 | pV[best][0], | 144 | pV[best][0], |
141 | pV[best][1], | 145 | pV[best][1], |
@@ -157,7 +161,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -157,7 +161,7 @@ class gl_spider : public virtual gl_texture<T> | ||
157 | { | 161 | { |
158 | setMatrix(); //create the transformation. | 162 | setMatrix(); //create the transformation. |
159 | glCallList(dList+2); //move the templates to p, d, m. | 163 | glCallList(dList+2); //move the templates to p, d, m. |
160 | - int best = getCost(); //get best cost. | 164 | + int best = getCost(mtexbufferID, numSamplesMag); //get best cost. |
161 | setMagnitude(m[0]*mV[best][0]); //adjust the magnitude. | 165 | setMagnitude(m[0]*mV[best][0]); //adjust the magnitude. |
162 | } | 166 | } |
163 | 167 | ||
@@ -288,7 +292,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -288,7 +292,7 @@ class gl_spider : public virtual gl_texture<T> | ||
288 | 292 | ||
289 | //Set up the variable necessary for vector creation. | 293 | //Set up the variable necessary for vector creation. |
290 | vec<float> temp(0,0,0); | 294 | vec<float> temp(0,0,0); |
291 | - int dim = (sqrt(numSamples)-1)/2; //number of position vectors. | 295 | + int dim = (sqrt(numSamplesPos)-1)/2; //number of position vectors. |
292 | stim::rect<float> samplingPlane = //plane from which we pull position samples | 296 | stim::rect<float> samplingPlane = //plane from which we pull position samples |
293 | stim::rect<float>(p, d); | 297 | stim::rect<float>(p, d); |
294 | samplingPlane.scale(mag[0]*delta, mag[0]*delta); | 298 | samplingPlane.scale(mag[0]*delta, mag[0]*delta); |
@@ -338,15 +342,15 @@ class gl_spider : public virtual gl_texture<T> | @@ -338,15 +342,15 @@ class gl_spider : public virtual gl_texture<T> | ||
338 | vec<float> dir(0.0, 0.0, 1.0); | 342 | vec<float> dir(0.0, 0.0, 1.0); |
339 | 343 | ||
340 | //Set up the variable necessary for vector creation. | 344 | //Set up the variable necessary for vector creation. |
341 | - int dim = (sqrt(numSamples)-1)/2; | 345 | + int dim = (sqrt(numSamplesMag)-1)/2; |
342 | float min = 1.0-delta; | 346 | float min = 1.0-delta; |
343 | float max = 1.0+delta; | 347 | float max = 1.0+delta; |
344 | - float step = (max-min)/(numSamples-1); | 348 | + float step = (max-min)/(numSamplesMag-1); |
345 | float factor; | 349 | float factor; |
346 | vec<float> temp(0.0,0.0,0.0); | 350 | vec<float> temp(0.0,0.0,0.0); |
347 | 351 | ||
348 | glNewList(dList+2, GL_COMPILE); | 352 | glNewList(dList+2, GL_COMPILE); |
349 | - for(int i = 0; i < numSamples; i++){ | 353 | + for(int i = 0; i < numSamplesMag; i++){ |
350 | //Create linear index | 354 | //Create linear index |
351 | factor = (min+step*i)*mag[0]; | 355 | factor = (min+step*i)*mag[0]; |
352 | temp = factor; | 356 | temp = factor; |
@@ -585,8 +589,8 @@ class gl_spider : public virtual gl_texture<T> | @@ -585,8 +589,8 @@ class gl_spider : public virtual gl_texture<T> | ||
585 | GLenum DrawBuffers[1] = {GL_COLOR_ATTACHMENT0}; | 589 | GLenum DrawBuffers[1] = {GL_COLOR_ATTACHMENT0}; |
586 | glDrawBuffers(1, DrawBuffers); | 590 | glDrawBuffers(1, DrawBuffers); |
587 | glBindTexture(GL_TEXTURE_2D, textureID); | 591 | glBindTexture(GL_TEXTURE_2D, textureID); |
588 | - glClearColor(1,1,1,1); | ||
589 | - glClear(GL_COLOR_BUFFER_BIT); | 592 | +// glClearColor(1,1,1,1); |
593 | +// glClear(GL_COLOR_BUFFER_BIT); | ||
590 | glMatrixMode(GL_PROJECTION); | 594 | glMatrixMode(GL_PROJECTION); |
591 | glLoadIdentity(); | 595 | glLoadIdentity(); |
592 | glMatrixMode(GL_MODELVIEW); | 596 | glMatrixMode(GL_MODELVIEW); |
@@ -629,7 +633,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -629,7 +633,7 @@ class gl_spider : public virtual gl_texture<T> | ||
629 | findOptimalPosition(); | 633 | findOptimalPosition(); |
630 | findOptimalScale(); | 634 | findOptimalScale(); |
631 | Unbind(); | 635 | Unbind(); |
632 | - Bind(btexbufferID, bfboId, 27); | 636 | + Bind(btexbufferID, bfboID, 27); |
633 | branchDetection(); | 637 | branchDetection(); |
634 | Unbind(); | 638 | Unbind(); |
635 | 639 | ||
@@ -670,6 +674,23 @@ class gl_spider : public virtual gl_texture<T> | @@ -670,6 +674,23 @@ class gl_spider : public virtual gl_texture<T> | ||
670 | return cost[0]; | 674 | return cost[0]; |
671 | } | 675 | } |
672 | 676 | ||
677 | + int | ||
678 | + getCost(GLuint tID, int n) | ||
679 | + { | ||
680 | + #ifdef TESTING | ||
681 | + start = std::clock(); | ||
682 | + #endif | ||
683 | + stim::vec<int> cost = | ||
684 | + stim::cuda::get_cost(tID, GL_TEXTURE_2D, n); | ||
685 | + cudaDeviceSynchronize(); | ||
686 | + #ifdef TESTING | ||
687 | + duration_cuda = duration_cuda + | ||
688 | + (std::clock() - start) / (double) CLOCKS_PER_SEC; | ||
689 | + num_cuda = num_cuda + 1.0; | ||
690 | + #endif | ||
691 | + current_cost = cost[1]; | ||
692 | + return cost[0]; | ||
693 | + } | ||
673 | 694 | ||
674 | public: | 695 | public: |
675 | 696 | ||
@@ -706,7 +727,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -706,7 +727,7 @@ class gl_spider : public virtual gl_texture<T> | ||
706 | ///Best results if samples is can create a perfect root. | 727 | ///Best results if samples is can create a perfect root. |
707 | ///Default Constructor | 728 | ///Default Constructor |
708 | gl_spider | 729 | gl_spider |
709 | - (int samples = 1089) | 730 | + (int samples = 1089, int samplespos = 400,int samplesmag = 144) |
710 | { | 731 | { |
711 | p = vec<float>(0.0, 0.0, 0.0); | 732 | p = vec<float>(0.0, 0.0, 0.0); |
712 | d = vec<float>(0.0, 0.0, 1.0); | 733 | d = vec<float>(0.0, 0.0, 1.0); |
@@ -714,6 +735,8 @@ class gl_spider : public virtual gl_texture<T> | @@ -714,6 +735,8 @@ class gl_spider : public virtual gl_texture<T> | ||
714 | S = vec<float>(1.0, 1.0, 1.0); | 735 | S = vec<float>(1.0, 1.0, 1.0); |
715 | R = vec<float>(1.0, 1.0, 1.0); | 736 | R = vec<float>(1.0, 1.0, 1.0); |
716 | numSamples = samples; | 737 | numSamples = samples; |
738 | + numSamplesPos = samplespos; | ||
739 | + numSamplesMag = samplesmag; | ||
717 | } | 740 | } |
718 | 741 | ||
719 | ///Position constructor: floats. | 742 | ///Position constructor: floats. |
@@ -727,14 +750,16 @@ class gl_spider : public virtual gl_texture<T> | @@ -727,14 +750,16 @@ class gl_spider : public virtual gl_texture<T> | ||
727 | ///@param int samples, number of templates this spider is going to use. | 750 | ///@param int samples, number of templates this spider is going to use. |
728 | gl_spider | 751 | gl_spider |
729 | (float pos_x, float pos_y, float pos_z, float dir_x, float dir_y, float dir_z, | 752 | (float pos_x, float pos_y, float pos_z, float dir_x, float dir_y, float dir_z, |
730 | - float mag_x, int numSamples = 1089) | 753 | + float mag_x, int numsamples = 1089, int numsamplespos = 400, int numsamplesmag =144) |
731 | { | 754 | { |
732 | p = vec<float>(pos_x, pos_y, pos_z); | 755 | p = vec<float>(pos_x, pos_y, pos_z); |
733 | d = vec<float>(dir_x, dir_y, dir_z); | 756 | d = vec<float>(dir_x, dir_y, dir_z); |
734 | m = vec<float>(mag_x, mag_x, mag_x); | 757 | m = vec<float>(mag_x, mag_x, mag_x); |
735 | S = vec<float>(1.0,1.0,1.0); | 758 | S = vec<float>(1.0,1.0,1.0); |
736 | R = vec<float>(1.0,1.0,1.0); | 759 | R = vec<float>(1.0,1.0,1.0); |
737 | -// numSamples = samples; | 760 | + numSamples = numsamples; |
761 | + numSamplesPos = numsamplespos; | ||
762 | + numSamplesMag = numsamplesmag; | ||
738 | } | 763 | } |
739 | 764 | ||
740 | ///Position constructor: vecs of floats. | 765 | ///Position constructor: vecs of floats. |
@@ -743,7 +768,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -743,7 +768,7 @@ class gl_spider : public virtual gl_texture<T> | ||
743 | ///@param float mag, size of the vector. | 768 | ///@param float mag, size of the vector. |
744 | ///@param int samples, number of templates this spider is going to use. | 769 | ///@param int samples, number of templates this spider is going to use. |
745 | gl_spider | 770 | gl_spider |
746 | - (stim::vec<float> pos, stim::vec<float> dir, float mag, int samples = 1089) | 771 | + (stim::vec<float> pos, stim::vec<float> dir, float mag, int samples = 1089, int samplesPos = 400, int samplesMag = 144) |
747 | { | 772 | { |
748 | p = pos; | 773 | p = pos; |
749 | d = dir; | 774 | d = dir; |
@@ -751,6 +776,8 @@ class gl_spider : public virtual gl_texture<T> | @@ -751,6 +776,8 @@ class gl_spider : public virtual gl_texture<T> | ||
751 | S = vec<float>(1.0,1.0,1.0); | 776 | S = vec<float>(1.0,1.0,1.0); |
752 | R = vec<float>(1.0,1.0,1.0); | 777 | R = vec<float>(1.0,1.0,1.0); |
753 | numSamples = samples; | 778 | numSamples = samples; |
779 | + numSamplesPos = samplesPos; | ||
780 | + numSamplesMag = samplesMag; | ||
754 | } | 781 | } |
755 | 782 | ||
756 | ///destructor | 783 | ///destructor |
@@ -760,12 +787,12 @@ class gl_spider : public virtual gl_texture<T> | @@ -760,12 +787,12 @@ class gl_spider : public virtual gl_texture<T> | ||
760 | Unbind(); | 787 | Unbind(); |
761 | glDeleteTextures(1, &texbufferID); | 788 | glDeleteTextures(1, &texbufferID); |
762 | glDeleteBuffers(1, &fboID); | 789 | glDeleteBuffers(1, &fboID); |
763 | - /* glDeleteTextures(1, &ptexbufferID); | ||
764 | - glDeleteBuffers(1, &pfboId); | 790 | + glDeleteTextures(1, &ptexbufferID); |
791 | + glDeleteBuffers(1, &pfboID); | ||
765 | glDeleteTextures(1, &mtexbufferID); | 792 | glDeleteTextures(1, &mtexbufferID); |
766 | - glDeleteBuffers(1, &mfboId); */ | 793 | + glDeleteBuffers(1, &mfboID); |
767 | glDeleteTextures(1, &btexbufferID); | 794 | glDeleteTextures(1, &btexbufferID); |
768 | - glDeleteBuffers(1, &bfboId); | 795 | + glDeleteBuffers(1, &bfboID); |
769 | } | 796 | } |
770 | 797 | ||
771 | ///@param GLuint id, texture that is going to be sampled. | 798 | ///@param GLuint id, texture that is going to be sampled. |
@@ -776,19 +803,26 @@ class gl_spider : public virtual gl_texture<T> | @@ -776,19 +803,26 @@ class gl_spider : public virtual gl_texture<T> | ||
776 | attachSpider(GLuint id) | 803 | attachSpider(GLuint id) |
777 | { | 804 | { |
778 | texID = id; | 805 | texID = id; |
779 | - GenerateFBO(16, numSamples*8); | ||
780 | - GenerateFBO(16, 216, btexbufferID, bfboId); | 806 | + //GenerateFBO(16, numSamples*8); |
807 | + GenerateFBO(16, numSamples*8, texbufferID, fboID); | ||
808 | + GenerateFBO(16, numSamplesPos*8, ptexbufferID, pfboID); | ||
809 | + GenerateFBO(16, numSamplesMag*8, mtexbufferID, mfboID); | ||
810 | + GenerateFBO(16, 216, btexbufferID, bfboID); | ||
781 | setDims(0.6, 0.6, 1.0); | 811 | setDims(0.6, 0.6, 1.0); |
782 | setSize(512.0, 512.0, 426.0); | 812 | setSize(512.0, 512.0, 426.0); |
783 | setMatrix(); | 813 | setMatrix(); |
784 | dList = glGenLists(3); | 814 | dList = glGenLists(3); |
785 | glListBase(dList); | 815 | glListBase(dList); |
786 | - Bind(); | ||
787 | - genDirectionVectors(5*M_PI/4); | ||
788 | - genPositionVectors(); | ||
789 | - genMagnitudeVectors(); | ||
790 | - Unbind(); | ||
791 | - Bind(btexbufferID, bfboId, 27); | 816 | + Bind(texbufferID, fboID, numSamples); |
817 | + genDirectionVectors(5*M_PI/4); | ||
818 | +// Unbind(); | ||
819 | + Bind(ptexbufferID, bfboID, numSamplesPos); | ||
820 | + genPositionVectors(); | ||
821 | +// Unbind(); | ||
822 | + Bind(mtexbufferID, mfboID, numSamplesMag); | ||
823 | + genMagnitudeVectors(); | ||
824 | +// Unbind(); | ||
825 | + Bind(btexbufferID, bfboID, 27); | ||
792 | DrawCylinder(); | 826 | DrawCylinder(); |
793 | Unbind(); | 827 | Unbind(); |
794 | } | 828 | } |
@@ -1086,7 +1120,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -1086,7 +1120,7 @@ class gl_spider : public virtual gl_texture<T> | ||
1086 | GLuint | 1120 | GLuint |
1087 | getFB() | 1121 | getFB() |
1088 | { | 1122 | { |
1089 | - return bfboId; | 1123 | + return bfboID; |
1090 | } | 1124 | } |
1091 | 1125 | ||
1092 | //--------------------------------------------------------------------------// | 1126 | //--------------------------------------------------------------------------// |
@@ -1110,15 +1144,19 @@ class gl_spider : public virtual gl_texture<T> | @@ -1110,15 +1144,19 @@ class gl_spider : public virtual gl_texture<T> | ||
1110 | int | 1144 | int |
1111 | Step() | 1145 | Step() |
1112 | { | 1146 | { |
1113 | - Bind(); | 1147 | + Bind(texbufferID, fboID, numSamples); |
1114 | CHECK_OPENGL_ERROR | 1148 | CHECK_OPENGL_ERROR |
1115 | #ifdef TESTING | 1149 | #ifdef TESTING |
1116 | start = std::clock(); | 1150 | start = std::clock(); |
1117 | #endif | 1151 | #endif |
1118 | - findOptimalDirection(); | ||
1119 | - findOptimalPosition(); | ||
1120 | - findOptimalScale(); | ||
1121 | - Unbind(); | 1152 | + findOptimalDirection(); |
1153 | + //Unbind(); | ||
1154 | + Bind(ptexbufferID, pfboID, numSamplesPos); | ||
1155 | + findOptimalPosition(); | ||
1156 | + //Unbind(); | ||
1157 | + Bind(mtexbufferID, mfboID, numSamplesMag); | ||
1158 | + findOptimalScale(); | ||
1159 | + //Unbind(); | ||
1122 | CHECK_OPENGL_ERROR | 1160 | CHECK_OPENGL_ERROR |
1123 | 1161 | ||
1124 | #ifdef TESTING | 1162 | #ifdef TESTING |
@@ -1279,7 +1317,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -1279,7 +1317,7 @@ class gl_spider : public virtual gl_texture<T> | ||
1279 | cL.push_back(stim::vec<float>(p[0], p[1],p[2]));// | 1317 | cL.push_back(stim::vec<float>(p[0], p[1],p[2]));// |
1280 | sk.TexCoord(m[0]); | 1318 | sk.TexCoord(m[0]); |
1281 | sk.Vertex(p[0], p[1], p[2]); | 1319 | sk.Vertex(p[0], p[1], p[2]); |
1282 | - Bind(btexbufferID, bfboId, 27); | 1320 | + Bind(btexbufferID, bfboID, 27); |
1283 | CHECK_OPENGL_ERROR | 1321 | CHECK_OPENGL_ERROR |
1284 | branchDetection(); | 1322 | branchDetection(); |
1285 | CHECK_OPENGL_ERROR | 1323 | CHECK_OPENGL_ERROR |
@@ -1386,7 +1424,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -1386,7 +1424,7 @@ class gl_spider : public virtual gl_texture<T> | ||
1386 | } | 1424 | } |
1387 | else | 1425 | else |
1388 | { | 1426 | { |
1389 | - printf ("%u ", *ptr); | 1427 | +// printf ("%u ", *ptr); |
1390 | return *ptr; | 1428 | return *ptr; |
1391 | } | 1429 | } |
1392 | } | 1430 | } |
@@ -1441,8 +1479,8 @@ class gl_spider : public virtual gl_texture<T> | @@ -1441,8 +1479,8 @@ class gl_spider : public virtual gl_texture<T> | ||
1441 | void | 1479 | void |
1442 | printSizes() | 1480 | printSizes() |
1443 | { | 1481 | { |
1444 | - std::cout << nt.sizeE() << "edges" << std::endl; | ||
1445 | - std::cout << nt.sizeV() << "nodes" << std::endl; | 1482 | + std::cout << nt.sizeE() << " edges " << std::endl; |
1483 | + std::cout << nt.sizeV() << " nodes " << std::endl; | ||
1446 | 1484 | ||
1447 | } | 1485 | } |
1448 | 1486 | ||
@@ -1531,7 +1569,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -1531,7 +1569,7 @@ class gl_spider : public virtual gl_texture<T> | ||
1531 | cM.push_back(m[0]); | 1569 | cM.push_back(m[0]); |
1532 | sk.TexCoord(m[0]); | 1570 | sk.TexCoord(m[0]); |
1533 | sk.Vertex(p[0], p[1], p[2]); | 1571 | sk.Vertex(p[0], p[1], p[2]); |
1534 | - Bind(btexbufferID, bfboId, 27); | 1572 | + Bind(btexbufferID, bfboID, 27); |
1535 | CHECK_OPENGL_ERROR | 1573 | CHECK_OPENGL_ERROR |
1536 | branchDetection(); | 1574 | branchDetection(); |
1537 | CHECK_OPENGL_ERROR | 1575 | CHECK_OPENGL_ERROR |
stim/gl/gl_texture.h
@@ -31,10 +31,9 @@ template<typename T> | @@ -31,10 +31,9 @@ template<typename T> | ||
31 | class gl_texture : public virtual image_stack<T> | 31 | class gl_texture : public virtual image_stack<T> |
32 | { | 32 | { |
33 | private: | 33 | private: |
34 | - ///Method: setTextureType | ||
35 | /// Sets the internal texture_type, based on the data | 34 | /// Sets the internal texture_type, based on the data |
36 | /// size. Either 3D, 2D, 1D textures. | 35 | /// size. Either 3D, 2D, 1D textures. |
37 | - | 36 | + |
38 | void | 37 | void |
39 | setTextureType() | 38 | setTextureType() |
40 | { | 39 | { |
@@ -60,16 +59,14 @@ class gl_texture : public virtual image_stack<T> | @@ -60,16 +59,14 @@ class gl_texture : public virtual image_stack<T> | ||
60 | 59 | ||
61 | public: | 60 | public: |
62 | 61 | ||
63 | - ///Method: Basic Constructor | ||
64 | - /// Creates an instance of the gl_texture object. | 62 | + ///default constructor |
65 | gl_texture() | 63 | gl_texture() |
66 | { | 64 | { |
67 | 65 | ||
68 | } | 66 | } |
69 | 67 | ||
70 | - ///Method: Path Constructor | ||
71 | - ///@param string file_path path to the directory with the files. | ||
72 | - /// Creates an instance of the gl_texture object with a path to the data. | 68 | + ///@param string path to the directory with the image files. |
69 | + ///Creates an instance of the gl_texture object with a path to the data. | ||
73 | 70 | ||
74 | gl_texture(std::string file_path) | 71 | gl_texture(std::string file_path) |
75 | { | 72 | { |
@@ -77,8 +74,8 @@ class gl_texture : public virtual image_stack<T> | @@ -77,8 +74,8 @@ class gl_texture : public virtual image_stack<T> | ||
77 | image_stack<T>::load_images(path.append("/*.jpg")); | 74 | image_stack<T>::load_images(path.append("/*.jpg")); |
78 | setTextureType(); | 75 | setTextureType(); |
79 | } | 76 | } |
80 | - ///Method:getSize | ||
81 | - ///returns the dimentions of | 77 | + |
78 | + ///returns the dimentions of the data in the x, y, z directions. | ||
82 | vec<int> | 79 | vec<int> |
83 | getSize() | 80 | getSize() |
84 | { | 81 | { |
@@ -86,7 +83,6 @@ class gl_texture : public virtual image_stack<T> | @@ -86,7 +83,6 @@ class gl_texture : public virtual image_stack<T> | ||
86 | return size; | 83 | return size; |
87 | } | 84 | } |
88 | 85 | ||
89 | - ///Method:setTexParam | ||
90 | ///@param GLint interp --GL_LINEAR, GL_NEAREST... | 86 | ///@param GLint interp --GL_LINEAR, GL_NEAREST... |
91 | ///@param GLint twrap --GL_REPEAR, GL_CLAMP_TO_EDGE... | 87 | ///@param GLint twrap --GL_REPEAR, GL_CLAMP_TO_EDGE... |
92 | ///@param GLenum dataType --GL_UNSIGNED_BYTE, GL_FLOAT16... | 88 | ///@param GLenum dataType --GL_UNSIGNED_BYTE, GL_FLOAT16... |
@@ -103,7 +99,7 @@ class gl_texture : public virtual image_stack<T> | @@ -103,7 +99,7 @@ class gl_texture : public virtual image_stack<T> | ||
103 | type = dataType; | 99 | type = dataType; |
104 | format = dataFormat; | 100 | format = dataFormat; |
105 | } | 101 | } |
106 | - ///Method:setDims | 102 | + |
107 | ///@param x size of the voxel in x direction | 103 | ///@param x size of the voxel in x direction |
108 | ///@param y size of the voxel in y direction | 104 | ///@param y size of the voxel in y direction |
109 | ///@param z size of the voxel in z direction | 105 | ///@param z size of the voxel in z direction |
@@ -116,9 +112,7 @@ class gl_texture : public virtual image_stack<T> | @@ -116,9 +112,7 @@ class gl_texture : public virtual image_stack<T> | ||
116 | S[3] = z; | 112 | S[3] = z; |
117 | } | 113 | } |
118 | 114 | ||
119 | - ///Method:getDims | ||
120 | - /// get the dimenstions of the voxels. | ||
121 | - | 115 | + ///Returns a stim::vec that contains the x, y, z sizes of the voxel. |
122 | vec<float> | 116 | vec<float> |
123 | getDims() | 117 | getDims() |
124 | { | 118 | { |
@@ -126,11 +120,8 @@ class gl_texture : public virtual image_stack<T> | @@ -126,11 +120,8 @@ class gl_texture : public virtual image_stack<T> | ||
126 | return dims; | 120 | return dims; |
127 | } | 121 | } |
128 | 122 | ||
129 | - ///Method:setPath | ||
130 | ///@param file_Path location of the directory with the files | 123 | ///@param file_Path location of the directory with the files |
131 | /// Sets the path and calls the loader on that path. | 124 | /// Sets the path and calls the loader on that path. |
132 | - | ||
133 | - | ||
134 | void | 125 | void |
135 | setPath(std::string file_path) | 126 | setPath(std::string file_path) |
136 | { | 127 | { |
@@ -139,19 +130,14 @@ class gl_texture : public virtual image_stack<T> | @@ -139,19 +130,14 @@ class gl_texture : public virtual image_stack<T> | ||
139 | setTextureType(); | 130 | setTextureType(); |
140 | } | 131 | } |
141 | 132 | ||
142 | - ///Method: getPath | ||
143 | - ///Outputs: string path | ||
144 | - /// Returns the path associated with an instance of the gl_texture class. | ||
145 | - | 133 | + /// Returns an std::string path associated with an instance of the gl_texture class. |
146 | std::string | 134 | std::string |
147 | getPath() | 135 | getPath() |
148 | { | 136 | { |
149 | return path; | 137 | return path; |
150 | } | 138 | } |
151 | 139 | ||
152 | - ///Method: getTexture | ||
153 | - ///Outputs: GLuint texID | ||
154 | - /// Returns the id of the texture create by/associated with the | 140 | + /// Returns the GLuint id of the texture created by/associated with the |
155 | /// instance of the gl_texture class. | 141 | /// instance of the gl_texture class. |
156 | 142 | ||
157 | GLuint | 143 | GLuint |
@@ -160,7 +146,6 @@ class gl_texture : public virtual image_stack<T> | @@ -160,7 +146,6 @@ class gl_texture : public virtual image_stack<T> | ||
160 | return texID; | 146 | return texID; |
161 | } | 147 | } |
162 | 148 | ||
163 | - ///Method: createTexture | ||
164 | /// Creates a texture and from the loaded data and | 149 | /// Creates a texture and from the loaded data and |
165 | /// assigns that texture to texID | 150 | /// assigns that texture to texID |
166 | //TO DO :::: 1D textures | 151 | //TO DO :::: 1D textures |