From e06b2e0b9baef16482ac532da90c5c70b9f29259 Mon Sep 17 00:00:00 2001 From: pranathivemuri Date: Mon, 1 Feb 2016 11:38:04 -0600 Subject: [PATCH] removed functions not in use --- stim/biomodels/fiber.h | 33 --------------------------------- stim/biomodels/network.h | 86 +------------------------------------------------------------------------------------- 2 files changed, 1 insertion(+), 118 deletions(-) diff --git a/stim/biomodels/fiber.h b/stim/biomodels/fiber.h index 8e92183..944e625 100644 --- a/stim/biomodels/fiber.h +++ b/stim/biomodels/fiber.h @@ -281,39 +281,6 @@ public: T radius(int idx){ return r[idx]; } - /// get index of a node on a fiber - // by matching the node on fiber to already set vertices (both strings) - // used in obj file conversion - int - getIndexes(std::string* input, std::string searched, int sizeV) - { - int result = 0; - for (int i = 0; i < sizeV; i++) - { - if (input[i] == searched) - { - result = i + 1; - } - } - return result; - } - // strObj returns a string of fiber indices corresponding to vectors of positions in the fiber including intermediate nodes - std::string - strObj(std::string* strArray, int sizeV) - { - std::stringstream ss; - std::stringstream oss; - for(unsigned int i = 0; i < N; i++) - { - ss.str(std::string()); - for(unsigned int d = 0; d < 3; d++) - { - ss< FIBER; // initialize a fiber used in looping through all edges casting into fibers in the network - float networkLength=0;float N=0; // initialize variables for finding total length of all the fibers - // for each edge in the network - for (unsigned int i=0; i < E.size(); i ++) - { - FIBER = get_fiber(i); // cast each edge to fiber - N= FIBER.length(); // find length of the fiber - networkLength = networkLength + N; // running sum of fiber lengths - } - return networkLength; - } - - - // list of all the points after resampling -- function used only on a resampled network - std::vector > points_afterResampling(){ - std::vector > pointsVector; // points in the resampled network - stim::fiber FIBER; // initialize a fiber used in looping through all edges casting into fibers in the network - std::vector > pointsFiber; // resampled points on each fiber of the network - for(unsigned e = 0; e < E.size(); e++){ // for each edge in the edge list - FIBER = get_fiber(e); // Cast edge to a fiber - pointsFiber = FIBER.centerline(); // find points on the edge returns a stim vec - for (unsigned v = 0; v < FIBER.n_pts(); v++){ // iterate one point at a time from the stim::vec - pointsVector.push_back(pointsFiber[v]);} //add the points on centerline to the stim::vec points list - } - return pointsVector; - } - // total number of points on all fibers after resampling -- function used only on a resampled network unsigned total_points(){ unsigned n = 0; for(unsigned e = 0; e < E.size(); e++) n += E[e].size(); - //unsigned int n = points_afterResampling().size(); return n; } // gaussian function float gaussianFunction(float x, float std=25){ return exp(-x/(2*std*std));} // by default std = 25 - // sum of values in a stim vector - float sum(stim::vec metricList){ - float sumMetricList = 0; // Initialize variable to calculate sum - for (unsigned int count=0; count p0, stim::vec p1){ - double sum = 0; // initialize variables - stim::vec v = p1 - p0;; // direction vector - for(unsigned int d = 0; d < 3; d++){ // for each dimension - sum += v[d] * v[d];} // running sum of modulus of direction vector - return sqrt(sum); - } - + // stim 3d vector to annpoint of 3 dimensions void stim2ann(ANNpoint &a, stim::vec b){ a[0] = b[0]; a[1] = b[1]; @@ -333,43 +286,6 @@ class network{ } return M/L; - - - /*int N; // number of points on the fiber in the second network - float totalNetworkLength = A.lengthOfNetwork(); - stim::vec fiberMetric(A.edges()); // allocate space for accumulating fiber metric as each fiber is evaluated - stim::fiber FIBER; // Initialize a fiber will be used in calculating the metric - //for each fiber in the second network, find nearest distance in the kd tree - for (unsigned int i=0; i < A.edges(); i ++) // loop through all the edges/fibers in the network - { - FIBER = A.get_fiber(i); // Get the fiber corresponding to the index i - std::vector< stim::vec > fiberPoints = FIBER.centerline(); // Get the points on the fiber - N = FIBER.size(); // number of points on the fiber - stim::vec segmentMetric(N-1); // allocate space for a vec array that stores metric for each segmen in the fiber - // for each segment in the fiber - for (unsigned j = 0; j < N - 1; j++) - { - stim::vec p1 = fiberPoints[j];stim::vec p2 = fiberPoints[j+1]; // starting and ending points on the segments - ANNpoint queryPt1; queryPt1 = annAllocPt(3); // allocate memory for query points - ANNpoint queryPt2; queryPt2 = annAllocPt(3); - - //for each dimension of the points connecting segment - for (unsigned d = 0; d < 3; d++){ - queryPt1[d] = double(fiberPoints[j][d]); // starting point on segment in network whose closest distance on KD tree should be found - queryPt2[d] = double(fiberPoints[j + 1][d]); // ending point on segment in network whose closest distance on KD tree should be found - } - kdt->annkSearch( queryPt1, 1, nnIdx1, dists1, eps); // search the nearest point in KD tree to query point(point on network), find the distance - kdt->annkSearch( queryPt2, 1, nnIdx2, dists2, eps); // search the nearest point in KD tree to query point(point on network), find the distance - // find the gaussian of the distance and subtract it from 1 to calculate the error - float error1 = 1.0f - gaussianFunction(float(dists1[0]), sigma);float error2 = 1.0f - gaussianFunction(float(dists2[0]), sigma); - // average the error and scale it with distance between the points - segmentMetric[j] = ((error1 + error2) / 2) * dist(p1, p2) ; - } - fiberMetric[i] = sum(segmentMetric); - } - metric = sum(fiberMetric)/totalNetworkLength; //normalize the scaled error of all the points with total length of the network - assert (0<=metric <=1); //assert metroc os always less than or equal to one and greater than or equal to zero - return metric;*/ } }; //end stim::network class }; //end stim namespace -- libgit2 0.21.4