MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NeuroNode Class Reference

#include <NeuroNode.h>

+ Inheritance diagram for NeuroNode:
+ Collaboration diagram for NeuroNode:

Public Member Functions

void addChild (unsigned int child)
 
double calculateLength (const CylBase &parent)
 
const vector< unsigned int > & children () const
 
void clearChildren ()
 
Id elecCompt () const
 
void findConnectedCompartments (const map< Id, unsigned int > &nodeMap, const vector< NeuroNode > &nodes)
 
void innerTraverse (vector< NeuroNode > &tree, const vector< NeuroNode > &nodes, vector< unsigned int > &seen) const
 
bool isDummyNode () const
 
bool isSphere () const
 
bool isStartNode () const
 
 NeuroNode (const CylBase &cb, unsigned int parent, const vector< unsigned int > &children, unsigned int startFid_, Id elecCompt, bool isSphere)
 
 NeuroNode (Id elecCompt)
 
 NeuroNode ()
 
unsigned int parent () const
 
void setParent (unsigned int parent)
 
void setParentAndChildren (unsigned int index, int dendParent, vector< NeuroNode > &nodes, const unordered_map< Id, unsigned int > &dendMap)
 
void setStartFid (unsigned int f)
 
unsigned int startFid () const
 
- Public Member Functions inherited from CylBase
 CylBase (double x, double y, double z, double dia, double length, unsigned int numDivs)
 
 CylBase ()
 
vector< double > getCoordinates (const CylBase &parent, unsigned int entry) const
 
double getDia () const
 
double getDiffusionArea (const CylBase &parent, unsigned int index) const
 
bool getIsCylinder () const
 
double getLength () const
 
double getMiddleArea (const CylBase &parent, unsigned int index) const
 Return cross-section area of middle of specified voxel. More...
 
unsigned int getNumDivs () const
 
double getVoxelLength () const
 Return length of voxel. All are equal. More...
 
double getX () const
 
double getY () const
 
double getZ () const
 
void matchCubeMeshEntries (const ChemCompt *other, const CylBase &parent, unsigned int startIndex, double granularity, vector< VoxelJunction > &ret, bool useCylinderCurve, bool useCylinderCap) const
 
double nearest (double x, double y, double z, const CylBase &parent, double &linePos, double &r) const
 
double nearest (double x, double y, double z, const CylBase &parent, unsigned int &index) const
 
double selectGridSize (double h, double dia1, double granularity) const
 
void setDia (double v)
 
void setIsCylinder (bool v)
 
void setLength (double v)
 
void setNumDivs (unsigned int v)
 
void setX (double v)
 
void setY (double v)
 
void setZ (double v)
 
double volume (const CylBase &parent) const
 Returns vol of current node. Usually needs to refer to parent. More...
 
double voxelVolume (const CylBase &parent, unsigned int fid) const
 

Static Public Member Functions

static void buildSpinyTree (vector< ObjId > &elist, vector< NeuroNode > &nodes, vector< Id > &shaftId, vector< Id > &headId, vector< unsigned int > &spineParent)
 
static void buildTree (vector< NeuroNode > &nodes, vector< ObjId > elist)
 
static void filterSpines (vector< NeuroNode > &nodes, vector< Id > &shaftId, vector< Id > &headId, vector< unsigned int > &parent)
 
static unsigned int findStartNode (const vector< NeuroNode > &nodes)
 
static unsigned int removeDisconnectedNodes (vector< NeuroNode > &nodes)
 
static void traverse (vector< NeuroNode > &nodes, unsigned int start)
 

Private Attributes

vector< unsigned int > children_
 
Id elecCompt_
 Id of electrical compartment in which this diffusive compt lives. More...
 
bool isSphere_
 
unsigned int parent_
 
unsigned int startFid_
 

Detailed Description

Helper class for the NeuroMesh. Defines the geometry of the branching neuron.

Definition at line 18 of file NeuroNode.h.

Constructor & Destructor Documentation

NeuroNode::NeuroNode ( const CylBase cb,
unsigned int  parent,
const vector< unsigned int > &  children,
unsigned int  startFid,
Id  elecCompt,
bool  isSphere 
)

This function explicitly fills in all fields of the NeuroNode

Helper class for the NeuroMesh. Defines the geometry of the branching neuron.

Definition at line 28 of file NeuroNode.cpp.

32  :
33  CylBase( cb ),
34  parent_( parent ),
35  children_( children ),
37  elecCompt_( elecCompt ),
39 {;}
CylBase()
Definition: CylBase.cpp:40
unsigned int startFid() const
Definition: NeuroNode.cpp:74
unsigned int parent_
Definition: NeuroNode.h:197
bool isSphere() const
Definition: NeuroNode.cpp:87
unsigned int startFid_
Definition: NeuroNode.h:208
bool isSphere_
Definition: NeuroNode.h:218
Id elecCompt_
Id of electrical compartment in which this diffusive compt lives.
Definition: NeuroNode.h:212
unsigned int parent() const
Definition: NeuroNode.cpp:69
vector< unsigned int > children_
Definition: NeuroNode.h:202
NeuroNode::NeuroNode ( Id  elecCompt)

This builds the node using info from the compartment. But the parent and children have to be filled in later

Definition at line 41 of file NeuroNode.cpp.

References Field< A >::get(), CylBase::setDia(), CylBase::setLength(), CylBase::setX(), CylBase::setY(), and CylBase::setZ().

42  :
43  parent_( ~0 ),
44  startFid_( 0 ),
45  elecCompt_( elecCompt ),
46  isSphere_( false )
47 {
48  double dia = Field< double >::get( elecCompt, "diameter" );
49  setDia( dia );
50  double length = Field< double >::get( elecCompt, "length" );
51  setLength( length );
52  double x = Field< double >::get( elecCompt, "x" );
53  double y = Field< double >::get( elecCompt, "y" );
54  double z = Field< double >::get( elecCompt, "z" );
55  setX( x );
56  setY( y );
57  setZ( z );
58 }
void setX(double v)
Definition: CylBase.cpp:53
void setLength(double v)
Definition: CylBase.cpp:93
unsigned int parent_
Definition: NeuroNode.h:197
void setZ(double v)
Definition: CylBase.cpp:73
unsigned int startFid_
Definition: NeuroNode.h:208
void setY(double v)
Definition: CylBase.cpp:63
bool isSphere_
Definition: NeuroNode.h:218
Id elecCompt_
Id of electrical compartment in which this diffusive compt lives.
Definition: NeuroNode.h:212
void setDia(double v)
Definition: CylBase.cpp:83
static A get(const ObjId &dest, const string &field)
Definition: SetGet.h:284

+ Here is the call graph for this function:

NeuroNode::NeuroNode ( )

Empty constructor for vectors

Definition at line 61 of file NeuroNode.cpp.

62  :
63  parent_( ~0 ),
64  startFid_( 0 ),
65  elecCompt_( Id() ),
66  isSphere_( false )
67 {;}
unsigned int parent_
Definition: NeuroNode.h:197
unsigned int startFid_
Definition: NeuroNode.h:208
bool isSphere_
Definition: NeuroNode.h:218
Id elecCompt_
Id of electrical compartment in which this diffusive compt lives.
Definition: NeuroNode.h:212
Definition: Id.h:17

Member Function Documentation

void NeuroNode::addChild ( unsigned int  child)

Fills in child vector

Definition at line 101 of file NeuroNode.cpp.

References children_.

Referenced by NeuroMesh::insertSingleDummy().

102 {
103  children_.push_back( child );
104 }
vector< unsigned int > children_
Definition: NeuroNode.h:202

+ Here is the caller graph for this function:

void NeuroNode::buildSpinyTree ( vector< ObjId > &  elist,
vector< NeuroNode > &  nodes,
vector< Id > &  shaftId,
vector< Id > &  headId,
vector< unsigned int > &  spineParent 
)
static

This function takes a list of elements and builds a tree. Info on any attached spines are placed in the shaft_, head_, and parent_ vectors. The list of elements can be discontiguous. This is meant to be insensitive to vagaries in how the user has set up the compartment messaging, provided that there is at least one recognized message between connected compartments.

static function.

Definition at line 491 of file NeuroNode.cpp.

References isPartOfDend(), setParentAndChildren(), sortByShaftIds(), and spinyTraverse().

Referenced by NeuroMesh::setSubTree().

495 {
496  nodes.clear();
497  sort( elist.begin(), elist.end() );
498  unordered_map< Id, unsigned int > dendMap;
499  vector< Id > dend;
500  for ( vector< ObjId >::iterator
501  i = elist.begin(); i != elist.end(); ++i ) {
502  if ( isPartOfDend( *i ) ) {
503  dendMap[ *i ] = dend.size();
504  //cout << "st: dendMap[" << *i << "] = " << dend.size() << endl;
505  dend.push_back( *i );
506  }
507  }
508  vector< int > seen( dend.size(), 0 );
509  vector< int > dendParent( dend.size(), -1 );
510  int numSeen = 0;
511  for ( unsigned int i = 0; i < dend.size(); ++i ) {
512  if ( !seen[i] )
513  spinyTraverse( i, dend, dendMap, seen, ++numSeen,
514  shaftId, headId,
515  dendParent, spineParent );
516  }
517  // Here I sort by shaftIds. I have 4 parallel arrays, so I get the
518  // Index order of the whole lot that will sort the shaftIds.
519  sortByShaftIds( shaftId, headId, spineParent );
520  if ( numSeen == 0 )
521  return;
522  for ( unsigned int i = 0; i < dend.size(); ++i )
523  nodes.push_back( NeuroNode( dend[i] ) );
524  for ( unsigned int i = 0; i < dend.size(); ++i )
525  nodes[i].setParentAndChildren( i, dendParent[i], nodes, dendMap );
526 
527  if ( numSeen > 1 ) {
528  cout << "Warning: NeuroNode::buildSpinyTree: There are " <<
529  numSeen << " distinct subgroups on the given path\n";
530  }
531 }
bool isPartOfDend(ObjId i)
Definition: NeuroNode.cpp:376
static void spinyTraverse(unsigned int dendIndex, vector< Id > &dend, const unordered_map< Id, unsigned int > &dendMap, vector< int > &seen, unsigned int numSeen, vector< Id > &shaftId, vector< Id > &headId, vector< int > &dendParent, vector< unsigned int > &spineParent)
Definition: NeuroNode.cpp:429
static void sortByShaftIds(vector< Id > &shaftId, vector< Id > &headId, vector< unsigned int > &spineParent)
Definition: NeuroNode.cpp:457
void setParentAndChildren(unsigned int index, int dendParent, vector< NeuroNode > &nodes, const unordered_map< Id, unsigned int > &dendMap)
Definition: NeuroNode.cpp:533

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void NeuroNode::buildTree ( vector< NeuroNode > &  nodes,
vector< ObjId elist 
)
static

This function takes a list of elements that include connected compartments, and constructs a tree of nodes out of them. The generated nodes vector starts with the soma, and is a depth-first sequence of nodes. This is meant to be insensitive to vagaries in how the user has set up the compartment messaging, provided that there is at least one recognized message between connected compartments.

This function takes a list of elements that include connected compartments, and constructs a tree of nodes out of them. The generated nodes vector starts with the soma, and is a depth-first sequence of nodes. This is meant to be insensitive to vagaries in how the user has set up the compartment messaging, provided that there is at least one recognized message between connected compartments.

static function.

Definition at line 558 of file NeuroNode.cpp.

References findConnectedCompartments(), findStartNode(), removeDisconnectedNodes(), and traverse().

Referenced by NeuroMesh::setSubTree().

560 {
561  nodes.clear();
562  map< Id, unsigned int > nodeMap;
563  for ( vector< ObjId >::iterator
564  i = elist.begin(); i != elist.end(); ++i ) {
565  if ( i->element()->cinfo()->isA( "CompartmentBase" ) )
566  nodes.push_back( NeuroNode( *i ) );
567  }
568  if ( nodes.size() <= 1 )
569  return;
570  for ( unsigned int i = 0; i < nodes.size(); ++i ) {
571  if ( nodeMap.find( nodes[i].elecCompt() ) != nodeMap.end() ) {
572  cout << "Warning: NeuroNode.buildTree(): Node[" << i <<
573  "] refers to existing compartment: " <<
574  nodes[i].elecCompt().path() << endl;
575  }
576  nodeMap[ nodes[i].elecCompt() ] = i;
577  }
578  assert( nodeMap.size() == nodes.size() );
579  for ( unsigned int i = 0; i < nodes.size(); ++i )
580  nodes[i].findConnectedCompartments( nodeMap, nodes );
581  unsigned int numRemoved = removeDisconnectedNodes( nodes );
582  if ( numRemoved > 0 ) {
583  cout << "Warning: NeuroNode::buildTree: Removed " <<
584  numRemoved << " nodes because they were not connected\n";
585  }
586  unsigned int start = findStartNode( nodes );
587  traverse( nodes, start );
588 }
static void traverse(vector< NeuroNode > &nodes, unsigned int start)
Definition: NeuroNode.cpp:332
static unsigned int findStartNode(const vector< NeuroNode > &nodes)
Definition: NeuroNode.cpp:270
void findConnectedCompartments(const map< Id, unsigned int > &nodeMap, const vector< NeuroNode > &nodes)
Definition: NeuroNode.cpp:198
static unsigned int removeDisconnectedNodes(vector< NeuroNode > &nodes)
Definition: NeuroNode.cpp:227

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double NeuroNode::calculateLength ( const CylBase parent)

Calculates and returns compartment length, from parent xyz to self xyz. Assigns own length as a side-effect.

Definition at line 121 of file NeuroNode.cpp.

References CylBase::getLength(), CylBase::getX(), CylBase::getY(), CylBase::getZ(), and CylBase::setLength().

122 {
123  if ( &parent == this ) // Do nothing
124  return getLength();
125  double dx = parent.getX() - getX();
126  double dy = parent.getY() - getY();
127  double dz = parent.getZ() - getZ();
128  double ret = sqrt( dx * dx + dy * dy + dz * dz );
129  setLength( ret );
130  return ret;
131 }
double getLength() const
Definition: CylBase.cpp:98
double getX() const
Definition: CylBase.cpp:58
void setLength(double v)
Definition: CylBase.cpp:93
double getY() const
Definition: CylBase.cpp:68
double getZ() const
Definition: CylBase.cpp:78

+ Here is the call graph for this function:

const vector< unsigned int > & NeuroNode::children ( ) const

Definition at line 96 of file NeuroNode.cpp.

References children_.

97 {
98  return children_;
99 }
vector< unsigned int > children_
Definition: NeuroNode.h:202
void NeuroNode::clearChildren ( )

Zeroes out the child vector

Definition at line 106 of file NeuroNode.cpp.

References children_.

Referenced by NeuroMesh::insertSingleDummy().

107 {
108  children_.resize( 0 );
109 }
vector< unsigned int > children_
Definition: NeuroNode.h:202

+ Here is the caller graph for this function:

Id NeuroNode::elecCompt ( ) const

Definition at line 79 of file NeuroNode.cpp.

References elecCompt_.

Referenced by filterSpines().

80 {
81  return elecCompt_;
82 }
Id elecCompt_
Id of electrical compartment in which this diffusive compt lives.
Definition: NeuroNode.h:212

+ Here is the caller graph for this function:

void NeuroNode::filterSpines ( vector< NeuroNode > &  nodes,
vector< Id > &  shaftId,
vector< Id > &  headId,
vector< unsigned int > &  parent 
)
static

Trims off all spines from tree. Does so by identifying a set of reasonable names: shaft, head, spine, and variants in capitals. Having done this it builds two matching vectors of vector of shafts and heads, which is a hack that assumes that there are no sub-branches in spines. The returned nodes vector has non spine/shaft compartments only. The returned shaftId vector has all the shaft compartments. The returned headId vector has all the shaft compartments. The returned parent vector has the indices of the parent node for each shaft. There should be exactly the same number of entries in the shaftId, headId and parent vectors.

Trims off all spines from tree. Does so by identifying a set of reasonable names: shaft, head, spine, and variants in capitals. Having done this it builds two matching vectors of vector of shafts and heads, which is a hack that assumes that there are no sub-branches in spines. Then there is an index for parent NeuroNode entry. Static function

Definition at line 620 of file NeuroNode.cpp.

References elecCompt(), elecCompt_, Id::element(), Element::getName(), name, parent(), and reassignNodeIndices().

623 {
624  headId.clear();
625  shaftId.clear();
626  parent.clear();
627  vector< NeuroNode > temp;
628  temp.reserve( nodes.size() );
629  vector< unsigned int > nodeToTempMap( nodes.size(), ~0U );
630  vector< unsigned int > shaft;
631  vector< unsigned int > reverseShaft( nodes.size(), ~0U );
632  vector< unsigned int > head;
633  for ( unsigned int i = 0; i < nodes.size(); ++i ) {
634  const NeuroNode& n = nodes[i];
635  string name = n.elecCompt_.element()->getName();
636  for ( string::iterator j = name.begin(); j != name.end(); ++j )
637  *j = tolower(*j);
638 
639  if ( name.find( "shaft" ) != string::npos ||
640  name.find( "neck" ) != string::npos ) {
641  reverseShaft[i] = shaft.size();
642  shaft.push_back( i );
643  // Remove from nodes vector by simply not copying.
644  } else if ( name.find( "spine" ) != string::npos ||
645  name.find( "head" ) != string::npos ) {
646  head.push_back( i );
647  // Remove from nodes vector by simply not copying.
648  } else {
649  nodeToTempMap[i] = temp.size();
650  temp.push_back( n );
651  }
652 
653  /*
654  const char* name = n.elecCompt_.element()->getName().c_str();
655  if ( strncasecmp( name, "shaft", 5 ) == 0 ||
656  strncasecmp( name, "neck", 4 ) == 0 ||
657  strncasecmp( name, "spine_neck", 10 ) == 0 ||
658  strncasecmp( name, "spine_shaft", 11 ) == 0 ||
659  strncasecmp( name, "stalk", 5 ) == 0 ) {
660  reverseShaft[i] = shaft.size();
661  shaft.push_back( i );
662  // Remove from nodes vector by simply not copying.
663  } else if ( strncasecmp( name, "spine", 5 ) == 0 ||
664  strncasecmp( name, "head", 4 ) == 0 ) {
665  head.push_back( i );
666  // Remove from nodes vector by simply not copying.
667  } else {
668  nodeToTempMap[i] = temp.size();
669  temp.push_back( n );
670  }
671  */
672  }
673  // Now go through finding spine shafts.
674  for ( unsigned int i = 0; i < head.size(); ++i ) {
675  const NeuroNode& n = nodes[ head[i] ];
676  headId.push_back( n.elecCompt() );
677  assert( reverseShaft[ n.parent() ] != ~0U );
678  const NeuroNode& pa = nodes[ n.parent() ];
679  shaftId.push_back( pa.elecCompt() );
680  assert( nodeToTempMap[ pa.parent() ] != ~0U );
681  parent.push_back( nodeToTempMap[ pa.parent() ] );
682  }
683  assert( shaftId.size() == headId.size() );
684 
685  reassignNodeIndices( temp, nodeToTempMap );
686  nodes = temp;
687 }
Id elecCompt() const
Definition: NeuroNode.cpp:79
Element * element() const
Synonym for Id::operator()()
Definition: Id.cpp:113
void reassignNodeIndices(vector< NeuroNode > &temp, const vector< unsigned int > &nodeToTempMap)
Definition: NeuroNode.cpp:591
Id elecCompt_
Id of electrical compartment in which this diffusive compt lives.
Definition: NeuroNode.h:212
static char name[]
Definition: mfield.cpp:401
unsigned int parent() const
Definition: NeuroNode.cpp:69
const string & getName() const
Definition: Element.cpp:56

+ Here is the call graph for this function:

void NeuroNode::findConnectedCompartments ( const map< Id, unsigned int > &  nodeMap,
const vector< NeuroNode > &  nodes 
)

Finds all the compartments connected to current node, put them all into the 'children' vector even if they may be 'parent' by the messaging. This is because this function has to be robust enough to sort this out

Definition at line 198 of file NeuroNode.cpp.

References children_, elecCompt_, and findAllConnectedCompartments().

Referenced by buildTree().

201 {
202  vector< Id > all = findAllConnectedCompartments( elecCompt_ );
203  // Now we have a list of all compartments connected to the current one.
204  // Convert to node indices.
205  children_.resize( all.size() );
206  // Note that the nodeMap only includes compts on list, which may be a
207  // subset of compts in entire model. So we only want to explore those.
208  for ( unsigned int i = 0; i < all.size(); ++i ) {
209  map< Id, unsigned int >::const_iterator k = nodeMap.find( all[i] );
210  if ( k != nodeMap.end() ) {
211  children_[i] = k->second;
212  } else {
213  cout << "Warning: NeuroNode::findConnectedCompartments: could not find compartment " << all[i].path() << endl;
214  // bruteForceFind( nodes, all[i] );
215  }
216  }
217 }
Id elecCompt_
Id of electrical compartment in which this diffusive compt lives.
Definition: NeuroNode.h:212
static vector< Id > findAllConnectedCompartments(Id compt)
Definition: NeuroNode.cpp:151
vector< unsigned int > children_
Definition: NeuroNode.h:202

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

unsigned int NeuroNode::findStartNode ( const vector< NeuroNode > &  nodes)
static

Find the start node, typically the soma, of a model. In terms of the solution, this should be the node at the root of the tree. Returns index in nodes vector. Technically the matrix solution could begin from any terminal branch, but it helps to keep the soma identical to the root of the tree.

Uses two heuristics to locate the start node: Looks for the node with the largest diameter, and also looks for node(s) with 'soma' in their name. If these disagree then it goes with the 'soma' node. If there are many of the soma nodes, it goes with the fattest.

Find the start node, typically the soma, of a model. In terms of the solution, this should be the node at the root of the tree. Returns index in nodes vector. Technically the matrix solution could begin from any terminal branch, but it helps to keep the soma identical to the root of the tree.

Uses two heuristics to locate the start node: Looks for the node with the largest diameter, and also looks for node(s) with 'soma' in their name. If these disagree then it goes with the 'soma' node. If there are many of the soma nodes, it goes with the fattest.

static func

Definition at line 270 of file NeuroNode.cpp.

References CylBase::getDia(), name, and moose::strncasecmp().

Referenced by buildTree().

271 {
272  double maxDia = 0.0;
273  unsigned int somaIndex = ~0;
274  for ( unsigned int i = 0; i < nodes.size(); ++i ) {
275  const char* name = nodes[i].elecCompt_.element()->getName().c_str();
276  if ( moose::strncasecmp( name, "soma", 4 ) == 0 ) {
277  if ( maxDia < nodes[i].getDia() ) {
278  maxDia = nodes[i].getDia();
279  somaIndex = i;
280  }
281  }
282  }
283  if ( somaIndex == ~0U ) { // Didn't find any compartment called soma
284  for ( unsigned int i =0; i < nodes.size(); ++i ) {
285  if ( maxDia < nodes[i].getDia() ) {
286  maxDia = nodes[i].getDia();
287  somaIndex = i;
288  }
289  }
290  }
291  assert( somaIndex != ~0U );
292  return somaIndex;
293 }
int strncasecmp(const string &a, const string &b, size_t n)
Compares the two strings a and b for first n characters, ignoring the case of the characters...
Definition: strutil.cpp:148
double getDia() const
Definition: CylBase.cpp:88
static char name[]
Definition: mfield.cpp:401

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void NeuroNode::innerTraverse ( vector< NeuroNode > &  tree,
const vector< NeuroNode > &  nodes,
vector< unsigned int > &  seen 
) const

Helper recursive function for traversing nodes to build tree.

Definition at line 351 of file NeuroNode.cpp.

References children_.

356 {
357  unsigned int pa = tree.size() - 1;
358  tree.back().children_.clear();
359 
360  for ( vector< unsigned int >::const_iterator i =
361  children_.begin(); i != children_.end(); ++i ) {
362  assert( *i < nodes.size() );
363 
364  // Check that it is an unseen node, ie, not a parent.
365  if ( seen[ *i ] == ~0U ) {
366  seen[ *i ] = tree.size();
367  tree[pa].children_.push_back( tree.size() );
368  tree.push_back( nodes[ *i ] );
369  tree.back().parent_ = pa;
370  nodes[*i].innerTraverse( tree, nodes, seen );
371  }
372  }
373  assert( tree.size() <= nodes.size() );
374 }
vector< unsigned int > children_
Definition: NeuroNode.h:202
bool NeuroNode::isDummyNode ( ) const

True when this is a dummy node to represent the coordinates of the start end of a compartment. For example, the start coords of a compartment sitting on a spherical soma, or the start coords of a spine neck along a longer dendritic compartment. In all other cases the start coordinates are just those of the end of the parent compartment.

When the isDummyNode is true, the elecCompt represents the Id of the compartment whose start it is.

Definition at line 83 of file NeuroNode.cpp.

References CylBase::getNumDivs().

Referenced by NeuroMesh::getAdx(), NeuroMesh::matchCubeMeshEntries(), NeuroMesh::nearest(), NeuroMesh::updateCoords(), and NeuroMesh::vGetVoxelMidpoint().

84 {
85  return ( getNumDivs() == 0 );
86 }
unsigned int getNumDivs() const
Definition: CylBase.cpp:108

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool NeuroNode::isSphere ( ) const

Definition at line 87 of file NeuroNode.cpp.

References isSphere_.

88 {
89  return isSphere_;
90 }
bool isSphere_
Definition: NeuroNode.h:218
bool NeuroNode::isStartNode ( ) const

Definition at line 91 of file NeuroNode.cpp.

References startFid_.

92 {
93  return ( startFid_ == 0 );
94 }
unsigned int startFid_
Definition: NeuroNode.h:208
unsigned int NeuroNode::parent ( ) const

Definition at line 69 of file NeuroNode.cpp.

References parent_.

Referenced by filterSpines(), NeuroMesh::getAdx(), NeuroMesh::indexToSpace(), NeuroMesh::matchCubeMeshEntries(), NeuroMesh::nearest(), setParent(), NeuroMesh::updateCoords(), NeuroMesh::updateShaftParents(), and NeuroMesh::vGetVoxelMidpoint().

70 {
71  return parent_;
72 }
unsigned int parent_
Definition: NeuroNode.h:197

+ Here is the caller graph for this function:

unsigned int NeuroNode::removeDisconnectedNodes ( vector< NeuroNode > &  nodes)
static

Go through nodes vector and eliminate entries that have zero children, that is, are not connected to any others. Need to clean up 'children_' list after this is called.

Go through nodes vector and eliminate entries that have zero children, that is, are not connected to any others. Need to clean up 'children_' list.

static func

Definition at line 227 of file NeuroNode.cpp.

References children_.

Referenced by buildTree().

229 {
230  vector< NeuroNode > temp;
231  vector< unsigned int > nodeMap( nodes.size() );
232 
233  unsigned int j = 0;
234  for ( unsigned int i = 0; i < nodes.size(); ++i ) {
235  if ( nodes[i].children_.size() > 0 ) {
236  temp.push_back( nodes[i] );
237  nodeMap[i] = j;
238  ++j;
239  } else {
240  nodeMap[i] = ~0;
241  }
242  }
243  for ( unsigned int i = 0; i < temp.size(); ++i ) {
244  vector< unsigned int >& c = temp[i].children_;
245  for ( vector< unsigned int >::iterator
246  j = c.begin(); j != c.end(); ++j ) {
247  assert( nodeMap[ *j ] != ~0U );
248  *j = nodeMap[ *j ];
249  }
250  }
251  unsigned int numRemoved = nodes.size() - temp.size();
252  nodes = temp;
253  return numRemoved;
254 }
vector< unsigned int > children_
Definition: NeuroNode.h:202

+ Here is the caller graph for this function:

void NeuroNode::setParent ( unsigned int  parent)

Assigns parent node info

Definition at line 111 of file NeuroNode.cpp.

References parent(), and parent_.

Referenced by NeuroMesh::insertSingleDummy().

112 {
113  parent_ = parent;
114 }
unsigned int parent_
Definition: NeuroNode.h:197
unsigned int parent() const
Definition: NeuroNode.cpp:69

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void NeuroNode::setParentAndChildren ( unsigned int  index,
int  dendParent,
vector< NeuroNode > &  nodes,
const unordered_map< Id, unsigned int > &  dendMap 
)

Definition at line 533 of file NeuroNode.cpp.

References elecCompt_, and parent_.

Referenced by buildSpinyTree().

535 {
536  if (dendParent < 0 || static_cast< unsigned int >(dendParent) >= nodes.size() )
537  return;
538  parent_ = dendParent;
539  const unordered_map< Id, unsigned int >::const_iterator dendLookup =
540  dendMap.find( nodes[dendParent].elecCompt_ );
541  if ( dendLookup != dendMap.end() ) {
542  assert( dendLookup->second < nodes.size() );
543  nodes[ dendLookup->second ].addChild( index );
544  }
545 }
unsigned int parent_
Definition: NeuroNode.h:197
Id elecCompt_
Id of electrical compartment in which this diffusive compt lives.
Definition: NeuroNode.h:212

+ Here is the caller graph for this function:

void NeuroNode::setStartFid ( unsigned int  f)

Assignes startFid

Definition at line 116 of file NeuroNode.cpp.

References startFid_.

117 {
118  startFid_ = fid;
119 }
unsigned int startFid_
Definition: NeuroNode.h:208
unsigned int NeuroNode::startFid ( ) const

Definition at line 74 of file NeuroNode.cpp.

References startFid_.

Referenced by NeuroMesh::getAdx(), NeuroMesh::indexToSpace(), NeuroMesh::matchCubeMeshEntries(), NeuroMesh::nearest(), NeuroMesh::updateCoords(), and NeuroMesh::updateShaftParents().

75 {
76  return startFid_;
77 }
unsigned int startFid_
Definition: NeuroNode.h:208

+ Here is the caller graph for this function:

void NeuroNode::traverse ( vector< NeuroNode > &  nodes,
unsigned int  start 
)
static

Traverses the nodes list starting from the 'start' node, and sets up correct parent-child information. This involves removing the identified 'parent' node from the 'children_' vector and assigning it to the parent_ field. Then it redoes the entire nodes vector (with due care for indexing of children and parents) so that it is in the correct order for a depth-first traversal. This means that you can take any entry in the list, and the immediately following entries will be all the descendants, if any.

Traverses the nodes list starting from the 'start' node, and sets up correct parent-child information. This involves removing the identified 'parent' node from the 'children_' vector and assigning it to the parent_ field. Then it redoes the entire nodes vector (with due care for indexing of children and parents) so that it is in the correct order for a depth-first traversal. This means that you can take any entry in the list, and the immediately following entries will be all the descendants, if any.

Static func

Definition at line 332 of file NeuroNode.cpp.

References diagnoseTree().

Referenced by buildTree().

333 {
334  vector< unsigned int > seen( nodes.size(), ~0 );
335  vector< NeuroNode > tree;
336  tree.reserve( nodes.size() );
337  seen[ start ] = 0;
338  tree.push_back( nodes[ start ] );
339  tree.back().parent_ = ~0;
340  nodes[start].innerTraverse( tree, nodes, seen );
341 
342  if ( tree.size() < nodes.size() ) {
343  cout << "Warning: NeuroNode::traverse() unable to traverse all nodes:\n";
344  cout << "Traversed= " << tree.size() << " < total numNodes = " << nodes.size() << endl;
345  cout << "This situation may arise if the CellPortion has disjoint compartments\n";
346  diagnoseTree( tree, nodes );
347  }
348  nodes = tree;
349 }
void diagnoseTree(const vector< NeuroNode > &tree, const vector< NeuroNode > &nodes)
Definition: NeuroNode.cpp:298

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

vector< unsigned int > NeuroNode::children_
private

Index of children of this NeuroNode.

Definition at line 202 of file NeuroNode.h.

Referenced by addChild(), children(), clearChildren(), findConnectedCompartments(), innerTraverse(), and removeDisconnectedNodes().

Id NeuroNode::elecCompt_
private

Id of electrical compartment in which this diffusive compt lives.

Definition at line 212 of file NeuroNode.h.

Referenced by elecCompt(), filterSpines(), findConnectedCompartments(), and setParentAndChildren().

bool NeuroNode::isSphere_
private

Special case for soma, perhaps for spine heads. When true, xyz are centre, and dia is dia.

Definition at line 218 of file NeuroNode.h.

Referenced by isSphere().

unsigned int NeuroNode::parent_
private

Index of parent NeuroNode, typically a diffusive compartment. In the special case where the junction to the parent electrical compartment is NOT at the end of the parent compartment, this refers instead to a dummy NeuroNode which has the coordinates.

One of the nodes, typically the soma, will have no parent. This is indicated by the value ~0U.

Definition at line 197 of file NeuroNode.h.

Referenced by parent(), setParent(), and setParentAndChildren().

unsigned int NeuroNode::startFid_
private

Index of starting MeshEntry handled by this NeuroNode. Assumes a block of contiguous fids are handled by each NeuroNode.

Definition at line 208 of file NeuroNode.h.

Referenced by isStartNode(), setStartFid(), and startFid().


The documentation for this class was generated from the following files: