Commit 8d55ae0688046e5eabee47fedcc23438df0356a2

Authored by Pavel Govyadinov
1 parent 883e39e4

Edited vec3 to add a comparison method and edited glSpider.h to improve segmentation

stim/gl/gl_spider.h
... ... @@ -317,7 +317,8 @@ class gl_spider // : public virtual gl_texture<T>
317 317 }
318 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 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 322 if(
322 323 !(v[0] > size[0] || v[1] > size[1]
323 324 || v[2] > size[2] || v[0] < 0
... ... @@ -374,7 +375,7 @@ class gl_spider // : public virtual gl_texture&lt;T&gt;
374 375 ///Stored in a display list.
375 376 ///uses the default d vector <0,0,1>
376 377 void
377   - genDirectionVectors(float solidAngle = stim::PI/2)
  378 + genDirectionVectors(float solidAngle = 3*stim::PI/4)
378 379 {
379 380  
380 381 //Set up the vectors necessary for Rectangle creation.
... ...
stim/image/image.h
... ... @@ -141,7 +141,7 @@ public:
141 141  
142 142 //save a Netpbm file
143 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 145 if (!infile) {
146 146 std::cout << "Error opening input file in image::load_netpbm()" << std::endl;
147 147 exit(1);
... ... @@ -244,7 +244,7 @@ public:
244 244  
245 245 //save a Netpbm file
246 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 248 if(!outfile) {
249 249 std::cout << "Error generating output file in image::save_netpbm()" << std::endl;
250 250 exit(1);
... ... @@ -356,8 +356,8 @@ public:
356 356 }
357 357  
358 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 361 r.resize(C()); //create images for each channel
362 362  
363 363 for (size_t c = 0; c < C(); c++) { //for each channel
... ... @@ -367,7 +367,7 @@ public:
367 367 }
368 368  
369 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 371 size_t x = list[0].width(); //calculate the size of the image
372 372 size_t y = list[0].height();
373 373 allocate(x, y, list.size()); //re-allocate the image
... ...
stim/math/vec3.h
... ... @@ -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 72 CUDA_CALLABLE vec3<T> cart2sph() const{
73 73 vec3<T> sph;
74 74 sph.ptr[0] = len();
... ... @@ -236,6 +236,13 @@ public:
236 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 246 //#ifndef __NVCC__
240 247 /// Outputs the vector as a string
241 248 std::string str() const{
... ...