Commit b64c530dc0bdb262381c6eb4864bceea89c2c13c
Merge branch 'JACK' into 'master'
fixed bugs See merge request !26
Showing
5 changed files
with
182 additions
and
126 deletions
Show diff stats
stim/biomodels/centerline.h
... | ... | @@ -22,7 +22,7 @@ protected: |
22 | 22 | if (size() <= 1) return vec3<T>(0, 0, 0); //if there is insufficient information to calculate the direction, return a null vector |
23 | 23 | if (size() == 2) return (at(1) - at(0)).norm(); //if there are only two points, the direction vector at both is the direction of the line segment |
24 | 24 | if (i == 0) return (at(1) - at(0)).norm(); //the first direction vector is oriented towards the first line segment |
25 | - if (i == size() - 1) return at(size() - 1) - at(size() - 2); //the last direction vector is oriented towards the last line segment | |
25 | + if (i == size() - 1) return (at(size() - 1) - at(size() - 2)).norm(); //the last direction vector is oriented towards the last line segment | |
26 | 26 | |
27 | 27 | //all other direction vectors are the average direction of the two joined line segments |
28 | 28 | vec3<T> a = at(i) - at(i - 1); |
... | ... | @@ -149,7 +149,7 @@ public: |
149 | 149 | //if the index is not an end point |
150 | 150 | else{ |
151 | 151 | |
152 | - unsigned int N1 = idx; //calculate the size of both fibers | |
152 | + unsigned int N1 = idx + 1; //calculate the size of both fibers | |
153 | 153 | unsigned int N2 = N - idx; |
154 | 154 | |
155 | 155 | fl.resize(2); //set the array size to 2 |
... | ... | @@ -227,7 +227,7 @@ public: |
227 | 227 | } |
228 | 228 | } |
229 | 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 | 232 | new_c.push_back(at(N-1)); //add the last point on the fiber to the new fiber list |
233 | 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 | 46 | #endif |
47 | 47 | |
48 | 48 | //hard-coded factor |
49 | -int threshold_fac = 10; | |
49 | +int threshold_fac = 0; | |
50 | 50 | |
51 | 51 | namespace stim{ |
52 | 52 | /** This is the a class that interfaces with gl_spider in order to store the currently |
... | ... | @@ -782,15 +782,20 @@ public: |
782 | 782 | unsigned int id = 0; // split value |
783 | 783 | for(unsigned e = 0; e < E.size(); e++){ // for every edge |
784 | 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 | 790 | if(relation[e][p] != relation[e][p + 1]){ // find the nearest edge changing point |
786 | 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 | 793 | id = E[e].size() - 1; // extreme situation is not acceptable |
789 | 794 | else |
790 | 795 | break; |
791 | 796 | } |
792 | 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 | 800 | //unsigned errormag_id = E[e].nmags() - 1; |
796 | 801 | T G = 0; // test to see whether it has its nearest neighbor | ... | ... |
stim/visualization/cylinder.h
... | ... | @@ -233,7 +233,7 @@ public: |
233 | 233 | unsigned i = 0; |
234 | 234 | C[0] = LL[0]; |
235 | 235 | //C[0].R.resize(idx); |
236 | - for (; i < idx; i++) { | |
236 | + for (; i < idx + 1; i++) { | |
237 | 237 | //for(unsigned d = 0; d < 3; d++) |
238 | 238 | //C[0][i][d] = LL[0].c[i][d]; |
239 | 239 | C[0].R[i] = R[i]; |
... | ... | @@ -241,6 +241,7 @@ public: |
241 | 241 | } |
242 | 242 | if (C.size() == 2) { |
243 | 243 | C[1] = LL[1]; |
244 | + i--; | |
244 | 245 | //C[1].M.resize(N - idx); |
245 | 246 | for (; i < N; i++) { |
246 | 247 | //for(unsigned d = 0; d < 3; d++) | ... | ... |
stim/visualization/gl_network.h
... | ... | @@ -85,86 +85,6 @@ public: |
85 | 85 | glCallList(dlist); // render the display list |
86 | 86 | } |
87 | 87 | |
88 | - /// render the network centerline from swc file as a series of strips in different colors based on the neuronal type | |
89 | - /// glCenterline0_swc is for only one input | |
90 | - /*void glCenterline0_swc() { | |
91 | - if (!glIsList(dlist)) { // if dlist isn't a display list, create it | |
92 | - dlist = glGenLists(1); // generate a display list | |
93 | - glNewList(dlist, GL_COMPILE); // start a new display list | |
94 | - for (unsigned e = 0; e < E.size(); e++) { | |
95 | - int type = NT[e]; // get the neuronal type | |
96 | - switch (type) { | |
97 | - case 0: | |
98 | - glColor3f(1.0f, 1.0f, 1.0f); // white for undefined | |
99 | - glBegin(GL_LINE_STRIP); | |
100 | - for (unsigned p = 0; p < E[e].size(); p++) { | |
101 | - glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
102 | - } | |
103 | - glEnd(); | |
104 | - break; | |
105 | - case 1: | |
106 | - glColor3f(1.0f, 0.0f, 0.0f); // red for soma | |
107 | - glBegin(GL_LINE_STRIP); | |
108 | - for (unsigned p = 0; p < E[e].size(); p++) { | |
109 | - glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
110 | - } | |
111 | - glEnd(); | |
112 | - break; | |
113 | - case 2: | |
114 | - glColor3f(1.0f, 0.5f, 0.0f); // orange for axon | |
115 | - glBegin(GL_LINE_STRIP); | |
116 | - for (unsigned p = 0; p < E[e].size(); p++) { | |
117 | - glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
118 | - } | |
119 | - glEnd(); | |
120 | - break; | |
121 | - case 3: | |
122 | - glColor3f(1.0f, 1.0f, 0.0f); // yellow for undefined | |
123 | - glBegin(GL_LINE_STRIP); | |
124 | - for (unsigned p = 0; p < E[e].size(); p++) { | |
125 | - glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
126 | - } | |
127 | - glEnd(); | |
128 | - break; | |
129 | - case 4: | |
130 | - glColor3f(0.0f, 1.0f, 0.0f); // green for undefined | |
131 | - glBegin(GL_LINE_STRIP); | |
132 | - for (unsigned p = 0; p < E[e].size(); p++) { | |
133 | - glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
134 | - } | |
135 | - glEnd(); | |
136 | - break; | |
137 | - case 5: | |
138 | - glColor3f(0.0f, 1.0f, 1.0f); // verdant for undefined | |
139 | - glBegin(GL_LINE_STRIP); | |
140 | - for (unsigned p = 0; p < E[e].size(); p++) { | |
141 | - glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
142 | - } | |
143 | - glEnd(); | |
144 | - break; | |
145 | - case 6: | |
146 | - glColor3f(0.0f, 0.0f, 1.0f); // blue for undefined | |
147 | - glBegin(GL_LINE_STRIP); | |
148 | - for (unsigned p = 0; p < E[e].size(); p++) { | |
149 | - glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
150 | - } | |
151 | - glEnd(); | |
152 | - break; | |
153 | - case 7: | |
154 | - glColor3f(0.5f, 0.0f, 1.0f); // purple for undefined | |
155 | - glBegin(GL_LINE_STRIP); | |
156 | - for (unsigned p = 0; p < E[e].size(); p++) { | |
157 | - glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
158 | - } | |
159 | - glEnd(); | |
160 | - break; | |
161 | - } | |
162 | - } | |
163 | - glEndList(); //end the display list | |
164 | - } | |
165 | - glCallList(dlist); // render the display list | |
166 | - }*/ | |
167 | - | |
168 | 88 | ///render the network centerline as a series of line strips(when loading at least two networks, otherwise using glCenterline0()) |
169 | 89 | ///colors are based on metric values |
170 | 90 | void glCenterline(){ |
... | ... | @@ -188,16 +108,19 @@ public: |
188 | 108 | |
189 | 109 | ///render the network cylinder as a series of tubes |
190 | 110 | ///colors are based on metric values |
191 | - void glCylinder(float sigma) { | |
192 | - if (!glIsList(dlist)) { //if dlist isn't a display list, create it | |
193 | - dlist = glGenLists(1); //generate a display list | |
194 | - glNewList(dlist, GL_COMPILE); //start a new display list | |
195 | - for (unsigned e = 0; e < E.size(); e++) { //for each edge in the network | |
111 | + void glCylinder(float sigma, float radius) { | |
112 | + | |
113 | + if (radius != sigma) // if render radius was changed by user, create a new display list | |
114 | + glDeleteLists(dlist, 1); | |
115 | + if (!glIsList(dlist)) { // if dlist isn't a display list, create it | |
116 | + dlist = glGenLists(1); // generate a display list | |
117 | + glNewList(dlist, GL_COMPILE); // start a new display list | |
118 | + for (unsigned e = 0; e < E.size(); e++) { // for each edge in the network | |
196 | 119 | for (unsigned p = 1; p < E[e].size(); p++) { // for each point on that edge |
197 | 120 | stim::circle<T> C1 = E[e].circ(p - 1); |
198 | 121 | stim::circle<T> C2 = E[e].circ(p); |
199 | - C1.set_R(3*sigma); // scale the circle to the same | |
200 | - C2.set_R(3*sigma); | |
122 | + C1.set_R(2*radius); // scale the circle to the same | |
123 | + C2.set_R(2*radius); | |
201 | 124 | std::vector< stim::vec3<T> >Cp1 = C1.glpoints(20); |
202 | 125 | std::vector< stim::vec3<T> >Cp2 = C2.glpoints(20); |
203 | 126 | glBegin(GL_QUAD_STRIP); |
... | ... | @@ -207,30 +130,33 @@ public: |
207 | 130 | glTexCoord1f(E[e].r(p)); |
208 | 131 | } |
209 | 132 | glEnd(); |
210 | - } //set the texture coordinate based on the specified magnitude index | |
133 | + } // set the texture coordinate based on the specified magnitude index | |
211 | 134 | } |
212 | 135 | for (unsigned n = 0; n < V.size(); n++) { |
213 | - size_t num = V[n].e[0].size(); //store the number of outgoing edge of that vertex | |
214 | - if (num != 0) { //if it has outgoing edge | |
215 | - unsigned idx = V[n].e[0][0]; //find the index of first outgoing edge of that vertex | |
216 | - glTexCoord1f(E[idx].r(0)); //bind the texture as metric of first point on that edge | |
136 | + size_t num = V[n].e[0].size(); // store the number of outgoing edge of that vertex | |
137 | + if (num != 0) { // if it has outgoing edge | |
138 | + unsigned idx = V[n].e[0][0]; // find the index of first outgoing edge of that vertex | |
139 | + glTexCoord1f(E[idx].r(0)); // bind the texture as metric of first point on that edge | |
217 | 140 | } |
218 | 141 | else { |
219 | - unsigned idx = V[n].e[1][0]; //find the index of first incoming edge of that vertex | |
220 | - glTexCoord1f(E[idx].r(E[idx].size() - 1)); //bind the texture as metric of last point on that edge | |
142 | + unsigned idx = V[n].e[1][0]; // find the index of first incoming edge of that vertex | |
143 | + glTexCoord1f(E[idx].r(E[idx].size() - 1)); // bind the texture as metric of last point on that edge | |
221 | 144 | } |
222 | - renderBall(V[n][0], V[n][1], V[n][2], 3*sigma, 20); | |
145 | + renderBall(V[n][0], V[n][1], V[n][2], 2*radius, 20); | |
223 | 146 | } |
224 | - glEndList(); //end the display list | |
147 | + glEndList(); // end the display list | |
225 | 148 | } |
226 | - glCallList(dlist); //render the display list | |
149 | + glCallList(dlist); // render the display list | |
227 | 150 | } |
228 | 151 | |
229 | 152 | ///render the GT network cylinder as series of tubes |
230 | 153 | ///@param dlist1 is the display list |
231 | 154 | ///@param map is the mapping relationship between two networks |
232 | 155 | ///@param colormap is the random generated color set for render |
233 | - void glRandColorCylinder1(GLuint &dlist1, std::vector<unsigned> map, std::vector<T> colormap, float sigma) { | |
156 | + void glRandColorCylinder1(GLuint &dlist1, std::vector<unsigned> map, std::vector<T> colormap, float sigma, float radius) { | |
157 | + | |
158 | + if (radius != sigma) // if render radius was changed by user, create a new display list | |
159 | + glDeleteLists(dlist1, 1); | |
234 | 160 | if (!glIsList(dlist1)) { // if dlist1 isn't a display list, create it |
235 | 161 | dlist1 = glGenLists(1); // generate a display list |
236 | 162 | glNewList(dlist1, GL_COMPILE); // start a new display list |
... | ... | @@ -240,8 +166,8 @@ public: |
240 | 166 | for (unsigned p = 1; p < E[e].size(); p++) {// for each point on that edge |
241 | 167 | stim::circle<T> C1 = E[e].circ(p - 1); |
242 | 168 | stim::circle<T> C2 = E[e].circ(p); |
243 | - C1.set_R(3*sigma); // scale the circle to the same | |
244 | - C2.set_R(3*sigma); | |
169 | + C1.set_R(2*radius); // scale the circle to the same | |
170 | + C2.set_R(2*radius); | |
245 | 171 | std::vector< stim::vec3<T> >Cp1 = C1.glpoints(20); |
246 | 172 | std::vector< stim::vec3<T> >Cp2 = C2.glpoints(20); |
247 | 173 | renderCylinder(Cp1, Cp2); |
... | ... | @@ -252,8 +178,8 @@ public: |
252 | 178 | for (unsigned p = 1; p < E[e].size(); p++) { // for each point on that edge |
253 | 179 | stim::circle<T> C1 = E[e].circ(p - 1); |
254 | 180 | stim::circle<T> C2 = E[e].circ(p); |
255 | - C1.set_R(3*sigma); // scale the circle to the same | |
256 | - C2.set_R(3*sigma); | |
181 | + C1.set_R(2*radius); // scale the circle to the same | |
182 | + C2.set_R(2*radius); | |
257 | 183 | std::vector< stim::vec3<T> >Cp1 = C1.glpoints(20); |
258 | 184 | std::vector< stim::vec3<T> >Cp2 = C2.glpoints(20); |
259 | 185 | renderCylinder(Cp1, Cp2); |
... | ... | @@ -264,11 +190,11 @@ public: |
264 | 190 | size_t num_edge = V[v].e[0].size() + V[v].e[1].size(); |
265 | 191 | if (num_edge > 1) { // if it is the joint vertex |
266 | 192 | glColor3f(0.3, 0.3, 0.3); // gray color |
267 | - renderBall(V[v][0], V[v][1], V[v][2], 6*sigma, 20); | |
193 | + renderBall(V[v][0], V[v][1], V[v][2], 3*radius, 20); | |
268 | 194 | } |
269 | 195 | else { // if it is the terminal vertex |
270 | 196 | glColor3f(0.6, 0.6, 0.6); // more white gray |
271 | - renderBall(V[v][0], V[v][1], V[v][2], 6*sigma, 20); | |
197 | + renderBall(V[v][0], V[v][1], V[v][2], 3*radius, 20); | |
272 | 198 | } |
273 | 199 | } |
274 | 200 | glEndList(); |
... | ... | @@ -280,18 +206,21 @@ public: |
280 | 206 | ///@param dlist2 is the display list |
281 | 207 | ///@param map is the mapping relationship between two networks |
282 | 208 | ///@param colormap is the random generated color set for render |
283 | - void glRandColorCylinder2(GLuint &dlist2, std::vector<unsigned> map, std::vector<T> colormap, float sigma) { | |
209 | + void glRandColorCylinder2(GLuint &dlist2, std::vector<unsigned> map, std::vector<T> colormap, float sigma, float radius) { | |
210 | + | |
211 | + if (radius != sigma) // if render radius was changed by user, create a new display list | |
212 | + glDeleteLists(dlist2, 1); | |
284 | 213 | if (!glIsList(dlist2)) { |
285 | 214 | dlist2 = glGenLists(1); |
286 | 215 | glNewList(dlist2, GL_COMPILE); |
287 | 216 | for (unsigned e = 0; e < E.size(); e++) { // for each edge in the network |
288 | 217 | if (map[e] != unsigned(-1)) { |
289 | 218 | glColor3f(colormap[map[e] * 3 + 0], colormap[map[e] * 3 + 1], colormap[map[e] * 3 + 2]); |
290 | - for (unsigned p = 0; p < E[e].size() - 1; p++) {// for each point on that edge | |
291 | - stim::circle<T> C1 = E[e].circ(p); | |
292 | - stim::circle<T> C2 = E[e].circ(p + 1); | |
293 | - C1.set_R(3*sigma); // scale the circle to the same | |
294 | - C2.set_R(3*sigma); | |
219 | + for (unsigned p = 1; p < E[e].size(); p++) { // for each point on that edge(except last one) | |
220 | + stim::circle<T> C1 = E[e].circ(p - 1); | |
221 | + stim::circle<T> C2 = E[e].circ(p); | |
222 | + C1.set_R(2*radius); // scale the circle to the same | |
223 | + C2.set_R(2*radius); | |
295 | 224 | std::vector< stim::vec3<T> >Cp1 = C1.glpoints(20); |
296 | 225 | std::vector< stim::vec3<T> >Cp2 = C2.glpoints(20); |
297 | 226 | renderCylinder(Cp1, Cp2); |
... | ... | @@ -299,11 +228,11 @@ public: |
299 | 228 | } |
300 | 229 | else { |
301 | 230 | glColor3f(1.0f, 1.0f, 1.0f); // white color for the un-mapping edges |
302 | - for (unsigned p = 0; p < E[e].size() - 1; p++) {// for each point on that edge | |
303 | - stim::circle<T> C1 = E[e].circ(p); | |
304 | - stim::circle<T> C2 = E[e].circ(p + 1); | |
305 | - C1.set_R(3*sigma); // scale the circle to the same | |
306 | - C2.set_R(3*sigma); | |
231 | + for (unsigned p = 1; p < E[e].size(); p++) { // for each point on that edge | |
232 | + stim::circle<T> C1 = E[e].circ(p - 1); | |
233 | + stim::circle<T> C2 = E[e].circ(p); | |
234 | + C1.set_R(2*radius); // scale the circle to the same | |
235 | + C2.set_R(2*radius); | |
307 | 236 | std::vector< stim::vec3<T> >Cp1 = C1.glpoints(20); |
308 | 237 | std::vector< stim::vec3<T> >Cp2 = C2.glpoints(20); |
309 | 238 | renderCylinder(Cp1, Cp2); |
... | ... | @@ -314,11 +243,11 @@ public: |
314 | 243 | size_t num_edge = V[v].e[0].size() + V[v].e[1].size(); |
315 | 244 | if (num_edge > 1) { // if it is the joint vertex |
316 | 245 | glColor3f(0.3, 0.3, 0.3); // gray color |
317 | - renderBall(V[v][0], V[v][1], V[v][2], 6*sigma, 20); | |
246 | + renderBall(V[v][0], V[v][1], V[v][2], 3*radius, 20); | |
318 | 247 | } |
319 | 248 | else { // if it is the terminal vertex |
320 | 249 | glColor3f(0.6, 0.6, 0.6); // more white gray |
321 | - renderBall(V[v][0], V[v][1], V[v][2], 6*sigma, 20); | |
250 | + renderBall(V[v][0], V[v][1], V[v][2], 3*radius, 20); | |
322 | 251 | } |
323 | 252 | } |
324 | 253 | glEndList(); |
... | ... | @@ -485,6 +414,127 @@ public: |
485 | 414 | // glPopMatrix(); |
486 | 415 | //} |
487 | 416 | |
417 | + | |
418 | + /// render the network centerline from swc file as a series of strips in different colors based on the neuronal type | |
419 | + /// glCenterline0_swc is for only one input | |
420 | + /*void glCenterline0_swc() { | |
421 | + if (!glIsList(dlist)) { // if dlist isn't a display list, create it | |
422 | + dlist = glGenLists(1); // generate a display list | |
423 | + glNewList(dlist, GL_COMPILE); // start a new display list | |
424 | + for (unsigned e = 0; e < E.size(); e++) { | |
425 | + int type = NT[e]; // get the neuronal type | |
426 | + switch (type) { | |
427 | + case 0: | |
428 | + glColor3f(1.0f, 1.0f, 1.0f); // white for undefined | |
429 | + glBegin(GL_LINE_STRIP); | |
430 | + for (unsigned p = 0; p < E[e].size(); p++) { | |
431 | + glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
432 | + } | |
433 | + glEnd(); | |
434 | + break; | |
435 | + case 1: | |
436 | + glColor3f(1.0f, 0.0f, 0.0f); // red for soma | |
437 | + glBegin(GL_LINE_STRIP); | |
438 | + for (unsigned p = 0; p < E[e].size(); p++) { | |
439 | + glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
440 | + } | |
441 | + glEnd(); | |
442 | + break; | |
443 | + case 2: | |
444 | + glColor3f(1.0f, 0.5f, 0.0f); // orange for axon | |
445 | + glBegin(GL_LINE_STRIP); | |
446 | + for (unsigned p = 0; p < E[e].size(); p++) { | |
447 | + glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
448 | + } | |
449 | + glEnd(); | |
450 | + break; | |
451 | + case 3: | |
452 | + glColor3f(1.0f, 1.0f, 0.0f); // yellow for undefined | |
453 | + glBegin(GL_LINE_STRIP); | |
454 | + for (unsigned p = 0; p < E[e].size(); p++) { | |
455 | + glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
456 | + } | |
457 | + glEnd(); | |
458 | + break; | |
459 | + case 4: | |
460 | + glColor3f(0.0f, 1.0f, 0.0f); // green for undefined | |
461 | + glBegin(GL_LINE_STRIP); | |
462 | + for (unsigned p = 0; p < E[e].size(); p++) { | |
463 | + glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
464 | + } | |
465 | + glEnd(); | |
466 | + break; | |
467 | + case 5: | |
468 | + glColor3f(0.0f, 1.0f, 1.0f); // verdant for undefined | |
469 | + glBegin(GL_LINE_STRIP); | |
470 | + for (unsigned p = 0; p < E[e].size(); p++) { | |
471 | + glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
472 | + } | |
473 | + glEnd(); | |
474 | + break; | |
475 | + case 6: | |
476 | + glColor3f(0.0f, 0.0f, 1.0f); // blue for undefined | |
477 | + glBegin(GL_LINE_STRIP); | |
478 | + for (unsigned p = 0; p < E[e].size(); p++) { | |
479 | + glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
480 | + } | |
481 | + glEnd(); | |
482 | + break; | |
483 | + case 7: | |
484 | + glColor3f(0.5f, 0.0f, 1.0f); // purple for undefined | |
485 | + glBegin(GL_LINE_STRIP); | |
486 | + for (unsigned p = 0; p < E[e].size(); p++) { | |
487 | + glVertex3f(E[e][p][0], E[e][p][1], E[e][p][2]); | |
488 | + } | |
489 | + glEnd(); | |
490 | + break; | |
491 | + } | |
492 | + } | |
493 | + glEndList(); //end the display list | |
494 | + } | |
495 | + glCallList(dlist); // render the display list | |
496 | + }*/ | |
497 | + | |
498 | + ///render the network cylinder as a series of tubes | |
499 | + ///colors are based on metric values | |
500 | + //void glCylinder(float sigma) { | |
501 | + // if (!glIsList(dlist)) { //if dlist isn't a display list, create it | |
502 | + // dlist = glGenLists(1); //generate a display list | |
503 | + // glNewList(dlist, GL_COMPILE); //start a new display list | |
504 | + // for (unsigned e = 0; e < E.size(); e++) { //for each edge in the network | |
505 | + // for (unsigned p = 1; p < E[e].size() - 1; p++) { // for each point on that edge | |
506 | + // stim::circle<T> C1 = E[e].circ(p - 1); | |
507 | + // stim::circle<T> C2 = E[e].circ(p); | |
508 | + // C1.set_R(2.5*sigma); // scale the circle to the same | |
509 | + // C2.set_R(2.5*sigma); | |
510 | + // std::vector< stim::vec3<T> >Cp1 = C1.glpoints(20); | |
511 | + // std::vector< stim::vec3<T> >Cp2 = C2.glpoints(20); | |
512 | + // glBegin(GL_QUAD_STRIP); | |
513 | + // for (unsigned i = 0; i < Cp1.size(); i++) { // for every point on the circle(+1 means closing the circle) | |
514 | + // glVertex3f(Cp1[i][0], Cp1[i][1], Cp1[i][2]); | |
515 | + // glVertex3f(Cp2[i][0], Cp2[i][1], Cp2[i][2]); | |
516 | + // glTexCoord1f(E[e].r(p)); | |
517 | + // } | |
518 | + // glEnd(); | |
519 | + // } //set the texture coordinate based on the specified magnitude index | |
520 | + // } | |
521 | + // for (unsigned n = 0; n < V.size(); n++) { | |
522 | + // size_t num = V[n].e[0].size(); //store the number of outgoing edge of that vertex | |
523 | + // if (num != 0) { //if it has outgoing edge | |
524 | + // unsigned idx = V[n].e[0][0]; //find the index of first outgoing edge of that vertex | |
525 | + // glTexCoord1f(E[idx].r(0)); //bind the texture as metric of first point on that edge | |
526 | + // } | |
527 | + // else { | |
528 | + // unsigned idx = V[n].e[1][0]; //find the index of first incoming edge of that vertex | |
529 | + // glTexCoord1f(E[idx].r(E[idx].size() - 1)); //bind the texture as metric of last point on that edge | |
530 | + // } | |
531 | + // renderBall(V[n][0], V[n][1], V[n][2], 2.5*sigma, 20); | |
532 | + // } | |
533 | + // glEndList(); //end the display list | |
534 | + // } | |
535 | + // glCallList(dlist); //render the display list | |
536 | + //} | |
537 | + | |
488 | 538 | }; //end stim::gl_network class |
489 | 539 | }; //end stim namespace |
490 | 540 | ... | ... |
stim/visualization/swc.h
... | ... | @@ -96,7 +96,7 @@ namespace stim { |
96 | 96 | |
97 | 97 | // if the file is invalid, throw an error |
98 | 98 | if (!infile) { |
99 | - std::cerr << "STUN::SWC Error loading file" << filename << std::endl; | |
99 | + std::cerr << "STIM::SWC Error loading file" << filename << std::endl; | |
100 | 100 | exit(-1); |
101 | 101 | } |
102 | 102 | |
... | ... | @@ -138,7 +138,7 @@ namespace stim { |
138 | 138 | |
139 | 139 | // if the file is invalid, throw an error |
140 | 140 | if (!infile) { |
141 | - std::cerr << "STUN::SWC Error loading file" << filename << std::endl; | |
141 | + std::cerr << "STIM::SWC Error loading file" << filename << std::endl; | |
142 | 142 | exit(1); |
143 | 143 | } |
144 | 144 | ... | ... |