From 540379da9945872593a0a7dda4cb79a1ccb7288e Mon Sep 17 00:00:00 2001 From: Jiaming Guo Date: Tue, 17 Jan 2017 14:46:48 -0600 Subject: [PATCH] rewrite loading functions --- main.cu | 80 +++++++++++++++++++------------------------------------------------------------- 1 file changed, 19 insertions(+), 61 deletions(-) diff --git a/main.cu b/main.cu index a4c4b3c..f0ad30c 100644 --- a/main.cu +++ b/main.cu @@ -491,30 +491,6 @@ void map(float sigma, int device, float threshold){ std::cout << "FPR: " << FNR << std::endl; } -void map_swc(float sigma, int device, float threshold) { - - // compare two networks - _GT = GT.compare(T, sigma, device); //compare the ground truth to the test case - store errors in _GT - _T = T.compare(_GT, sigma, device); //compare the test case to the ground truth - store errors in _T - - // mapping two networks and get their edge relation - _GT.mapping(_T, _gt_t, device, threshold); - _T.mapping(_GT, _t_gt, device, threshold); - - // generate random color set based on the number of edges in GT - size_t num = _gt_t.size(); // also create random color for unmapping edge, but won't be used though - colormap.resize(3 * num); // 3 portions compound RGB - for (int i = 0; i < 3 * num; i++) - colormap[i] = rand() / (float)RAND_MAX; // set to [0, 1] - - //calculate the metrics - float FPR = _GT.average(0); //calculate the metrics - float FNR = _T.average(0); - - std::cout << "FNR: " << FPR << std::endl; //print false alarms and misses - std::cout << "FPR: " << FNR << std::endl; -} - // 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 // Pranathi wrote this - saves network features to a CSV file void features(std::string filename){ @@ -597,45 +573,27 @@ int main(int argc, char* argv[]) } } - if (args.nargs() == 2) { //if two files are specified, they will be displayed in neighboring viewports and compared - if (1 == swc_ind) { //loading swc files - int device = args["device"].as_int(); //get the device value from the user - num_nets = 2; //set the number of networks to two - sigma = args["sigma"].as_float(); //get the sigma value from the user - radius = sigma; - T.load_swc(args.arg(1)); //load the second (test) network - if (args["features"].is_set()) //if the user wants to save features - features(args["features"].as_string()); - //does it need to be resampled?? - //GT = GT.resample(resample_rate * sigma); //resample both networks based on the sigma value - //T = T.resample(resample_rate * sigma); - if (args["mapping"].is_set()) { - float threshold = args["mapping"].as_float(); - map_swc(sigma, device, threshold); - //std::cout << "right now networks that are loaded from swc files do not need to be mapped with each other!" << std::endl; - //exit(1); - } - else - compare(sigma, device); //run the comparison algorithm + if (args.nargs() == 2) { //if two files are specified, they will be displayed in neighboring viewports and compared + int device = args["device"].as_int(); //get the device value from the user + num_nets = 2; //set the number of networks to two + sigma = args["sigma"].as_float(); //get the sigma value from the user + radius = sigma; + if (1 == swc_ind) //loading swc files + T.load_swc(args.arg(1)); //load the second (test) network + else //loading obj files + T.load_obj(args.arg(1)); + if (args["features"].is_set()) //if the user wants to save features + features(args["features"].as_string()); + //does it need to be resampled?? + GT = GT.resample(resample_rate * sigma); //resample both networks based on the sigma value + T = T.resample(resample_rate * sigma); + if (args["mapping"].is_set()) { + float threshold = args["mapping"].as_float(); + map(sigma, device, threshold); } - else { - int device = args["device"].as_int(); //get the device value from the user - num_nets = 2; //set the number of networks to two - sigma = args["sigma"].as_float(); //get the sigma value from the user - radius = sigma; - T.load_obj(args.arg(1)); //load the second (test) network - if (args["features"].is_set()) //if the user wants to save features - features(args["features"].as_string()); - GT = GT.resample(resample_rate * sigma); //resample both networks based on the sigma value - T = T.resample(resample_rate * sigma); - if (args["mapping"].is_set()) { - float threshold = args["mapping"].as_float(); - map(sigma, device, threshold); - } - else - compare(sigma, device); //run the comparison algorithm + else + compare(sigma, device); //run the comparison algorithm } - } //if a GUI is requested, display the network using OpenGL if(args["gui"].is_set()){ -- libgit2 0.21.4