30 m_ElementVector.clear();
35 return m_ElementVector;
40 m_ElementVector = elementVector;
45 return m_ElementVector.size();
50 m_ElementVector.push_back(element);
55 m_ElementVector.insert(m_ElementVector.begin() + position, element);
60 if (position >= GetNumberOfElements())
61 throw std::runtime_error(
"Exception thrown in TubeGraphEdge::getTubeElement(uint): getTubeElement(uint)");
63 return m_ElementVector[position];
70 std::vector<float> diff;
72 unsigned int numberOfElements = this->GetNumberOfElements();
75 if (numberOfElements == 0)
81 diff[0] = pos1[0] - pos2[0];
82 diff[1] = pos1[1] - pos2[1];
83 diff[2] = pos1[2] - pos2[2];
85 float sum = diff[0] * diff[0] + diff[1] * diff[1] + diff[2] * diff[2];
86 length = length + std::sqrt(sum);
92 pos2 = (this->GetTubeElement(0))->GetCoordinates();
94 diff[0] = pos1[0] - pos2[0];
95 diff[1] = pos1[1] - pos2[1];
96 diff[2] = pos1[2] - pos2[2];
98 float sum = diff[0] * diff[0] + diff[1] * diff[1] + diff[2] * diff[2];
99 length = length + std::sqrt(sum);
102 for (
unsigned int i = 0; i < numberOfElements - 1; ++i)
104 pos1 = (this->GetTubeElement(i))->GetCoordinates();
105 pos2 = (this->GetTubeElement(i + 1))->GetCoordinates();
107 diff[0] = pos1[0] - pos2[0];
108 diff[1] = pos1[1] - pos2[1];
109 diff[2] = pos1[2] - pos2[2];
111 sum = diff[0] * diff[0] + diff[1] * diff[1] + diff[2] * diff[2];
112 length = length + std::sqrt(sum);
116 pos1 = (this->GetTubeElement(numberOfElements - 1))->GetCoordinates();
119 diff[0] = pos1[0] - pos2[0];
120 diff[1] = pos1[1] - pos2[1];
121 diff[2] = pos1[2] - pos2[2];
123 sum = diff[0] * diff[0] + diff[1] * diff[1] + diff[2] * diff[2];
124 length = length + std::sqrt(sum);
132 float diameterSum = 0.0;
133 unsigned int numberOfElements = this->GetNumberOfElements();
136 if (dynamic_cast<const mitk::CircularProfileTubeElement *>(source.
GetTubeElement()))
141 for (
unsigned int i = 0; i < numberOfElements; i++)
143 if (dynamic_cast<const mitk::CircularProfileTubeElement *>(this->GetTubeElement(i)))
148 if (dynamic_cast<const mitk::CircularProfileTubeElement *>(target.
GetTubeElement()))
151 return diameterSum / (numberOfElements + 2);
156 return (m_ElementVector == right.m_ElementVector);
unsigned int GetNumberOfElements() const
float GetEdgeLength(TubeGraphVertex &source, TubeGraphVertex &target)
Base Class for Tube Graph Vertices.
void AddTubeElement(TubeElement *element)
Abstract class for elements which describes tubular structur.
void SetElementVector(std::vector< TubeElement * > elementVector)
float GetEdgeAverageDiameter(TubeGraphVertex &source, TubeGraphVertex &target)
bool operator==(const TubeGraphEdge &right) const
Class for elements which describes tubular structur with a circular cross section.
Base Class for Tube Graph Edges.
const TubeElement * GetTubeElement() const
TubeElement * GetTubeElement(unsigned int position)
std::vector< TubeElement * > GetElementVector()
void AddTubeElementAt(unsigned int position, TubeElement *element)