Commit 540379da9945872593a0a7dda4cb79a1ccb7288e

Authored by Jiaming Guo
1 parent 4d23da9c

rewrite loading functions

Showing 1 changed file with 19 additions and 61 deletions   Show diff stats
@@ -491,30 +491,6 @@ void map(float sigma, int device, float threshold){ @@ -491,30 +491,6 @@ void map(float sigma, int device, float threshold){
491 std::cout << "FPR: " << FNR << std::endl; 491 std::cout << "FPR: " << FNR << std::endl;
492 } 492 }
493 493
494 -void map_swc(float sigma, int device, float threshold) {  
495 -  
496 - // compare two networks  
497 - _GT = GT.compare(T, sigma, device); //compare the ground truth to the test case - store errors in _GT  
498 - _T = T.compare(_GT, sigma, device); //compare the test case to the ground truth - store errors in _T  
499 -  
500 - // mapping two networks and get their edge relation  
501 - _GT.mapping(_T, _gt_t, device, threshold);  
502 - _T.mapping(_GT, _t_gt, device, threshold);  
503 -  
504 - // generate random color set based on the number of edges in GT  
505 - size_t num = _gt_t.size(); // also create random color for unmapping edge, but won't be used though  
506 - colormap.resize(3 * num); // 3 portions compound RGB  
507 - for (int i = 0; i < 3 * num; i++)  
508 - colormap[i] = rand() / (float)RAND_MAX; // set to [0, 1]  
509 -  
510 - //calculate the metrics  
511 - float FPR = _GT.average(0); //calculate the metrics  
512 - float FNR = _T.average(0);  
513 -  
514 - std::cout << "FNR: " << FPR << std::endl; //print false alarms and misses  
515 - std::cout << "FPR: " << FNR << std::endl;  
516 -}  
517 -  
518 // writes features of the networks i.e average segment length, tortuosity, branching index, contraction, fractal dimension, number of end and branch points to a csv file 494 // writes features of the networks i.e average segment length, tortuosity, branching index, contraction, fractal dimension, number of end and branch points to a csv file
519 // Pranathi wrote this - saves network features to a CSV file 495 // Pranathi wrote this - saves network features to a CSV file
520 void features(std::string filename){ 496 void features(std::string filename){
@@ -597,45 +573,27 @@ int main(int argc, char* argv[]) @@ -597,45 +573,27 @@ int main(int argc, char* argv[])
597 } 573 }
598 } 574 }
599 575
600 - if (args.nargs() == 2) { //if two files are specified, they will be displayed in neighboring viewports and compared  
601 - if (1 == swc_ind) { //loading swc files  
602 - int device = args["device"].as_int(); //get the device value from the user  
603 - num_nets = 2; //set the number of networks to two  
604 - sigma = args["sigma"].as_float(); //get the sigma value from the user  
605 - radius = sigma;  
606 - T.load_swc(args.arg(1)); //load the second (test) network  
607 - if (args["features"].is_set()) //if the user wants to save features  
608 - features(args["features"].as_string());  
609 - //does it need to be resampled??  
610 - //GT = GT.resample(resample_rate * sigma); //resample both networks based on the sigma value  
611 - //T = T.resample(resample_rate * sigma);  
612 - if (args["mapping"].is_set()) {  
613 - float threshold = args["mapping"].as_float();  
614 - map_swc(sigma, device, threshold);  
615 - //std::cout << "right now networks that are loaded from swc files do not need to be mapped with each other!" << std::endl;  
616 - //exit(1);  
617 - }  
618 - else  
619 - compare(sigma, device); //run the comparison algorithm 576 + if (args.nargs() == 2) { //if two files are specified, they will be displayed in neighboring viewports and compared
  577 + int device = args["device"].as_int(); //get the device value from the user
  578 + num_nets = 2; //set the number of networks to two
  579 + sigma = args["sigma"].as_float(); //get the sigma value from the user
  580 + radius = sigma;
  581 + if (1 == swc_ind) //loading swc files
  582 + T.load_swc(args.arg(1)); //load the second (test) network
  583 + else //loading obj files
  584 + T.load_obj(args.arg(1));
  585 + if (args["features"].is_set()) //if the user wants to save features
  586 + features(args["features"].as_string());
  587 + //does it need to be resampled??
  588 + GT = GT.resample(resample_rate * sigma); //resample both networks based on the sigma value
  589 + T = T.resample(resample_rate * sigma);
  590 + if (args["mapping"].is_set()) {
  591 + float threshold = args["mapping"].as_float();
  592 + map(sigma, device, threshold);
620 } 593 }
621 - else {  
622 - int device = args["device"].as_int(); //get the device value from the user  
623 - num_nets = 2; //set the number of networks to two  
624 - sigma = args["sigma"].as_float(); //get the sigma value from the user  
625 - radius = sigma;  
626 - T.load_obj(args.arg(1)); //load the second (test) network  
627 - if (args["features"].is_set()) //if the user wants to save features  
628 - features(args["features"].as_string());  
629 - GT = GT.resample(resample_rate * sigma); //resample both networks based on the sigma value  
630 - T = T.resample(resample_rate * sigma);  
631 - if (args["mapping"].is_set()) {  
632 - float threshold = args["mapping"].as_float();  
633 - map(sigma, device, threshold);  
634 - }  
635 - else  
636 - compare(sigma, device); //run the comparison algorithm 594 + else
  595 + compare(sigma, device); //run the comparison algorithm
637 } 596 }
638 - }  
639 597
640 //if a GUI is requested, display the network using OpenGL 598 //if a GUI is requested, display the network using OpenGL
641 if(args["gui"].is_set()){ 599 if(args["gui"].is_set()){