Commit ed5edb3e0ba5c17b1264b18726bb749b46b70c65
1 parent
c4dba76e
added function to compare two networks and give a netmets metric
Showing
1 changed file
with
16 additions
and
58 deletions
Show diff stats
main.cpp
... | ... | @@ -19,63 +19,21 @@ int main(int argc, char* argv[]) |
19 | 19 | } |
20 | 20 | |
21 | 21 | float sigma = atof(argv[3]); |
22 | - | |
23 | - stim::network<float> GT; | |
22 | + stim::network<float> GT;stim::network<float> T; | |
23 | + // load obj files to 3D network class | |
24 | 24 | GT.load_obj(argv[1]); |
25 | - | |
26 | - | |
27 | - | |
28 | - | |
29 | - | |
30 | - | |
31 | - | |
32 | - | |
33 | - | |
34 | - | |
35 | - std::cout<<"Network:"<<std::endl<<std::endl; | |
36 | - std::cout<<GT.str(); | |
37 | - | |
38 | - std::cout<<"Fiber:"<<std::endl<<std::endl; | |
39 | - stim::fiber<float> f; | |
40 | - f = GT.get_fiber(0); | |
41 | - std::cout<<f.str()<<std::endl; | |
42 | - std::cout<<"Fiber length = "<<f.length()<<std::endl; | |
43 | - | |
44 | - std::cout<<"Resampled Fiber:"<<std::endl<<std::endl; | |
45 | - stim::fiber<float> f2; | |
46 | - f2 = f.resample(sigma); | |
47 | - std::cout<<f2.str(); | |
48 | - std::cout<<"Fiber length = "<<f2.length()<<std::endl; | |
49 | - | |
50 | - std::cout<<"Resampled Network:"<<std::endl<<std::endl; | |
51 | - stim::network<float> resampled_GT; | |
25 | + T.load_obj(argv[2]); | |
26 | + //std::cout<<"ground truth------"<<GT.str()<<std::endl; | |
27 | + //std::cout<<"truth-----------"<<T.str()<<std::endl; | |
28 | + // resample the loaded networks | |
29 | + stim::network<float> resampled_GT;stim::network<float> resampled_T; | |
52 | 30 | resampled_GT = GT.resample(sigma); |
53 | - std::cout<<resampled_GT.str(); | |
54 | - | |
55 | - std::cout<<"First Fiber from Resampled Network:"<<std::endl<<std::endl; | |
56 | - stim::fiber<float> f3; | |
57 | - f3 = resampled_GT.get_fiber(0); | |
58 | - std::cout<<f3.str(); | |
59 | - | |
60 | - //stim::fiber<T> f = e.Resample(25.0); | |
61 | - //std::cout<<"resampled fiber length"<<std::endl; | |
62 | - //std::cout<<f.length()<<std::endl; | |
63 | - //std::cout<<"resampled fiber--"<<std::endl; | |
64 | - //std::cout<<f.str()<<std::endl; | |
65 | - | |
66 | - | |
67 | - /*std::string groundTruth = argv[1]; | |
68 | - std::string truthCase = argv[2]; | |
69 | - float sigma = atof(argv[3]); | |
70 | - | |
71 | - //stim::network<int> network; | |
72 | - boost::tuple< ANNkd_tree*, ANNkd_tree*, stim::network<float>, stim::network<float> > networkKdtree; | |
73 | - networkKdtree = network1->LoadNetworks(groundTruth, truthCase); | |
74 | - std::cout<<networkKdtree.get< 2>().edges_to_str()<<std::endl; | |
75 | - networkKdtree.get< 2>().to_obj(); | |
76 | - //networkKdtree.get< 2>() | |
77 | - boost::tuple< float, float > metrics = network1->compareSkeletons(networkKdtree, sigma); | |
78 | - std::cout << "False postive rate is " << metrics.get< 0>() << std::endl; | |
79 | - std::cout << "False negative rate is " << metrics.get< 1>() << std::endl; | |
80 | - */ | |
81 | -} | |
31 | + resampled_T = T.resample(sigma); | |
32 | + // compare ground truth with truth and viceversa | |
33 | + float gFPR, gFNR; | |
34 | + gFPR = GT.compare(T, sigma); | |
35 | + gFNR = T.compare(GT, sigma); | |
36 | + // print false alarms and misses | |
37 | + std::cout << "False postive rate is " << gFPR << std::endl; | |
38 | + std::cout << "False negative rate is " << gFNR << std::endl; | |
39 | +} | |
82 | 40 | \ No newline at end of file | ... | ... |