37 mOrientations = orient;
57 return mRadius.mean();
62 mChildBranches.push_back(child);
67 mChildBranches = children;
72 mChildBranches.clear();
77 return mChildBranches;
82 mParentBranch = parent;
92 Eigen::MatrixXd diff = positions.rightCols(positions.cols() - 1) - positions.leftCols(positions.cols() - 1);
93 Eigen::MatrixXd orientations(positions.rows(),positions.cols());
94 orientations.leftCols(orientations.cols() - 1) = diff / diff.norm();
95 orientations.rightCols(1) = orientations.col(orientations.cols() - 1);
111 for(
size_t i = 0; i < bv.size(); ++i)
113 if(bv[i] == mParentBranch)
114 return static_cast<int>(i);
122 int generationNumber = 1;
125 while (parentBranchPtr)
127 if (parentBranchPtr->getChildBranches().size() > 1)
128 generationNumber = generationNumber + 1;
130 parentBranchPtr = parentBranchPtr->getParentBranch();
132 if (generationNumber > 23)
136 return generationNumber;
143 if (generationNumber == 1)
145 if (generationNumber == 2)
147 if (generationNumber == 3)
149 if (generationNumber == 4)
151 if (generationNumber == 5)
160 mBendingDirection = bendingDirection;
165 return mBendingDirection;
170 mBronchoscopeRotation = rotation;
175 return mBronchoscopeRotation;
182 bool resizeOrientations =
false;
183 if (positions.cols() == orientations.cols())
184 resizeOrientations =
true;
186 for (
int i = positions.cols() - 1; i > 0; i--)
188 if (
similar( (positions.col(i)-positions.col(i-1)).cwiseAbs().sum(), 0))
190 positions.block(0 , i , positions.rows() , positions.cols() - i - 1) = positions.rightCols(positions.cols() - i - 1);
191 positions.conservativeResize(Eigen::NoChange, positions.cols() - 1);
192 if (resizeOrientations)
193 orientations.conservativeResize(Eigen::NoChange, orientations.cols() - 1);
197 mPositions = positions;
198 if (resizeOrientations)
199 mOrientations = orientations;
void deleteChildBranches()
void addChildBranch(BranchPtr child)
void setPositions(Eigen::MatrixXd pos)
void setRadius(Eigen::VectorXd r)
branchVector getChildBranches()
double findBranchRadius()
boost::shared_ptr< class Branch > BranchPtr
int findGenerationNumber()
void removeEqualPositions()
Vector3D getBronchoscopeBendingDirection()
double getAverageRadius()
Eigen::MatrixXd getOrientations()
void setBronchoscopeBendingDirection(Vector3D bendingDirection)
int findParentIndex(branchVector bv) const
Branch::findParentIndex Given a vector of branches, find this branch's parent branch in that vector...
BranchPtr getParentBranch()
void setOrientations(Eigen::MatrixXd orient)
Eigen::VectorXd getRadius()
Eigen::MatrixXd getPositions()
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
bool similar(const CameraInfo &lhs, const CameraInfo &rhs, double tol)
void calculateOrientations()
double getBronchoscopeRotation()
void setBronchoscopeRotation(double rotation)
void setChildBranches(branchVector children)
void setParentBranch(BranchPtr parent)
std::vector< BranchPtr > branchVector
Namespace for all CustusX production code.