CustusX  18.04
An IGT application
cxBranch.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 #include "cxBranch.h"
12 
13 namespace cx
14 {
15 
17  mParentBranch(BranchPtr())
18 {
19  // TODO Auto-generated constructor stub
20 
21 }
22 
23 void Branch::setPositions(Eigen::MatrixXd pos)
24 {
25  mPositions = pos;
26 }
27 
28 Eigen::MatrixXd Branch::getPositions()
29 {
30  return mPositions;
31 }
32 
33 void Branch::setOrientations(Eigen::MatrixXd orient)
34 {
35  mOrientations = orient;
36 }
37 
38 Eigen::MatrixXd Branch::getOrientations()
39 {
40  return mOrientations;
41 }
42 
44 {
45  mChildBranches.push_back(child);
46 }
47 
49 {
50  mChildBranches = children;
51 }
52 
54 {
55  mChildBranches.clear();
56 }
57 
59 {
60  return mChildBranches;
61 }
62 
64 {
65  mParentBranch = parent;
66 }
68 {
69  return mParentBranch;
70 }
71 
83 {
84  for(size_t i = 0; i < bv.size(); ++i)
85  {
86  if(bv[i] == mParentBranch)
87  return static_cast<int>(i);
88  }
89 
90  return -1;
91 }
92 
94 {
95  int generationNumber = 1;
96 
97  BranchPtr parentBranchPtr = this->getParentBranch();
98  while (parentBranchPtr)
99  {
100  generationNumber = generationNumber + 1;
101  parentBranchPtr = parentBranchPtr->getParentBranch();
102  }
103 
104  return generationNumber;
105 }
106 
108 {
109  int generationNumber = this->findGenerationNumber();
110 
111  if (generationNumber == 1)
112  return 6;
113  if (generationNumber == 2)
114  return 4;
115  if (generationNumber == 3)
116  return 3;
117  if (generationNumber == 4)
118  return 2.5;
119  if (generationNumber == 5)
120  return 2;
121  else
122  return 2;
123 }
124 
125 
127 {
128 
129 }
130 
131 }//namespace cx
void deleteChildBranches()
Definition: cxBranch.cpp:53
void addChildBranch(BranchPtr child)
Definition: cxBranch.cpp:43
void setPositions(Eigen::MatrixXd pos)
Definition: cxBranch.cpp:23
branchVector getChildBranches()
Definition: cxBranch.cpp:58
double findBranchRadius()
Definition: cxBranch.cpp:107
int findGenerationNumber()
Definition: cxBranch.cpp:93
boost::shared_ptr< class Branch > BranchPtr
Eigen::MatrixXd getOrientations()
Definition: cxBranch.cpp:38
virtual ~Branch()
Definition: cxBranch.cpp:126
int findParentIndex(branchVector bv) const
Branch::findParentIndex Given a vector of branches, find this branch&#39;s parent branch in that vector...
Definition: cxBranch.cpp:82
BranchPtr getParentBranch()
Definition: cxBranch.cpp:67
void setOrientations(Eigen::MatrixXd orient)
Definition: cxBranch.cpp:33
Eigen::MatrixXd getPositions()
Definition: cxBranch.cpp:28
void setChildBranches(branchVector children)
Definition: cxBranch.cpp:48
void setParentBranch(BranchPtr parent)
Definition: cxBranch.cpp:63
std::vector< BranchPtr > branchVector
Definition: cxBranch.h:28
Namespace for all CustusX production code.