Commit 8d55ae0688046e5eabee47fedcc23438df0356a2
1 parent
883e39e4
Edited vec3 to add a comparison method and edited glSpider.h to improve segmentation
Showing
3 changed files
with
16 additions
and
8 deletions
Show diff stats
stim/gl/gl_spider.h
@@ -317,7 +317,8 @@ class gl_spider // : public virtual gl_texture<T> | @@ -317,7 +317,8 @@ class gl_spider // : public virtual gl_texture<T> | ||
317 | } | 317 | } |
318 | stim::vec3<float> v = cyl.surf(pval, result[i][0]); ///find the coordinates of the point at pval on the surface in tissue space. | 318 | stim::vec3<float> v = cyl.surf(pval, result[i][0]); ///find the coordinates of the point at pval on the surface in tissue space. |
319 | stim::vec3<float> di = cyl.p(pval); ///find the coord of v in tissue space projected on the centerline. | 319 | stim::vec3<float> di = cyl.p(pval); ///find the coord of v in tissue space projected on the centerline. |
320 | - float rad = cyl.r(pval)/2; ///find the radius at the pvalue's location | 320 | + float rad = cyl.r(pval); ///find the radius at the pvalue's location |
321 | + // float rad = cyl.r(pval)/2; ///find the radius at the pvalue's location | ||
321 | if( | 322 | if( |
322 | !(v[0] > size[0] || v[1] > size[1] | 323 | !(v[0] > size[0] || v[1] > size[1] |
323 | || v[2] > size[2] || v[0] < 0 | 324 | || v[2] > size[2] || v[0] < 0 |
@@ -374,7 +375,7 @@ class gl_spider // : public virtual gl_texture<T> | @@ -374,7 +375,7 @@ class gl_spider // : public virtual gl_texture<T> | ||
374 | ///Stored in a display list. | 375 | ///Stored in a display list. |
375 | ///uses the default d vector <0,0,1> | 376 | ///uses the default d vector <0,0,1> |
376 | void | 377 | void |
377 | - genDirectionVectors(float solidAngle = stim::PI/2) | 378 | + genDirectionVectors(float solidAngle = 3*stim::PI/4) |
378 | { | 379 | { |
379 | 380 | ||
380 | //Set up the vectors necessary for Rectangle creation. | 381 | //Set up the vectors necessary for Rectangle creation. |
stim/image/image.h
@@ -141,7 +141,7 @@ public: | @@ -141,7 +141,7 @@ public: | ||
141 | 141 | ||
142 | //save a Netpbm file | 142 | //save a Netpbm file |
143 | void load_netpbm(std::string filename) { | 143 | void load_netpbm(std::string filename) { |
144 | - std::ifstream infile(filename, std::ios::in | std::ios::binary); //open an output file | 144 | + std::ifstream infile(filename.c_str(), std::ios::in | std::ios::binary); //open an output file |
145 | if (!infile) { | 145 | if (!infile) { |
146 | std::cout << "Error opening input file in image::load_netpbm()" << std::endl; | 146 | std::cout << "Error opening input file in image::load_netpbm()" << std::endl; |
147 | exit(1); | 147 | exit(1); |
@@ -244,7 +244,7 @@ public: | @@ -244,7 +244,7 @@ public: | ||
244 | 244 | ||
245 | //save a Netpbm file | 245 | //save a Netpbm file |
246 | void save_netpbm(std::string filename) { | 246 | void save_netpbm(std::string filename) { |
247 | - std::ofstream outfile(filename, std::ios::out | std::ios::binary); //open an output file | 247 | + std::ofstream outfile(filename.c_str(), std::ios::out | std::ios::binary); //open an output file |
248 | if(!outfile) { | 248 | if(!outfile) { |
249 | std::cout << "Error generating output file in image::save_netpbm()" << std::endl; | 249 | std::cout << "Error generating output file in image::save_netpbm()" << std::endl; |
250 | exit(1); | 250 | exit(1); |
@@ -356,8 +356,8 @@ public: | @@ -356,8 +356,8 @@ public: | ||
356 | } | 356 | } |
357 | 357 | ||
358 | /// Returns an std::vector containing each channel as a separate image | 358 | /// Returns an std::vector containing each channel as a separate image |
359 | - std::vector<image<T>> split() const { | ||
360 | - std::vector<image<T>> r; //create an image array | 359 | + std::vector<image<T> > split() const { |
360 | + std::vector<image<T> > r; //create an image array | ||
361 | r.resize(C()); //create images for each channel | 361 | r.resize(C()); //create images for each channel |
362 | 362 | ||
363 | for (size_t c = 0; c < C(); c++) { //for each channel | 363 | for (size_t c = 0; c < C(); c++) { //for each channel |
@@ -367,7 +367,7 @@ public: | @@ -367,7 +367,7 @@ public: | ||
367 | } | 367 | } |
368 | 368 | ||
369 | /// Merge a series of single-channel images into a multi-channel image | 369 | /// Merge a series of single-channel images into a multi-channel image |
370 | - void merge(std::vector<image<T>>& list) { | 370 | + void merge(std::vector<image<T> >& list) { |
371 | size_t x = list[0].width(); //calculate the size of the image | 371 | size_t x = list[0].width(); //calculate the size of the image |
372 | size_t y = list[0].height(); | 372 | size_t y = list[0].height(); |
373 | allocate(x, y, list.size()); //re-allocate the image | 373 | allocate(x, y, list.size()); //re-allocate the image |
stim/math/vec3.h
@@ -68,7 +68,7 @@ public: | @@ -68,7 +68,7 @@ public: | ||
68 | } | 68 | } |
69 | 69 | ||
70 | 70 | ||
71 | - /// Convert the vector from cartesian to spherical coordinates (x, y, z -> r, theta, phi where theta = [0, 2*pi]) | 71 | + /// Convert the vector from cartesian to spherical coordinates (x, y, z -> r, theta, phi where theta = [-PI, PI]) |
72 | CUDA_CALLABLE vec3<T> cart2sph() const{ | 72 | CUDA_CALLABLE vec3<T> cart2sph() const{ |
73 | vec3<T> sph; | 73 | vec3<T> sph; |
74 | sph.ptr[0] = len(); | 74 | sph.ptr[0] = len(); |
@@ -236,6 +236,13 @@ public: | @@ -236,6 +236,13 @@ public: | ||
236 | return result; | 236 | return result; |
237 | } | 237 | } |
238 | 238 | ||
239 | + CUDA_CALLABLE bool operator==(vec3<T> rhs) const{ | ||
240 | + if(rhs[0] == ptr[0] && rhs[1] == ptr[1] && rhs[2] == ptr[2]) | ||
241 | + return true; | ||
242 | + else | ||
243 | + return false; | ||
244 | + } | ||
245 | + | ||
239 | //#ifndef __NVCC__ | 246 | //#ifndef __NVCC__ |
240 | /// Outputs the vector as a string | 247 | /// Outputs the vector as a string |
241 | std::string str() const{ | 248 | std::string str() const{ |