diff --git a/stim/gl/gl_spider.h b/stim/gl/gl_spider.h index 7a0a0a0..90ff7ca 100644 --- a/stim/gl/gl_spider.h +++ b/stim/gl/gl_spider.h @@ -49,7 +49,7 @@ namespace stim { template -class gl_spider : public virtual gl_texture +class gl_spider // : public virtual gl_texture { //doen't use gl_texture really, just needs the GLuint id. //doesn't even need the texture iD really. @@ -65,66 +65,70 @@ class gl_spider : public virtual gl_texture double hit_time;// = 0; #endif - // stim::vec3 p; //vector designating the position of the spider. - stim::vec3 d; //vector designating the orientation of the spider - //always a unit vector. - stim::vec m; //magnitude of the spider vector. - //mag[0] = length. - //mag[1] = width. + stim::vec3 d; //normalized direction of travel + stim::vec m; //size of the spider in tissue space + std::vector > dV; //A list of all the direction vectors. - std::vector > pV; //A list of all the position vectors. + std::vector > pV; //A list of all test positions (relative to p) std::vector > mV; //A list of all the size vectors. - stim::matrix cT; //current Transformation matrix - //From tissue space to texture space. - GLuint texID; - stim::vec S; //Size of a voxel in the volume. - stim::vec R; //Dimensions of the volume. + stim::matrix cT; //current Transformation matrix (tissue)->(texture) + GLuint texID; //OpenGL ID for the texture to be traced + stim::vec S; //Size of a voxel in the volume. + stim::vec R; //Dimensions of the volume. //GL and Cuda variables - GLuint dList; //displaylist ID - GLuint fboID; //framebuffer ID - GLuint texbufferID; //texbuffer ID, only necessary for - //cuda aspect of the calculation. - GLuint pfboID; //buffer object for position tracking. - GLuint ptexbufferID; //texture object for position tracking. - - GLuint mfboID; //buffer object for magnitude adjustment. - GLuint mtexbufferID; //texture object for magnitude adjustment. - GLuint bfboID; //buffer object for position adjustment. - GLuint btexbufferID; //buffer object for position adjustment. + GLuint dList; //ID of the starting display lists (series of 4) + //dList + 0 = direction template rectangles + //dList + 1 = position template rectangles + //dList + 2 = size template rectangles + //dList + 3 = branch detection cylinder around the fiber + + GLuint fboID; //framebuffer ID for direction templates + GLuint texbufferID; //texture ID for direction templates + + GLuint pfboID; //framebuffer ID, position templates + GLuint ptexbufferID; //texture ID, position templates + + GLuint mfboID; //framebuffer ID, radius templates + GLuint mtexbufferID; //texture ID, radius templates + + GLuint bfboID; //framebuffer ID, cylinder (surrounding fiber) + GLuint btexbufferID; //texture ID, cylinder int numSamples; //The number of templates in the buffer. int numSamplesPos; int numSamplesMag; - float stepsize;// = 5.0; //Step size. -// float stepsize = 3.0; //Step size. - int current_cost; //variable to store the cost of the current step. - + float length; //this will be a function of the radius + float stepsize; //this will be a function of the length + + int current_cost; //variable to store the cost of the current step //Tracing variables. - std::stack< stim::vec3 > seeds; //seed positions. - std::stack< stim::vec3 > seedsvecs; //seed directions. - std::stack< float > seedsmags; //seed magnitudes. + std::stack< stim::vec3 > seeds; //seed positions + std::stack< stim::vec3 > seedsvecs; //seed directions + std::stack< float > seedsmags; //seed magnitudes - std::vector< stim::vec3 > cL; //Positions of line currently being traced. - std::vector< stim::vec3 > cD; //Direction of line currently being traced. - std::vector< stim::vec > cM; //Magnitude of line currently being traced. + std::vector< stim::vec3 > cL; //centerline up to the current point + std::vector< stim::vec3 > cD; //directions up to the current point (debugging) + std::vector< stim::vec > cM; //radius up to the current point - stim::glnetwork nt; //object for storing the network. - stim::glObj sk; + stim::glnetwork nt; //network object holding the currently traced centerlines + stim::glObj sk; //OBJ file storing the network (identical to above) - stim::vec rev; //reverse vector; - stim::camera camSel; - stim::vec3 ps; - stim::vec3 ups; - stim::vec3 ds; + //consider replacing with two seed points facing opposite directions + stim::vec rev; //reverse vector - //static const float t_length = 16.0; - float t_length; + //selection mode - detecting fiber intersections + stim::camera camSel; //camera for selection mode (detecting collisions) + stim::vec3 ps; //position for the selection camera + stim::vec3 ups; //up direction for the selection camera + stim::vec3 ds; //direction for the selection camera + + float t_length; //length of the template (in pixels) //cuda texture variables that keep track of the binding. stim::cuda::cuda_texture t_dir; @@ -148,7 +152,6 @@ class gl_spider : public virtual gl_texture setMatrix(); //create the transformation matrix. glCallList(dList); //move the templates to p, d, m. glFinish(); -// glFlush(); #ifdef TIMING direction_time += gpuStopTimer(); #endif @@ -324,7 +327,7 @@ class gl_spider : public virtual gl_texture ///Stored in a display list. ///uses the default d vector <0,0,1> void - genDirectionVectors(float solidAngle = M_PI/2) + genDirectionVectors(float solidAngle = stim::PI/2) { //Set up the vectors necessary for Rectangle creation. @@ -1318,7 +1321,7 @@ class gl_spider : public virtual gl_texture //--------------------------------------------------------------------------// void - MonteCarloDirectionVectors(int nSamples, float solidAngle = 2*M_PI) + MonteCarloDirectionVectors(int nSamples, float solidAngle = stim::TAU) { // float PHI[2];//, Z[2];//, range; // PHI[0] = asin(solidAngle/2); diff --git a/stim/gl/gl_texture.h b/stim/gl/gl_texture.h index 041f52c..d28fb7e 100644 --- a/stim/gl/gl_texture.h +++ b/stim/gl/gl_texture.h @@ -68,10 +68,10 @@ class gl_texture : public virtual image_stack ///@param string path to the directory with the image files. ///Creates an instance of the gl_texture object with a path to the data. - gl_texture(std::string file_path) + gl_texture(std::string file_mask) { - path = file_path; - image_stack::load_images(path.append("/*.jpg")); + //path = file_mask; + image_stack::load_images(file_mask); setTextureType(); } diff --git a/stim/grids/image_stack.h b/stim/grids/image_stack.h index 1eb7359..e6ace6a 100644 --- a/stim/grids/image_stack.h +++ b/stim/grids/image_stack.h @@ -32,12 +32,6 @@ public: stim::filename file_path(file_mask); - //if the file path is relative, update it with the current working directory -// if(file_path.is_relative()){ -// stim::filename wd = stim::filename::cwd(); -// file_path = wd.get_relative(file_mask); -// } - //get the list of files std::vector file_list = file_path.get_list(); @@ -46,11 +40,10 @@ public: std::cout<<"STIM ERROR (image_stack): No matching files for loading a stack."< I(file_list[0].str()); //set the image resolution and number of channels @@ -64,8 +57,6 @@ public: //load and copy each image into the grid for(unsigned int i = 0; i I(file_list[i].str()); diff --git a/stim/visualization/cylinder.h b/stim/visualization/cylinder.h index 8822e94..bff9f04 100644 --- a/stim/visualization/cylinder.h +++ b/stim/visualization/cylinder.h @@ -331,7 +331,7 @@ class cylinder } // std::cout << e[idx].U.len() << " " << mags[idx][0] << std::endl; // std::cout << v2 << std::endl; - return(v2); + return(v1); // return (mags[idx][0] + (mags[idx+1][0]-mags[idx][0])*rat); // ( } -- libgit2 0.21.4