#include"Prune.h" /*****************************************************************/ void Prune :: pruneTP(int cn, int sn) { double tx1,ty1,tz1; double tx2,ty2,tz2; double ipdist; createLine(PruCom[PruCom[cn].ppi-1],PruCom[cn]); if(ls -> num==2){ // Current pt is last pt in comptmt. tx1=PruCom[PruCom[cn].ppi-1].x; ty1=PruCom[PruCom[cn].ppi-1].y; tz1=PruCom[PruCom[cn].ppi-1].z; removeCompartment(cn,sn); cmr++; } else{ // Remove Last Pt. tx1=ls->x[ls->num-2]; ty1=ls->y[ls->num-2]; tz1=ls->z[ls->num-2]; PruCom[cn].x = ls -> x[ls->num-2]; PruCom[cn].y = ls -> y[ls->num-2]; PruCom[cn].z = ls -> z[ls->num-2]; } tx2=ls -> x[ls->num-1]; ty2=ls -> y[ls->num-1]; tz2=ls -> z[ls->num-1]; ipdist=sqrt((tx1-tx2)*(tx1-tx2)+ (ty1-ty2)*(ty1-ty2)+ (tz1-tz2)*(tz1-tz2)); if(PruCom[cn].tc==4) // Apical adlprune[sn] += ipdist/RESLN; else if (PruCom[cn].tc==3) // Basal bdlprune[sn] += ipdist/RESLN; dlr += ipdist/RESLN; } /*****************************************************************/ // If the removed compartment's parent is BP, remove the point // from the TP list, from the BP list (if it is not a // trifurcation), and update the BP prune numbers and // probabilities. /*****************************************************************/ void Prune :: rcParentBP(int cn, int sn) { int i,j; if (PruCom[cn].tc==3) // Basal bbpprune[sn]++; else if (PruCom[cn].tc==4) // Apical abpprune[sn]++; // Remove pt from TP list int SET=0; for(i=0; icn) PruCom[i].ppi--; // One Comptmt is removed. } // Update lists of TP, BP, Stems, Soma to accomodate above. for(i=0; icn) TP.Pts[i]--; for(i=0; icn) BP.Pts[i]--; for(i=0; icn) Stems.Pts[i]--; for(i=0; icn) Soma.Pts[i]--; } /*****************************************************************/ // Remove the current compartment totally. // If the parent to this compartment were a BP, then, // remove that BP from the list of BP's and update BP // probability; sn stands for the sholl's segment number /*****************************************************************/ void Prune :: removeCompartment(int cn, int sn) { if(isParentBP(cn)) // If parent is BP rcParentBP(cn,sn); else if(isParentSoma(cn)) // If parent is Soma rcParentSoma(cn); else // If parent is dendrite rcParentDendrite(cn); rmcmpt(cn); } /*****************************************************************/ //**************** BPPrune starts here **************************/ /*****************************************************************/ void Prune :: findTPBP() { int i; double dist; int sn; int trgt; for(i=0; i