Commit 4ea8daa80c9d2a721803a6248f1708aabcee33f4
1 parent
792a5d63
add necessary functions for flow3 program
Showing
4 changed files
with
50 additions
and
4 deletions
Show diff stats
stim/grids/image_stack.h
@@ -38,6 +38,20 @@ public: | @@ -38,6 +38,20 @@ public: | ||
38 | return R[1] * R[2] * R[3]; //return the number of spatial samples | 38 | return R[1] * R[2] * R[3]; //return the number of spatial samples |
39 | } | 39 | } |
40 | 40 | ||
41 | + // get the number of pixels in each dimension | ||
42 | + size_t nc() { | ||
43 | + return R[0]; | ||
44 | + } | ||
45 | + size_t nx() { | ||
46 | + return R[1]; | ||
47 | + } | ||
48 | + size_t ny() { | ||
49 | + return R[2]; | ||
50 | + } | ||
51 | + size_t nz() { | ||
52 | + return R[3]; | ||
53 | + } | ||
54 | + | ||
41 | /// Returns the number of color channels | 55 | /// Returns the number of color channels |
42 | size_t channels(){ | 56 | size_t channels(){ |
43 | return R[0]; | 57 | return R[0]; |
@@ -187,6 +201,10 @@ public: | @@ -187,6 +201,10 @@ public: | ||
187 | for (unsigned i = 0; i < R[0] * R[1] * R[2]; i++) | 201 | for (unsigned i = 0; i < R[0] * R[1] * R[2]; i++) |
188 | ptr[i + k * R[0] * R[1] * R[2]] = Ptr[i]; | 202 | ptr[i + k * R[0] * R[1] * R[2]] = Ptr[i]; |
189 | } | 203 | } |
204 | + void copy(T* Ptr) { | ||
205 | + ptr = Ptr; | ||
206 | + } | ||
207 | + | ||
190 | 208 | ||
191 | void read(std::string file, unsigned int X, unsigned int Y, unsigned int Z, unsigned int C = 1, unsigned int header = 0){ | 209 | void read(std::string file, unsigned int X, unsigned int Y, unsigned int Z, unsigned int C = 1, unsigned int header = 0){ |
192 | read(file, stim::vec<unsigned long>(C, X, Y, Z), header); | 210 | read(file, stim::vec<unsigned long>(C, X, Y, Z), header); |
stim/visualization/colormap.h
@@ -33,6 +33,30 @@ static float BREWERCP[BREWER_CTRL_PTS*4] = {0.192157f, 0.211765f, 0.584314f, 1. | @@ -33,6 +33,30 @@ static float BREWERCP[BREWER_CTRL_PTS*4] = {0.192157f, 0.211765f, 0.584314f, 1. | ||
33 | 0.843137f, 0.188235f, 0.152941f, 1.0f, | 33 | 0.843137f, 0.188235f, 0.152941f, 1.0f, |
34 | 0.647059f, 0.0f, 0.14902f, 1.0f}; | 34 | 0.647059f, 0.0f, 0.14902f, 1.0f}; |
35 | 35 | ||
36 | +//static float BREWERCP[BREWER_CTRL_PTS * 4] = { 0.192157f, 0.584314f, 0.211765f, 1.0f, | ||
37 | +// 0.270588f, 0.705882f, 0.458824f, 1.0f, | ||
38 | +// 0.454902f, 0.819608f, 0.678431f, 1.0f, | ||
39 | +// 0.670588f, 0.913725f, 0.85098f, 1.0f, | ||
40 | +// 0.878431f, 0.972549f, 0.952941f, 1.0f, | ||
41 | +// 1.0f, 0.74902f, 1.0f, 1.0f, | ||
42 | +// 0.996078f, 0.878431f, 0.564706f, 1.0f, | ||
43 | +// 0.992157f, 0.682353f, 0.380392f, 1.0f, | ||
44 | +// 0.956863f, 0.427451f, 0.262745f, 1.0f, | ||
45 | +// 0.843137f, 0.188235f, 0.152941f, 1.0f, | ||
46 | +// 0.647059f, 0.0f, 0.14902f, 1.0f }; | ||
47 | + | ||
48 | +//static float BREWERCP[BREWER_CTRL_PTS * 4] = { 0.0f, 0.407843f, 0.215686f, 1.0f, | ||
49 | +// 0.101960f, 0.596078f, 0.313725f, 1.0f, | ||
50 | +// 0.4f, 0.741176f, 0.388235f, 1.0f, | ||
51 | +// 0.650980f, 0.850980f, 0.415686f, 1.0f, | ||
52 | +// 0.850980f, 0.937254f, 0.545098f, 1.0f, | ||
53 | +// 1.0f, 1.0f, 0.749019f, 1.0f, | ||
54 | +// 0.996078f, 0.878431f, 0.545098f, 1.0f, | ||
55 | +// 0.992156f, 0.682352f, 0.380392f, 1.0f, | ||
56 | +// 0.956862f, 0.427450f, 0.262745f, 1.0f, | ||
57 | +// 0.843137f, 0.188235f, 0.152941f, 1.0f, | ||
58 | +// 0.647058f, 0.0f, 0.149019f, 1.0f }; | ||
59 | + | ||
36 | 60 | ||
37 | #ifdef __CUDACC__ | 61 | #ifdef __CUDACC__ |
38 | texture<float4, cudaTextureType1D> cudaTexBrewer; | 62 | texture<float4, cudaTextureType1D> cudaTexBrewer; |
stim/visualization/gl_network.h
@@ -167,9 +167,9 @@ public: | @@ -167,9 +167,9 @@ public: | ||
167 | stim::circle<T> C1 = E[e].circ(p - 1); | 167 | stim::circle<T> C1 = E[e].circ(p - 1); |
168 | stim::circle<T> C2 = E[e].circ(p); | 168 | stim::circle<T> C2 = E[e].circ(p); |
169 | r1 = E[e].r(p - 1); | 169 | r1 = E[e].r(p - 1); |
170 | - r2 = E[e].r(p); | ||
171 | - C1.set_R(2 * r1); // re-scale the circle to the same | ||
172 | - C2.set_R(2 * r2); | 170 | + r2 = E[e].r(p); |
171 | + C1.set_R(r1); // re-scale the circle to the same | ||
172 | + C2.set_R(r2); | ||
173 | std::vector< stim::vec3<T> > Cp1 = C1.glpoints(20);// get 20 points on the circle plane | 173 | std::vector< stim::vec3<T> > Cp1 = C1.glpoints(20);// get 20 points on the circle plane |
174 | std::vector< stim::vec3<T> > Cp2 = C2.glpoints(20); | 174 | std::vector< stim::vec3<T> > Cp2 = C2.glpoints(20); |
175 | glBegin(GL_QUAD_STRIP); | 175 | glBegin(GL_QUAD_STRIP); |
@@ -191,7 +191,7 @@ public: | @@ -191,7 +191,7 @@ public: | ||
191 | break; | 191 | break; |
192 | } | 192 | } |
193 | } | 193 | } |
194 | - renderBall(V[n][0], V[n][1], V[n][2], 2 * r1, 20); | 194 | + renderBall(V[n][0], V[n][1], V[n][2], r1, 20); |
195 | } | 195 | } |
196 | glEndList(); // end the display list | 196 | glEndList(); // end the display list |
197 | } | 197 | } |
stim/visualization/obj.h
@@ -694,6 +694,10 @@ public: | @@ -694,6 +694,10 @@ public: | ||
694 | return V.size(); | 694 | return V.size(); |
695 | } | 695 | } |
696 | 696 | ||
697 | + unsigned int numVT() { | ||
698 | + return VT.size(); | ||
699 | + } | ||
700 | + | ||
697 | /// Retrieve the vertex stored in index i | 701 | /// Retrieve the vertex stored in index i |
698 | /// @param vi is the desired vertex index | 702 | /// @param vi is the desired vertex index |
699 | stim::vec<T> getV(unsigned int vi){ | 703 | stim::vec<T> getV(unsigned int vi){ |