Blame view

main.cpp 2.04 KB
44700501   pranathivemuri   program to genera...
1
2
3
4
  #include <stdlib.h>
  #include <string>
  #include <fstream>
  #include <algorithm>
a0048e31   David Mayerich   added several tes...
5
  #include <stim/biomodels/network.h>
44700501   pranathivemuri   program to genera...
6
7
8
9
10
  
  #include <ANN/ANN.h>
  #include <boost/tuple/tuple.hpp>
  using namespace stim;
  //template <typename T>
03c5492b   pranathivemuri   networks and kd t...
11
12
  network<float>* network1;
  
44700501   pranathivemuri   program to genera...
13
14
15
  
  int main(int argc, char* argv[])
  {
a0048e31   David Mayerich   added several tes...
16
17
18
19
20
  	if(argc < 4){
  		std::cout<<"Please specify a ground truth and test case"<<std::endl;
  		exit(1);
  	}
  
c4dba76e   David Mayerich   added code to tes...
21
22
  	float sigma = atof(argv[3]);
  
a0048e31   David Mayerich   added several tes...
23
24
25
  	stim::network<float> GT;
  	GT.load_obj(argv[1]);
  
c4dba76e   David Mayerich   added code to tes...
26
27
28
29
30
31
32
33
34
35
  
  
  
  
  
  
  
  
  
  	std::cout<<"Network:"<<std::endl<<std::endl;
a0048e31   David Mayerich   added several tes...
36
37
  	std::cout<<GT.str();
  
c4dba76e   David Mayerich   added code to tes...
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
  	std::cout<<"Fiber:"<<std::endl<<std::endl;
  	stim::fiber<float> f;
  	f = GT.get_fiber(0);
  	std::cout<<f.str()<<std::endl;
  	std::cout<<"Fiber length = "<<f.length()<<std::endl;
  
  	std::cout<<"Resampled Fiber:"<<std::endl<<std::endl;
  	stim::fiber<float> f2;
  	f2 = f.resample(sigma);
  	std::cout<<f2.str();
  	std::cout<<"Fiber length = "<<f2.length()<<std::endl;
  
  	std::cout<<"Resampled Network:"<<std::endl<<std::endl;
  	stim::network<float> resampled_GT;
  	resampled_GT = GT.resample(sigma);
  	std::cout<<resampled_GT.str();
  
  	std::cout<<"First Fiber from Resampled Network:"<<std::endl<<std::endl;
  	stim::fiber<float> f3;
  	f3 = resampled_GT.get_fiber(0);
  	std::cout<<f3.str();
  
  	//stim::fiber<T> f = e.Resample(25.0);
  	//std::cout<<"resampled fiber length"<<std::endl;
  	//std::cout<<f.length()<<std::endl;
  	//std::cout<<"resampled fiber--"<<std::endl;
  	//std::cout<<f.str()<<std::endl;
  
a0048e31   David Mayerich   added several tes...
66
67
  
  	/*std::string groundTruth = argv[1];
44700501   pranathivemuri   program to genera...
68
  	std::string truthCase = argv[2];
a0048e31   David Mayerich   added several tes...
69
70
  	float sigma = atof(argv[3]);
  
03c5492b   pranathivemuri   networks and kd t...
71
72
73
  	//stim::network<int> network;
  	boost::tuple<  ANNkd_tree*, ANNkd_tree*, stim::network<float>, stim::network<float> > networkKdtree;
  	networkKdtree = network1->LoadNetworks(groundTruth, truthCase);
a0048e31   David Mayerich   added several tes...
74
  	std::cout<<networkKdtree.get< 2>().edges_to_str()<<std::endl;
03c5492b   pranathivemuri   networks and kd t...
75
76
  	networkKdtree.get< 2>().to_obj();
  	//networkKdtree.get< 2>()
a0048e31   David Mayerich   added several tes...
77
  	boost::tuple< float, float > metrics = network1->compareSkeletons(networkKdtree, sigma);
44700501   pranathivemuri   program to genera...
78
79
  	std::cout << "False postive rate is " << metrics.get< 0>() << std::endl;
  	std::cout << "False negative rate is " << metrics.get< 1>() << std::endl;
a0048e31   David Mayerich   added several tes...
80
  	*/
44700501   pranathivemuri   program to genera...
81
  }