21 #include <vtkCamera.h> 22 #include <vtkInteractorStyle.h> 23 #include <vtkPointData.h> 24 #include <vtkPolyData.h> 25 #include <vtkRenderWindowInteractor.h> 29 m_SecondLastPickedTube(
TubeGraph::ErrorId),
30 m_ActivationMode(
None),
31 m_ActionMode(AttributationMode)
56 m_TubeGraph->GetProperty(
"Tube Graph.Visualization Information").GetPointer());
57 if (m_TubeGraphProperty.IsNull())
58 MITK_ERROR <<
"Something went wrong! No tube graph property!";
61 m_TubeGraph =
nullptr;
64 m_TubeGraph =
nullptr;
70 if (positionEvent ==
nullptr)
74 picker->SetTubeGraph(m_TubeGraph);
76 auto pickedTube = picker->GetPickedTube(positionEvent->GetPositionInWorld());
82 m_LastPickedElement = pickedTube.second;
83 m_SecondLastPickedTube = m_LastPickedTube;
84 m_LastPickedTube = tubeDescriptor;
93 if (m_TubeGraph.IsNull())
100 if (m_ActivationMode !=
None)
103 std::stringstream displayText;
104 displayText <<
"Picked tube: ID [" << m_LastPickedTube.first <<
"," << m_LastPickedTube.second <<
"]";
112 if (m_TubeGraph.IsNull())
115 if ((m_ActivationMode !=
Multiple) && (m_ActivationMode !=
Points))
117 m_TubeGraphProperty->DeactivateAllTubes();
127 m_ActivationMode = activationMode;
128 if (m_TubeGraph.IsNotNull())
135 return m_ActivationMode;
140 m_ActionMode = actionMode;
160 m_TubeGraphProperty->DeactivateAllTubes();
161 m_TubeGraphProperty->SetTubeActive(m_LastPickedTube,
true);
169 m_TubeGraph->SetRootTube(m_LastPickedTube);
171 m_TubeGraphProperty->DeactivateAllTubes();
176 switch (m_ActivationMode)
180 m_TubeGraphProperty->DeactivateAllTubes();
186 m_TubeGraphProperty->DeactivateAllTubes();
187 m_TubeGraphProperty->SetTubeActive(m_LastPickedTube,
true);
194 if (m_TubeGraphProperty->IsTubeActive(m_LastPickedTube))
195 m_TubeGraphProperty->SetTubeActive(m_LastPickedTube,
false);
197 m_TubeGraphProperty->SetTubeActive(m_LastPickedTube,
true);
203 m_TubeGraphProperty->DeactivateAllTubes();
204 std::vector<TubeGraph::TubeDescriptorType> activeTubes = this->GetTubesToRoot();
205 m_TubeGraphProperty->SetTubesActive(activeTubes);
210 m_TubeGraphProperty->DeactivateAllTubes();
211 std::vector<TubeGraph::TubeDescriptorType> activeTubes = this->GetPathToPeriphery();
212 m_TubeGraphProperty->SetTubesActive(activeTubes);
218 m_TubeGraphProperty->DeactivateAllTubes();
219 std::vector<TubeGraph::TubeDescriptorType> activeTubes = this->GetTubesBetweenPoints();
220 m_TubeGraphProperty->SetTubesActive(activeTubes);
225 MITK_WARN <<
"Unknown tube graph interaction mode!";
231 std::vector<mitk::TubeGraph::TubeDescriptorType> mitk::TubeGraphDataInteractor::GetTubesToRoot()
236 root = m_TubeGraph->GetThickestTube();
237 m_TubeGraph->SetRootTube(root);
240 return this->GetPathBetweenTubes(m_LastPickedTube, root);
243 std::vector<mitk::TubeGraph::TubeDescriptorType> mitk::TubeGraphDataInteractor::GetTubesBetweenPoints()
245 return this->GetPathBetweenTubes(m_LastPickedTube, m_SecondLastPickedTube);
248 std::vector<mitk::TubeGraph::TubeDescriptorType> mitk::TubeGraphDataInteractor::GetPathBetweenTubes(
251 std::vector<mitk::TubeGraph::TubeDescriptorType> solutionPath;
255 solutionPath = m_TubeGraph->SearchAllPathBetweenVertices(start, end);
257 solutionPath.push_back(start);
263 std::vector<mitk::TubeGraph::TubeDescriptorType> mitk::TubeGraphDataInteractor::GetPathToPeriphery()
265 std::vector<mitk::TubeGraph::TubeDescriptorType> solutionPath;
268 solutionPath = m_TubeGraph->SearchPathToPeriphery(m_LastPickedTube);
281 if (m_LastPickedElement)
mitk::Point3D GetLastPickedPosition()
ActivationMode GetActivationMode()
Super class for all position events.
static const TubeDescriptorType ErrorId
virtual void SelectTube(StateMachineAction *, InteractionEvent *)
virtual void DeselectTube(StateMachineAction *, InteractionEvent *)
Base Class for Tube Graphs.
Constants for most interaction classes, due to the generic StateMachines.
void SetActionMode(const ActionMode &actionMode)
DataNode * GetDataNode() const
~TubeGraphDataInteractor() override
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
std::pair< VertexDescriptorType, VertexDescriptorType > TubeDescriptorType
Property for tube graphs.
static RenderingManager * GetInstance()
void DisplayText(const char *t)
Send a string to the applications StatusBar.
Represents an action, that is executed after a certain event (in statemachine-mechanism) TODO: implem...
void DataNodeChanged() override
Point< ScalarType, 3 > Point3D
static StatusBar * GetInstance()
static method to get the GUI dependent StatusBar-instance so the methods DisplayText, etc. can be called No reference counting, cause of decentral static use!
ActionMode GetActionMode()
#define CONNECT_CONDITION(a, f)
void SelectTubesByActivationModus()
TubeGraphDataInteractor()
virtual const Point3D & GetCoordinates() const =0
virtual bool CheckOverTube(const InteractionEvent *)
#define CONNECT_FUNCTION(a, f)
void SetActivationMode(const ActivationMode &activationMode)
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
void ConnectActionsAndFunctions() override