Commit 5425923717571010bb208031ee693538a51e5f8c
1 parent
1bab235a
added strObj function to return a string that saves the fiber path with l prefix in obj
Showing
1 changed file
with
24 additions
and
0 deletions
Show diff stats
stim/visualization/fiber.h
... | ... | @@ -403,7 +403,31 @@ public: |
403 | 403 | |
404 | 404 | return ss.str(); |
405 | 405 | } |
406 | + int getIndexes(std::string* input, std::string searched, int sizeV) { | |
407 | + int result = 0; | |
408 | + for (int i = 0; i < sizeV; i++) { | |
409 | + if (input[i] == searched) { | |
410 | + result = i + 1; | |
411 | + } | |
412 | + } | |
406 | 413 | |
414 | + return result; | |
415 | + } | |
416 | + // strObj returns a string of fiber indices corresponding to position | |
417 | + std::string | |
418 | + strObj(std::string* strArray, int sizeV) | |
419 | + { | |
420 | + std::stringstream ss; | |
421 | + std::stringstream oss; | |
422 | + for(unsigned int i = 0; i < N; i++){ | |
423 | + ss.str(std::string()); | |
424 | + for(unsigned int d = 0; d < 3; d++){ | |
425 | + ss<<c[i][d]; | |
426 | + } | |
427 | + oss<<getIndexes(strArray, ss.str(), sizeV)<<" "; | |
428 | + } | |
429 | + return oss.str(); | |
430 | + } | |
407 | 431 | /// Returns the number of centerline points in the fiber |
408 | 432 | unsigned int n_pts(){ |
409 | 433 | return N; | ... | ... |