diff --git a/stim/biomodels/network.h b/stim/biomodels/network.h index 4bcb161..02a42e2 100644 --- a/stim/biomodels/network.h +++ b/stim/biomodels/network.h @@ -126,6 +126,18 @@ public: return V; } + // Returns an average of branching index in the network + + double BranchingIndex(){ + double B=0; + for(unsigned v=0; v < V.size(); v ++){ + B += ((V[v].e[0].size()) + (V[v].e[1].size())); + } + B = B / V.size(); + return B; + + } + // Returns an average of fiber/edge lengths in the network double Lengths(){ stim::vec L;double sumLength = 0; @@ -142,26 +154,11 @@ public: double Tortuosities(){ stim::vec t; stim::vec id1, id2; // starting and ending vertices of the edge - //std::vector< stim::vec > vert; // list of visited vertices - //std::vector>::iterator it; //create an iterator for searching the id2vert array - //std::vector daughters; // to count number of daughter vessels at branch points - //stim::vec visitedVert; - //unsigned visited; double distance;double tortuosity;double sumTortuosity = 0; for(unsigned e = 0; e < E.size(); e++){ //for each edge in the network id1 = E[e][0]; //get the edge starting point id2 = E[e][E[e].size() - 1]; //get the edge ending point distance = (id1 - id2).len(); //displacement between the starting and ending points - //it = find(vert.begin(), vert.end(), id1); //look for the first node has a daughter vessel already - //visitedVert = std::distance(vert.begin(), it); //index where it already exists - //if(visitedVert == id1){ - // visited += 1; - // daughters[e] = visited; - //} - //else{ - // vert.push_back(id1); - // daughters[e] = 1; - //} if(distance > 0){ tortuosity = E[e].length()/ distance ; // tortuoisty = edge length / edge displacement } @@ -171,7 +168,6 @@ public: sumTortuosity += tortuosity; } double avg = sumTortuosity / E.size(); - //std::cout<<"number of unique branch points"<vertex conversion list } @@ -427,6 +423,52 @@ public: count += atoi(file_contents[count + 1].c_str()) + 2; // Skip number of edge ids + 2 to point to the next vertex } } // end load_txt function + + // strTxt returns a string of edges + std::string + strTxt(std::vector< stim::vec > p) + { + std::stringstream ss; + std::stringstream oss; + for(unsigned int i = 0; i < p.size(); i++){ + ss.str(std::string()); + for(unsigned int d = 0; d < 3; d++){ + ss<