Commit 34ec8a820f0bdf37b0f47c8fc9ef99c915765771
1 parent
b50c840e
added comments
Showing
4 changed files
with
55 additions
and
61 deletions
Show diff stats
stim/gl/gl_spider.h
@@ -49,7 +49,7 @@ namespace stim | @@ -49,7 +49,7 @@ namespace stim | ||
49 | { | 49 | { |
50 | 50 | ||
51 | template<typename T> | 51 | template<typename T> |
52 | -class gl_spider : public virtual gl_texture<T> | 52 | +class gl_spider // : public virtual gl_texture<T> |
53 | { | 53 | { |
54 | //doen't use gl_texture really, just needs the GLuint id. | 54 | //doen't use gl_texture really, just needs the GLuint id. |
55 | //doesn't even need the texture iD really. | 55 | //doesn't even need the texture iD really. |
@@ -65,66 +65,70 @@ class gl_spider : public virtual gl_texture<T> | @@ -65,66 +65,70 @@ class gl_spider : public virtual gl_texture<T> | ||
65 | double hit_time;// = 0; | 65 | double hit_time;// = 0; |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | - // | ||
69 | stim::vec3<float> p; //vector designating the position of the spider. | 68 | stim::vec3<float> p; //vector designating the position of the spider. |
70 | - stim::vec3<float> d; //vector designating the orientation of the spider | ||
71 | - //always a unit vector. | ||
72 | - stim::vec<float> m; //magnitude of the spider vector. | ||
73 | - //mag[0] = length. | ||
74 | - //mag[1] = width. | 69 | + stim::vec3<float> d; //normalized direction of travel |
70 | + stim::vec<float> m; //size of the spider in tissue space | ||
71 | + | ||
75 | std::vector<stim::vec3<float> > dV; //A list of all the direction vectors. | 72 | std::vector<stim::vec3<float> > dV; //A list of all the direction vectors. |
76 | - std::vector<stim::vec3<float> > pV; //A list of all the position vectors. | 73 | + std::vector<stim::vec3<float> > pV; //A list of all test positions (relative to p) |
77 | std::vector<stim::vec3<float> > mV; //A list of all the size vectors. | 74 | std::vector<stim::vec3<float> > mV; //A list of all the size vectors. |
78 | 75 | ||
79 | - stim::matrix<float, 4> cT; //current Transformation matrix | ||
80 | - //From tissue space to texture space. | ||
81 | - GLuint texID; | ||
82 | - stim::vec<float> S; //Size of a voxel in the volume. | ||
83 | - stim::vec<float> R; //Dimensions of the volume. | 76 | + stim::matrix<float, 4> cT; //current Transformation matrix (tissue)->(texture) |
77 | + GLuint texID; //OpenGL ID for the texture to be traced | ||
78 | + stim::vec<float> S; //Size of a voxel in the volume. | ||
79 | + stim::vec<float> R; //Dimensions of the volume. | ||
84 | 80 | ||
85 | 81 | ||
86 | //GL and Cuda variables | 82 | //GL and Cuda variables |
87 | - GLuint dList; //displaylist ID | ||
88 | - GLuint fboID; //framebuffer ID | ||
89 | - GLuint texbufferID; //texbuffer ID, only necessary for | ||
90 | - //cuda aspect of the calculation. | ||
91 | - GLuint pfboID; //buffer object for position tracking. | ||
92 | - GLuint ptexbufferID; //texture object for position tracking. | ||
93 | - | ||
94 | - GLuint mfboID; //buffer object for magnitude adjustment. | ||
95 | - GLuint mtexbufferID; //texture object for magnitude adjustment. | ||
96 | - GLuint bfboID; //buffer object for position adjustment. | ||
97 | - GLuint btexbufferID; //buffer object for position adjustment. | 83 | + GLuint dList; //ID of the starting display lists (series of 4) |
84 | + //dList + 0 = direction template rectangles | ||
85 | + //dList + 1 = position template rectangles | ||
86 | + //dList + 2 = size template rectangles | ||
87 | + //dList + 3 = branch detection cylinder around the fiber | ||
88 | + | ||
89 | + GLuint fboID; //framebuffer ID for direction templates | ||
90 | + GLuint texbufferID; //texture ID for direction templates | ||
91 | + | ||
92 | + GLuint pfboID; //framebuffer ID, position templates | ||
93 | + GLuint ptexbufferID; //texture ID, position templates | ||
94 | + | ||
95 | + GLuint mfboID; //framebuffer ID, radius templates | ||
96 | + GLuint mtexbufferID; //texture ID, radius templates | ||
97 | + | ||
98 | + GLuint bfboID; //framebuffer ID, cylinder (surrounding fiber) | ||
99 | + GLuint btexbufferID; //texture ID, cylinder | ||
98 | 100 | ||
99 | int numSamples; //The number of templates in the buffer. | 101 | int numSamples; //The number of templates in the buffer. |
100 | int numSamplesPos; | 102 | int numSamplesPos; |
101 | int numSamplesMag; | 103 | int numSamplesMag; |
102 | 104 | ||
103 | - float stepsize;// = 5.0; //Step size. | ||
104 | -// float stepsize = 3.0; //Step size. | ||
105 | - int current_cost; //variable to store the cost of the current step. | ||
106 | - | 105 | + float length; //this will be a function of the radius |
106 | + float stepsize; //this will be a function of the length | ||
107 | + | ||
108 | + int current_cost; //variable to store the cost of the current step | ||
107 | 109 | ||
108 | //Tracing variables. | 110 | //Tracing variables. |
109 | - std::stack< stim::vec3<float> > seeds; //seed positions. | ||
110 | - std::stack< stim::vec3<float> > seedsvecs; //seed directions. | ||
111 | - std::stack< float > seedsmags; //seed magnitudes. | 111 | + std::stack< stim::vec3<float> > seeds; //seed positions |
112 | + std::stack< stim::vec3<float> > seedsvecs; //seed directions | ||
113 | + std::stack< float > seedsmags; //seed magnitudes | ||
112 | 114 | ||
113 | - std::vector< stim::vec3<float> > cL; //Positions of line currently being traced. | ||
114 | - std::vector< stim::vec3<float> > cD; //Direction of line currently being traced. | ||
115 | - std::vector< stim::vec<float> > cM; //Magnitude of line currently being traced. | 115 | + std::vector< stim::vec3<float> > cL; //centerline up to the current point |
116 | + std::vector< stim::vec3<float> > cD; //directions up to the current point (debugging) | ||
117 | + std::vector< stim::vec<float> > cM; //radius up to the current point | ||
116 | 118 | ||
117 | - stim::glnetwork<float> nt; //object for storing the network. | ||
118 | - stim::glObj<float> sk; | 119 | + stim::glnetwork<float> nt; //network object holding the currently traced centerlines |
120 | + stim::glObj<float> sk; //OBJ file storing the network (identical to above) | ||
119 | 121 | ||
120 | - stim::vec<float> rev; //reverse vector; | ||
121 | - stim::camera camSel; | ||
122 | - stim::vec3<float> ps; | ||
123 | - stim::vec3<float> ups; | ||
124 | - stim::vec3<float> ds; | 122 | + //consider replacing with two seed points facing opposite directions |
123 | + stim::vec<float> rev; //reverse vector | ||
125 | 124 | ||
126 | - //static const float t_length = 16.0; | ||
127 | - float t_length; | 125 | + //selection mode - detecting fiber intersections |
126 | + stim::camera camSel; //camera for selection mode (detecting collisions) | ||
127 | + stim::vec3<float> ps; //position for the selection camera | ||
128 | + stim::vec3<float> ups; //up direction for the selection camera | ||
129 | + stim::vec3<float> ds; //direction for the selection camera | ||
130 | + | ||
131 | + float t_length; //length of the template (in pixels) | ||
128 | 132 | ||
129 | //cuda texture variables that keep track of the binding. | 133 | //cuda texture variables that keep track of the binding. |
130 | stim::cuda::cuda_texture t_dir; | 134 | stim::cuda::cuda_texture t_dir; |
@@ -148,7 +152,6 @@ class gl_spider : public virtual gl_texture<T> | @@ -148,7 +152,6 @@ class gl_spider : public virtual gl_texture<T> | ||
148 | setMatrix(); //create the transformation matrix. | 152 | setMatrix(); //create the transformation matrix. |
149 | glCallList(dList); //move the templates to p, d, m. | 153 | glCallList(dList); //move the templates to p, d, m. |
150 | glFinish(); | 154 | glFinish(); |
151 | -// glFlush(); | ||
152 | #ifdef TIMING | 155 | #ifdef TIMING |
153 | direction_time += gpuStopTimer(); | 156 | direction_time += gpuStopTimer(); |
154 | #endif | 157 | #endif |
@@ -324,7 +327,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -324,7 +327,7 @@ class gl_spider : public virtual gl_texture<T> | ||
324 | ///Stored in a display list. | 327 | ///Stored in a display list. |
325 | ///uses the default d vector <0,0,1> | 328 | ///uses the default d vector <0,0,1> |
326 | void | 329 | void |
327 | - genDirectionVectors(float solidAngle = M_PI/2) | 330 | + genDirectionVectors(float solidAngle = stim::PI/2) |
328 | { | 331 | { |
329 | 332 | ||
330 | //Set up the vectors necessary for Rectangle creation. | 333 | //Set up the vectors necessary for Rectangle creation. |
@@ -1318,7 +1321,7 @@ class gl_spider : public virtual gl_texture<T> | @@ -1318,7 +1321,7 @@ class gl_spider : public virtual gl_texture<T> | ||
1318 | //--------------------------------------------------------------------------// | 1321 | //--------------------------------------------------------------------------// |
1319 | 1322 | ||
1320 | void | 1323 | void |
1321 | - MonteCarloDirectionVectors(int nSamples, float solidAngle = 2*M_PI) | 1324 | + MonteCarloDirectionVectors(int nSamples, float solidAngle = stim::TAU) |
1322 | { | 1325 | { |
1323 | // float PHI[2];//, Z[2];//, range; | 1326 | // float PHI[2];//, Z[2];//, range; |
1324 | // PHI[0] = asin(solidAngle/2); | 1327 | // PHI[0] = asin(solidAngle/2); |
stim/gl/gl_texture.h
@@ -68,10 +68,10 @@ class gl_texture : public virtual image_stack<T> | @@ -68,10 +68,10 @@ class gl_texture : public virtual image_stack<T> | ||
68 | ///@param string path to the directory with the image files. | 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. | 69 | ///Creates an instance of the gl_texture object with a path to the data. |
70 | 70 | ||
71 | - gl_texture(std::string file_path) | 71 | + gl_texture(std::string file_mask) |
72 | { | 72 | { |
73 | - path = file_path; | ||
74 | - image_stack<T>::load_images(path.append("/*.jpg")); | 73 | + //path = file_mask; |
74 | + image_stack<T>::load_images(file_mask); | ||
75 | setTextureType(); | 75 | setTextureType(); |
76 | } | 76 | } |
77 | 77 |
stim/grids/image_stack.h
@@ -32,12 +32,6 @@ public: | @@ -32,12 +32,6 @@ public: | ||
32 | 32 | ||
33 | stim::filename file_path(file_mask); | 33 | stim::filename file_path(file_mask); |
34 | 34 | ||
35 | - //if the file path is relative, update it with the current working directory | ||
36 | -// if(file_path.is_relative()){ | ||
37 | -// stim::filename wd = stim::filename::cwd(); | ||
38 | -// file_path = wd.get_relative(file_mask); | ||
39 | -// } | ||
40 | - | ||
41 | //get the list of files | 35 | //get the list of files |
42 | std::vector<stim::filename> file_list = file_path.get_list(); | 36 | std::vector<stim::filename> file_list = file_path.get_list(); |
43 | 37 | ||
@@ -46,11 +40,10 @@ public: | @@ -46,11 +40,10 @@ public: | ||
46 | std::cout<<"STIM ERROR (image_stack): No matching files for loading a stack."<<std::endl; | 40 | std::cout<<"STIM ERROR (image_stack): No matching files for loading a stack."<<std::endl; |
47 | exit(1); | 41 | exit(1); |
48 | } | 42 | } |
49 | - for(int i = 0; i < file_list.size(); i++) | ||
50 | - std::cout << file_list[i].str() << std::endl; | 43 | + //for(int i = 0; i < file_list.size(); i++) |
44 | + // std::cout << file_list[i].str() << std::endl; | ||
51 | 45 | ||
52 | //load the first image and set all of the image_stack properties | 46 | //load the first image and set all of the image_stack properties |
53 | -// std::cout<<"File to Load: "<<file_list[0].str()<<std::endl; | ||
54 | stim::image<T> I(file_list[0].str()); | 47 | stim::image<T> I(file_list[0].str()); |
55 | 48 | ||
56 | //set the image resolution and number of channels | 49 | //set the image resolution and number of channels |
@@ -64,8 +57,6 @@ public: | @@ -64,8 +57,6 @@ public: | ||
64 | 57 | ||
65 | //load and copy each image into the grid | 58 | //load and copy each image into the grid |
66 | for(unsigned int i = 0; i<R[3]; i++){ | 59 | for(unsigned int i = 0; i<R[3]; i++){ |
67 | - | ||
68 | -// std::cout<<"File to Load: "<<file_list[i].str()<<std::endl; | ||
69 | //load the image | 60 | //load the image |
70 | stim::image<T> I(file_list[i].str()); | 61 | stim::image<T> I(file_list[i].str()); |
71 | 62 |
stim/visualization/cylinder.h
@@ -331,7 +331,7 @@ class cylinder | @@ -331,7 +331,7 @@ class cylinder | ||
331 | } | 331 | } |
332 | // std::cout << e[idx].U.len() << " " << mags[idx][0] << std::endl; | 332 | // std::cout << e[idx].U.len() << " " << mags[idx][0] << std::endl; |
333 | // std::cout << v2 << std::endl; | 333 | // std::cout << v2 << std::endl; |
334 | - return(v2); | 334 | + return(v1); |
335 | // return (mags[idx][0] + (mags[idx+1][0]-mags[idx][0])*rat); | 335 | // return (mags[idx][0] + (mags[idx+1][0]-mags[idx][0])*rat); |
336 | // ( | 336 | // ( |
337 | } | 337 | } |