32 dynamic_cast<TubeGraphProperty *
>(m_TubeGraph->GetProperty(
"Tube Graph.Visualization Information").GetPointer());
43 MITK_ERROR <<
"mitk::TubeGraphPicker: No tube graph available. Please set an input!" << std::endl;
45 return std::pair<mitk::TubeGraph::TubeDescriptorType, mitk::TubeElement *>(
TubeGraph::ErrorId, nullPointer);
47 m_WorldPosition = pickedPosition;
52 float currentRadius = 0;
59 std::vector<mitk::TubeGraphEdge> allEdges = m_TubeGraph->GetVectorOfAllEdges();
60 for (
auto edge = allEdges.begin(); edge != allEdges.end(); ++edge)
62 std::pair<mitk::TubeGraphVertex, mitk::TubeGraphVertex> soureTargetPair =
63 m_TubeGraph->GetVerticesOfAnEdge(m_TubeGraph->GetEdgeDescriptor(*edge));
66 m_TubeGraph->GetVertexDescriptor(soureTargetPair.second));
68 if (m_TubeGraphProperty->IsTubeVisible(currentTubeId))
70 std::vector<mitk::TubeElement *> allElements = edge->GetElementVector();
71 for (
unsigned int index = 0; index < edge->GetNumberOfElements(); index++)
73 currentPosition = allElements[index]->GetCoordinates();
74 if (dynamic_cast<mitk::CircularProfileTubeElement *>(allElements[index]))
80 currentDistance = m_WorldPosition.EuclideanDistanceTo(currentPosition);
81 if (currentDistance < closestDistance && (currentDistance - currentRadius) < 1.0)
83 closestDistance = currentDistance;
84 tubeId = currentTubeId;
85 tubeElement = allElements[index];
90 std::pair<mitk::TubeGraph::TubeDescriptorType, mitk::TubeElement *> pickedTubeWithElement(tubeId, tubeElement);
91 return pickedTubeWithElement;
void SetTubeGraph(const TubeGraph *tubeGraph)
static const TubeDescriptorType ErrorId
Base Class for Tube Graphs.
virtual ~TubeGraphPicker()
Abstract class for elements which describes tubular structur.
std::pair< mitk::TubeGraph::TubeDescriptorType, mitk::TubeElement * > GetPickedTube(const Point3D pickedPosition)
std::pair< VertexDescriptorType, VertexDescriptorType > TubeDescriptorType
Property for tube graphs.
Class for elements which describes tubular structur with a circular cross section.