MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SwcSegment.h
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2003-2015 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 #ifndef SWC_SEGMENT_H
10 #define SWC_SEGMENT_H
11 
19 {
20  public:
22  : myIndex_( 0 ), type_( 0 ), radius_( 0.0 ),
23  length_( 0.0 ), L_( 0.0 ),
24  parent_( ~0U ),
27  {;}
28 
29  SwcSegment( const string& line );
30 
31  SwcSegment( int i, short type,
32  double x, double y, double z,
33  double r, int parent );
34  bool OK() const
35  {
36  return type_!=BadSegment && type_!=UNDEF && type_!=CUSTOM;
37  }
38 
39  void setBad() {
40  type_ = BadSegment;
41  }
42 
43 
44  unsigned int parent() const {
45  return parent_;
46  }
47 
48  void setParent( unsigned int pa ) {
49  parent_ = pa;
50  }
51 
52  unsigned int myIndex() const {
53  return myIndex_;
54  }
55 
56  void addChild( unsigned int kid ) {
57  kids_.push_back( kid );
58  }
59 
60  void figureOutType();
61 
62  const vector< int >& kids() const
63  {
64  return kids_;
65  }
66 
67  void replaceKids( const vector< int >& kids )
68  {
69  kids_ = kids;
70  }
71 
72  unsigned short type() const {
73  return type_;
74  }
75 
76  double radius() const {
77  return radius_;
78  }
79  double length() const {
80  return length_;
81  }
82 
83  double L() const {
84  return L_;
85  }
86 
87  double distance( const SwcSegment& other ) const {
88  return v_.distance( other.v_ );
89  }
90 
91  const Vec& vec() const {
92  return v_;
93  }
94 
96  {
98  }
99 
100  void setCumulativeDistance( double len, double L,
101  double pSoma, double eSoma )
102  {
103  length_ = len;
104  L_ = L;
105  pathDistanceFromSoma_ = pSoma;
107  }
108 
109  double getPathDistFromSoma() const {
110  return pathDistanceFromSoma_;
111  }
112 
113  double getGeomDistFromSoma() const {
115  }
116 
117  double getElecDistFromSoma() const {
119  }
120 
121  // This is the original SWC set.
122  static const short UNDEF;
123  static const short SOMA;
124  static const short AXON;
125  static const short DEND;
126  static const short APICAL;
127  static const short FORK; // Assumed to be on regular dend
128  static const short END; // Assumed to be on regular dend
129  static const short CUSTOM;
130  // Here are a few more
131  static const short BadSegment;
132  static const short AXON_FORK;
133  static const short AXON_END;
134  static const short APICAL_FORK;
135  static const short APICAL_END;
136 
137  static const string typeName[];
138 
139  protected:
140  unsigned int myIndex_;
141 
153  short type_;
154  Vec v_;
155  double radius_;
156  double length_;
157  double L_;
158  unsigned int parent_;
159 
162 
165 
168 
169  vector< int > kids_; // Indices of all children of segment.
170 };
171 
172 class SwcBranch: public SwcSegment
173 {
174  public:
175  SwcBranch( int i, const SwcSegment& start, double len, double L,
176  const vector< int >& cable );
177 
178  void printDiagnostics() const;
179 
180  double r0;
181  double r1;
182 
184  double geomLength;
185 
187  double pathLength;
188 
189 
196 
202  vector< int > segs_;
203 };
204 
205 #endif // SWC_SEGMENT_H
vector< int > segs_
Definition: SwcSegment.h:202
void setBad()
Definition: SwcSegment.h:39
void replaceKids(const vector< int > &kids)
Definition: SwcSegment.h:67
static const short BadSegment
Definition: SwcSegment.h:131
double L() const
Definition: SwcSegment.h:83
static const short FORK
Definition: SwcSegment.h:127
unsigned short type() const
Definition: SwcSegment.h:72
unsigned int parent() const
Definition: SwcSegment.h:44
double getPathDistFromSoma() const
Definition: SwcSegment.h:109
const vector< int > & kids() const
Definition: SwcSegment.h:62
double geomLength
Radius at end.
Definition: SwcSegment.h:184
void addChild(unsigned int kid)
Definition: SwcSegment.h:56
unsigned int myIndex() const
Definition: SwcSegment.h:52
bool OK() const
Definition: SwcSegment.h:34
void printDiagnostics() const
Definition: SwcSegment.cpp:131
double length() const
Definition: SwcSegment.h:79
static const short CUSTOM
Definition: SwcSegment.h:129
void setCumulativeDistance(double len, double L, double pSoma, double eSoma)
Definition: SwcSegment.h:100
Definition: Vec.h:13
void figureOutType()
Definition: SwcSegment.cpp:88
double getGeomDistFromSoma() const
Definition: SwcSegment.h:113
double electrotonicDistanceFromSoma_
electrotonic dist from soma, summed along dend.
Definition: SwcSegment.h:167
double electroLength
Definition: SwcSegment.h:195
SwcBranch(int i, const SwcSegment &start, double len, double L, const vector< int > &cable)
Definition: SwcSegment.cpp:112
static const short END
Definition: SwcSegment.h:128
static const short SOMA
Definition: SwcSegment.h:123
static const short AXON_END
Definition: SwcSegment.h:133
double getElecDistFromSoma() const
Definition: SwcSegment.h:117
unsigned int myIndex_
Definition: SwcSegment.h:140
static const short DEND
Definition: SwcSegment.h:125
vector< int > kids_
Definition: SwcSegment.h:169
static const short APICAL_FORK
Definition: SwcSegment.h:134
double distance(const SwcSegment &other) const
Definition: SwcSegment.h:87
double distance(const Vec &other) const
Definition: Vec.cpp:81
static const short APICAL_END
Definition: SwcSegment.h:135
static const short UNDEF
Definition: SwcSegment.h:122
double pathDistanceFromSoma_
Index of parent. Is ~0 for soma.
Definition: SwcSegment.h:161
double L_
Length of segment.
Definition: SwcSegment.h:157
double r0
Definition: SwcSegment.h:180
double length_
Radius of segment.
Definition: SwcSegment.h:156
double radius() const
Definition: SwcSegment.h:76
double radius_
coordinates of end of segment
Definition: SwcSegment.h:155
double r1
Radius at beginning.
Definition: SwcSegment.h:181
short type_
Index of self.
Definition: SwcSegment.h:153
const Vec & vec() const
Definition: SwcSegment.h:91
void setGeometricalDistanceFromSoma(const SwcSegment &soma)
Definition: SwcSegment.h:95
double pathLength
Geometrical length of entire branch, summed along all segments.
Definition: SwcSegment.h:187
void setParent(unsigned int pa)
Definition: SwcSegment.h:48
unsigned int parent_
Number of length constants in segment.
Definition: SwcSegment.h:158
static const string typeName[]
Definition: SwcSegment.h:137
static const short APICAL
Definition: SwcSegment.h:126
static const short AXON
Definition: SwcSegment.h:124
double geometricalDistanceFromSoma_
geometrical distance from soma.
Definition: SwcSegment.h:164
static const short AXON_FORK
Definition: SwcSegment.h:132