Commit e06b2e0b9baef16482ac532da90c5c70b9f29259

Authored by pranathivemuri
1 parent 797f8ab0

removed functions not in use

Showing 2 changed files with 1 additions and 118 deletions   Show diff stats
stim/biomodels/fiber.h
... ... @@ -281,39 +281,6 @@ public:
281 281 T radius(int idx){
282 282 return r[idx];
283 283 }
284   - /// get index of a node on a fiber
285   - // by matching the node on fiber to already set vertices (both strings)
286   - // used in obj file conversion
287   - int
288   - getIndexes(std::string* input, std::string searched, int sizeV)
289   - {
290   - int result = 0;
291   - for (int i = 0; i < sizeV; i++)
292   - {
293   - if (input[i] == searched)
294   - {
295   - result = i + 1;
296   - }
297   - }
298   - return result;
299   - }
300   - // strObj returns a string of fiber indices corresponding to vectors of positions in the fiber including intermediate nodes
301   - std::string
302   - strObj(std::string* strArray, int sizeV)
303   - {
304   - std::stringstream ss;
305   - std::stringstream oss;
306   - for(unsigned int i = 0; i < N; i++)
307   - {
308   - ss.str(std::string());
309   - for(unsigned int d = 0; d < 3; d++)
310   - {
311   - ss<<c[i][d];
312   - }
313   - oss<<getIndexes(strArray, ss.str(), sizeV)<<" ";
314   - }
315   - return oss.str();
316   - }
317 284  
318 285 /// Return the point on the fiber closest to q
319 286 /// @param q is the query point used to locate the nearest point on the fiber centerline
... ...
stim/biomodels/network.h
... ... @@ -207,66 +207,19 @@ class network{
207 207 }
208 208  
209 209  
210   - // this function gives sum of lengths of all the fibers in the network
211   - float lengthOfNetwork(){
212   - stim::fiber<T> FIBER; // initialize a fiber used in looping through all edges casting into fibers in the network
213   - float networkLength=0;float N=0; // initialize variables for finding total length of all the fibers
214   - // for each edge in the network
215   - for (unsigned int i=0; i < E.size(); i ++)
216   - {
217   - FIBER = get_fiber(i); // cast each edge to fiber
218   - N= FIBER.length(); // find length of the fiber
219   - networkLength = networkLength + N; // running sum of fiber lengths
220   - }
221   - return networkLength;
222   - }
223   -
224   -
225   - // list of all the points after resampling -- function used only on a resampled network
226   - std::vector<stim::vec<T> > points_afterResampling(){
227   - std::vector<stim::vec<T> > pointsVector; // points in the resampled network
228   - stim::fiber<T> FIBER; // initialize a fiber used in looping through all edges casting into fibers in the network
229   - std::vector<stim::vec<T> > pointsFiber; // resampled points on each fiber of the network
230   - for(unsigned e = 0; e < E.size(); e++){ // for each edge in the edge list
231   - FIBER = get_fiber(e); // Cast edge to a fiber
232   - pointsFiber = FIBER.centerline(); // find points on the edge returns a stim vec
233   - for (unsigned v = 0; v < FIBER.n_pts(); v++){ // iterate one point at a time from the stim::vec
234   - pointsVector.push_back(pointsFiber[v]);} //add the points on centerline to the stim::vec points list
235   - }
236   - return pointsVector;
237   - }
238   -
239 210  
240 211 // total number of points on all fibers after resampling -- function used only on a resampled network
241 212 unsigned total_points(){
242 213 unsigned n = 0;
243 214 for(unsigned e = 0; e < E.size(); e++)
244 215 n += E[e].size();
245   - //unsigned int n = points_afterResampling().size();
246 216 return n;
247 217 }
248 218  
249 219 // gaussian function
250 220 float gaussianFunction(float x, float std=25){ return exp(-x/(2*std*std));} // by default std = 25
251 221  
252   - // sum of values in a stim vector
253   - float sum(stim::vec<T> metricList){
254   - float sumMetricList = 0; // Initialize variable to calculate sum
255   - for (unsigned int count=0; count<metricList.size(); count++) // for each element in the stim vector
256   - { sumMetricList += metricList[count];} // running sum of values
257   - return sumMetricList;
258   - }
259   -
260   -
261   - // distance between two points
262   - double dist(stim::vec<T> p0, stim::vec<T> p1){
263   - double sum = 0; // initialize variables
264   - stim::vec<T> v = p1 - p0;; // direction vector
265   - for(unsigned int d = 0; d < 3; d++){ // for each dimension
266   - sum += v[d] * v[d];} // running sum of modulus of direction vector
267   - return sqrt(sum);
268   - }
269   -
  222 + // stim 3d vector to annpoint of 3 dimensions
270 223 void stim2ann(ANNpoint &a, stim::vec<T> b){
271 224 a[0] = b[0];
272 225 a[1] = b[1];
... ... @@ -333,43 +286,6 @@ class network{
333 286 }
334 287  
335 288 return M/L;
336   -
337   -
338   - /*int N; // number of points on the fiber in the second network
339   - float totalNetworkLength = A.lengthOfNetwork();
340   - stim::vec<float> fiberMetric(A.edges()); // allocate space for accumulating fiber metric as each fiber is evaluated
341   - stim::fiber<T> FIBER; // Initialize a fiber will be used in calculating the metric
342   - //for each fiber in the second network, find nearest distance in the kd tree
343   - for (unsigned int i=0; i < A.edges(); i ++) // loop through all the edges/fibers in the network
344   - {
345   - FIBER = A.get_fiber(i); // Get the fiber corresponding to the index i
346   - std::vector< stim::vec<T> > fiberPoints = FIBER.centerline(); // Get the points on the fiber
347   - N = FIBER.size(); // number of points on the fiber
348   - stim::vec<float> segmentMetric(N-1); // allocate space for a vec array that stores metric for each segmen in the fiber
349   - // for each segment in the fiber
350   - for (unsigned j = 0; j < N - 1; j++)
351   - {
352   - stim::vec<T> p1 = fiberPoints[j];stim::vec<T> p2 = fiberPoints[j+1]; // starting and ending points on the segments
353   - ANNpoint queryPt1; queryPt1 = annAllocPt(3); // allocate memory for query points
354   - ANNpoint queryPt2; queryPt2 = annAllocPt(3);
355   -
356   - //for each dimension of the points connecting segment
357   - for (unsigned d = 0; d < 3; d++){
358   - queryPt1[d] = double(fiberPoints[j][d]); // starting point on segment in network whose closest distance on KD tree should be found
359   - queryPt2[d] = double(fiberPoints[j + 1][d]); // ending point on segment in network whose closest distance on KD tree should be found
360   - }
361   - kdt->annkSearch( queryPt1, 1, nnIdx1, dists1, eps); // search the nearest point in KD tree to query point(point on network), find the distance
362   - kdt->annkSearch( queryPt2, 1, nnIdx2, dists2, eps); // search the nearest point in KD tree to query point(point on network), find the distance
363   - // find the gaussian of the distance and subtract it from 1 to calculate the error
364   - float error1 = 1.0f - gaussianFunction(float(dists1[0]), sigma);float error2 = 1.0f - gaussianFunction(float(dists2[0]), sigma);
365   - // average the error and scale it with distance between the points
366   - segmentMetric[j] = ((error1 + error2) / 2) * dist(p1, p2) ;
367   - }
368   - fiberMetric[i] = sum(segmentMetric);
369   - }
370   - metric = sum(fiberMetric)/totalNetworkLength; //normalize the scaled error of all the points with total length of the network
371   - assert (0<=metric <=1); //assert metroc os always less than or equal to one and greater than or equal to zero
372   - return metric;*/
373 289 }
374 290 }; //end stim::network class
375 291 }; //end stim namespace
... ...