diff --git a/stim/cuda/cost.h b/stim/cuda/cost.h index 6dc213b..83da752 100644 --- a/stim/cuda/cost.h +++ b/stim/cuda/cost.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include @@ -39,7 +39,7 @@ float get_sum(float *diff) ret = cublasSetVector(20*10, sizeof(*diff), diff, 1, v_dif, 1); float out; ret = cublasSasum(handle, 20*10, v_dif, 1, &out); - cublasDestroy(ret); +// cublasDestroy(ret); cublasDestroy(handle); return out; } @@ -139,24 +139,27 @@ stim::vec get_cost(cudaGraphicsResource_t src, int DIM_Y) // cudaOccupancyMaxPotentialBlockSize(&minGridSize, &blockSize, get_diff, 0, 20*DIM_Y*10); // std::cout << blockSize << std::endl; // std::cout << minGridSize << std::endl; +// stringstream name; //for debugging +// name << "Test.bmp"; +// dim3 block(4,4); +// dim3 grid(20/4, DIM_Y*10/4); +// int gridSize = (DIM_Y*10*20 + 1024 - 1)/1024; +// dim3 grid(26, 26); +// dim3 grid = GenGrid1D(DIM_Y*10*20); +// stim::gpu2image(result, name.str(), 20,DIM_Y*10,0,1); +// name.clear(); +// name << "sample_" << inter << "_" << idx << ".bmp"; +// stim::gpu2image(v_dif, name.str(), 20,10,0,1); float output[DIM_Y]; stim::vec ret(0, 0); float mini = 10000000000000000.0; int idx; - stringstream name; //for debugging -// name << "Test.bmp"; initArray(src, DIM_Y*10); dim3 grid(20/2, DIM_Y*10/2); -// dim3 block(4,4); -// dim3 grid(20/4, DIM_Y*10/4); -// int gridSize = (DIM_Y*10*20 + 1024 - 1)/1024; -// dim3 grid(26, 26); dim3 block(2, 2); -// dim3 grid = GenGrid1D(DIM_Y*10*20); get_diff <<< grid, block >>> (result); -// stim::gpu2image(result, name.str(), 20,DIM_Y*10,0,1); for (int i = 0; i < DIM_Y; i++){ output[i] = get_sum(result+(20*10*i)); if(output[i] <= mini){ @@ -165,10 +168,7 @@ stim::vec get_cost(cudaGraphicsResource_t src, int DIM_Y) } } -// name.clear(); -// name << "sample_" << inter << "_" << idx << ".bmp"; output[idx] = get_sum(result+(20*10*idx)); -// stim::gpu2image(v_dif, name.str(), 20,10,0,1); cleanUP(src); ret[0] = idx; ret[1] = (int) output[idx]; return ret; diff --git a/stim/gl/gl_spider.h b/stim/gl/gl_spider.h index 51d3c52..8e93541 100644 --- a/stim/gl/gl_spider.h +++ b/stim/gl/gl_spider.h @@ -10,7 +10,7 @@ #include "stim/gl/gl_texture.h" #include "stim/visualization/camera.h" #include "stim/gl/error.h" -#include "stim/math/mathvec.h" +#include "stim/math/vector.h" #include "stim/math/rect.h" #include "stim/math/matrix.h" #include "stim/cuda/cost.h" @@ -144,7 +144,7 @@ class gl_spider ///Method for populating the vector arrays with sampled vectors. ///uses the default d vector <0,0,1> void - genDirectionVectors(float solidAngle = M_PI) + genDirectionVectors(float solidAngle = 5*M_PI/4) { //ofstream file; //file.open("dvectors.txt"); diff --git a/stim/grids/grid.h b/stim/grids/grid.h index b671d9a..361fd08 100644 --- a/stim/grids/grid.h +++ b/stim/grids/grid.h @@ -7,7 +7,7 @@ #include #include -#include "../math/mathvec.h" +#include namespace stim{ diff --git a/stim/math/matrix.h b/stim/math/matrix.h index 193d5ee..6437a71 100644 --- a/stim/math/matrix.h +++ b/stim/math/matrix.h @@ -4,7 +4,7 @@ //#include "rts/vector.h" #include #include -#include "mathvec.h" +#include #include "../cuda/callable.h" namespace stim{ diff --git a/stim/math/plane.h b/stim/math/plane.h index e384ef0..b009cad 100644 --- a/stim/math/plane.h +++ b/stim/math/plane.h @@ -2,7 +2,7 @@ #define RTS_PLANE_H #include -#include "../math/vector.h" +#include #include "rts/cuda/callable.h" diff --git a/stim/math/quad.h b/stim/math/quad.h index 628b982..c983008 100644 --- a/stim/math/quad.h +++ b/stim/math/quad.h @@ -2,10 +2,10 @@ #define RTS_QUAD_H //enable CUDA_CALLABLE macro -#include "../cuda/callable.h" -#include "../math/vector.h" -#include "../math/triangle.h" -#include "../math/quaternion.h" +#include +#include +#include +#include #include #include #include diff --git a/stim/math/rect.h b/stim/math/rect.h index 0a5dfa3..8627063 100644 --- a/stim/math/rect.h +++ b/stim/math/rect.h @@ -2,10 +2,10 @@ #define RTS_RECT_H //enable CUDA_CALLABLE macro -#include "../cuda/callable.h" -#include "../math/mathvec.h" -#include "../math/triangle.h" -#include "../math/quaternion.h" +#include +#include +#include +#include #include #include #include diff --git a/stim/math/spharmonics.h b/stim/math/spharmonics.h index a6401de..3182faa 100644 --- a/stim/math/spharmonics.h +++ b/stim/math/spharmonics.h @@ -1,7 +1,7 @@ #ifndef STIM_SPH_HARMONICS #define STIM_SPH_HARMONICS -#include +#include #include #include diff --git a/stim/math/triangle.h b/stim/math/triangle.h index 6586866..d816e1b 100644 --- a/stim/math/triangle.h +++ b/stim/math/triangle.h @@ -2,8 +2,8 @@ #define RTS_TRIANGLE_H //enable CUDA_CALLABLE macro -#include "../cuda/callable.h" -#include "../math/mathvec.h" +#include +#include #include namespace stim{ diff --git a/stim/visualization/camera.h b/stim/visualization/camera.h index 1c27118..6c615dc 100644 --- a/stim/visualization/camera.h +++ b/stim/visualization/camera.h @@ -1,6 +1,6 @@ -#include "../math/mathvec.h" -#include "../math/quaternion.h" -#include "../math/matrix.h" +#include +#include +#include #include diff --git a/stim/visualization/glObj.h b/stim/visualization/glObj.h new file mode 100644 index 0000000..5210041 --- /dev/null +++ b/stim/visualization/glObj.h @@ -0,0 +1,80 @@ +#ifndef STIM_GLOBJ_H +#define STIM_GLOBJ_H + +#include +#include +#include +#include + + +namespace stim +{ +/** This class uses the loading functionality of the obj class in order to + * Assist with the visualization the segmented vessels. + * Uses +*/ + +class objGl : public virtual stim::obj +{ +private: + using stim::obj::L; + using stim::obj::P; + using stim::obj::F; + using vec::size; + using vec::at; + GLuint dList; + + + void + init + { + dList = glGenList(1); + glListBase(dList); + glMatrixMode(GL_PROJECTION); + glLoadIdentity; + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; + + } + + void + Create() + { + int len = (int) numL(); + std::vector< stim::vec > line; + glNewList(dList, GL_COMPILE); + glColor3f(0.5, 1.0, 0.5); + for(int i = 0; i < len; i++){ + line = getL_V(i); + glBegin(GL_LINES); + for(int j = 0; j < line.size(); j++){ + glVectex3f( + line[j][0], + line[j][1], + line[j][2] + ); + } + glEnd(); + } + glEndList(); + } + +public: + objGl(std::string filename) + { + stim::obj::load(filename); + glPopMatrix(); //Safety Operation to avoid changing the current matrix. + init(); + Create(); + glPushMatrix(); + } + + + void + Render() + { + glCallList(dList); + } + +} +} -- libgit2 0.21.4