Medical Imaging Interaction Toolkit  2018.4.99-701c8286
Medical Imaging Interaction Toolkit

Manages and coordinates instances of mitk::Tool. More...

#include <mitkToolManager.h>

Inheritance diagram for mitk::ToolManager:
Collaboration diagram for mitk::ToolManager:

Public Types

typedef std::vector< Tool::PointerToolVectorType
 
typedef std::vector< Tool::ConstPointerToolVectorTypeConst
 
typedef std::vector< DataNode * > DataVectorType
 
typedef std::map< DataNode *, unsigned long > NodeTagMapType
 

Public Member Functions

 mitkClassMacroItkParent (ToolManager, itk::Object)
 
 mitkNewMacro1Param (ToolManager, DataStorage *)
 
const ToolVectorTypeConst GetTools ()
 Gives you a list of all tools. This is const on purpose. More...
 
int GetToolID (const Tool *tool)
 
ToolGetToolById (int id)
 
bool ActivateTool (int id)
 
template<class T >
int GetToolIdByToolType ()
 
int GetActiveToolID ()
 
ToolGetActiveTool ()
 
void SetReferenceData (DataVectorType)
 Set a list of data/images as reference objects. More...
 
void SetReferenceData (DataNode *)
 Set single data item/image as reference object. More...
 
void SetWorkingData (DataVectorType)
 Set a list of data/images as working objects. More...
 
void SetWorkingData (DataNode *)
 Set single data item/image as working object. More...
 
void SetRoiData (DataVectorType)
 Set a list of data/images as roi objects. More...
 
void SetRoiData (DataNode *)
 Set a single data item/image as roi object. More...
 
DataVectorType GetReferenceData ()
 Get the list of reference data. More...
 
DataNodeGetReferenceData (int)
 Get the current reference data. More...
 
DataVectorType GetWorkingData ()
 Get the list of working data. More...
 
DataNodeGetWorkingData (unsigned int)
 Get the current working data. More...
 
DataVectorType GetRoiData ()
 Get the current roi data. More...
 
DataNodeGetRoiData (int idx)
 Get the roi data at position idx. More...
 
DataStorageGetDataStorage ()
 
void SetDataStorage (DataStorage &storage)
 
TimePointType GetCurrentTimePoint () const
 
void RegisterClient ()
 Tell that someone is using tools. GUI elements should call this when they become active. This method increases an internal "client count". More...
 
void UnregisterClient ()
 Tell that someone is NOT using tools. GUI elements should call this when they become active. This method increases an internal "client count". More...
 
void InitializeTools ()
 Initialize all classes derived from mitk::Tool by itkObjectFactoy. More...
 
void OnOneOfTheReferenceDataDeletedConst (const itk::Object *caller, const itk::EventObject &e)
 
void OnOneOfTheReferenceDataDeleted (itk::Object *caller, const itk::EventObject &e)
 
void OnOneOfTheWorkingDataDeletedConst (const itk::Object *caller, const itk::EventObject &e)
 
void OnOneOfTheWorkingDataDeleted (itk::Object *caller, const itk::EventObject &e)
 
void OnOneOfTheRoiDataDeletedConst (const itk::Object *caller, const itk::EventObject &e)
 
void OnOneOfTheRoiDataDeleted (itk::Object *caller, const itk::EventObject &e)
 
void OnToolErrorMessage (std::string s)
 Connected to tool's messages. More...
 
void OnGeneralToolMessage (std::string s)
 

Public Attributes

Message NodePropertiesChanged
 
Message NewNodesGenerated
 
Message1< DataVectorType * > NewNodeObjectsGenerated
 
Message ActiveToolChanged
 
Message ReferenceDataChanged
 
Message WorkingDataChanged
 
Message RoiDataChanged
 
Message SelectedTimePointChanged
 
Message1< std::string > ToolErrorMessage
 
Message1< std::string > GeneralToolMessage
 

Protected Member Functions

 ToolManager (DataStorage *storage)
 
 ~ToolManager () override
 
void OnNodeRemoved (const mitk::DataNode *node)
 Callback for NodeRemove events. More...
 
void OnTimeChangedConst (const itk::Object *caller, const itk::EventObject &e)
 
void OnTimeChanged (itk::Object *caller, const itk::EventObject &e)
 
void EnsureTimeObservation ()
 
void StopTimeObservation ()
 

Protected Attributes

ToolVectorType m_Tools
 
Toolm_ActiveTool
 
int m_ActiveToolID
 
us::ServiceRegistration< InteractionEventObserverm_ActiveToolRegistration
 
DataVectorType m_ReferenceData
 
NodeTagMapType m_ReferenceDataObserverTags
 
DataVectorType m_WorkingData
 
NodeTagMapType m_WorkingDataObserverTags
 
DataVectorType m_RoiData
 
NodeTagMapType m_RoiDataObserverTags
 
int m_RegisteredClients
 
WeakPointer< DataStoragem_DataStorage
 

Detailed Description

Manages and coordinates instances of mitk::Tool.

See also
QmitkToolSelectionBox
Tool
QmitkSegmentationView

There is a separate page describing the general design of QmitkSegmentationView: Technical design of QmitkSegmentation

This class creates and manages several instances of mitk::Tool.

  • ToolManager creates instances of mitk::Tool by asking the itk::ObjectFactory to list all known implementations of mitk::Tool. As a result, one has to implement both a subclass of mitk::Tool and a matching subclass of itk::ObjectFactoryBase that is registered to the top-level itk::ObjectFactory. For an example, see mitkContourToolFactory.h. (this limitiation of one-class-one-factory is due to the implementation of itk::ObjectFactory). In MITK, the right place to register the factories to itk::ObjectFactory is the mitk::QMCoreObjectFactory or mitk::SBCoreObjectFactory.
  • ToolManager knows a set of "reference" DataNodes and a set of "working" DataNodes. The first application are segmentation tools, where the reference is the original image and the working data the (kind of) binary segmentation. However, ToolManager is implemented more generally, so that there could be other tools that work, e.g., with surfaces.
  • There is a set of events that are sent by ToolManager. At the moment these are TODO update documentation:
    • mitk::ToolReferenceDataChangedEvent whenever somebody calls SetReferenceData. Most of the time this actually means that the data has changed, but there might be cases where the same data is passed to SetReferenceData a second time, so don't rely on the assumption that something actually changed.
    • mitk::ToolSelectedEvent is sent when a (truly) different tool was activated. In reaction to this event you can ask for the active Tool using GetActiveTool or GetActiveToolID (where nullptr or -1 indicate that NO tool is active at the moment).

Design descisions:

  • Not a singleton, because there could be two functionalities using tools, each one with different reference/working data.

$Author$

Definition at line 80 of file mitkToolManager.h.

Member Typedef Documentation

◆ DataVectorType

Definition at line 85 of file mitkToolManager.h.

◆ NodeTagMapType

typedef std::map<DataNode *, unsigned long> mitk::ToolManager::NodeTagMapType

Definition at line 86 of file mitkToolManager.h.

◆ ToolVectorType

Definition at line 83 of file mitkToolManager.h.

◆ ToolVectorTypeConst

Definition at line 84 of file mitkToolManager.h.

Constructor & Destructor Documentation

◆ ToolManager()

mitk::ToolManager::ToolManager ( DataStorage storage)
protected

You may specify a list of tool "groups" that should be available for this ToolManager. Every Tool can report its group as a string. This constructor will try to find the tool's group inside the supplied string. If there is a match, the tool is accepted. Effectively, you can provide a human readable list like "default, lymphnodevolumetry, oldERISstuff".

◆ ~ToolManager()

mitk::ToolManager::~ToolManager ( )
overrideprotected

Member Function Documentation

◆ ActivateTool()

bool mitk::ToolManager::ActivateTool ( int  id)
Parameters
idThe tool to activate. Provide -1 for disabling any tools. Counting starts with 0. Registeres a listner for NodeRemoved event at DataStorage (see mitk::ToolManager::OnNodeRemoved).

◆ EnsureTimeObservation()

void mitk::ToolManager::EnsureTimeObservation ( )
protected

◆ GetActiveTool()

Tool* mitk::ToolManager::GetActiveTool ( )
Returns
nullptr for "No tool is active"

◆ GetActiveToolID()

int mitk::ToolManager::GetActiveToolID ( )
Returns
-1 for "No tool is active"

◆ GetCurrentTimePoint()

TimePointType mitk::ToolManager::GetCurrentTimePoint ( ) const

Get the current selected time point of the RenderManager

◆ GetDataStorage()

DataStorage* mitk::ToolManager::GetDataStorage ( )

◆ GetReferenceData() [1/2]

DataVectorType mitk::ToolManager::GetReferenceData ( )

Get the list of reference data.

◆ GetReferenceData() [2/2]

DataNode* mitk::ToolManager::GetReferenceData ( int  )

Get the current reference data.

Warning
If there is a list of items, this method will only return the first list item.

◆ GetRoiData() [1/2]

DataVectorType mitk::ToolManager::GetRoiData ( )

Get the current roi data.

◆ GetRoiData() [2/2]

DataNode* mitk::ToolManager::GetRoiData ( int  idx)

Get the roi data at position idx.

◆ GetToolById()

Tool* mitk::ToolManager::GetToolById ( int  id)
Parameters
idThe tool of interest. Counting starts with 0.

◆ GetToolID()

int mitk::ToolManager::GetToolID ( const Tool tool)

◆ GetToolIdByToolType()

template<class T >
int mitk::ToolManager::GetToolIdByToolType ( )
inline

Definition at line 126 of file mitkToolManager.h.

◆ GetTools()

const ToolVectorTypeConst mitk::ToolManager::GetTools ( )

Gives you a list of all tools. This is const on purpose.

◆ GetWorkingData() [1/2]

DataVectorType mitk::ToolManager::GetWorkingData ( )

Get the list of working data.

◆ GetWorkingData() [2/2]

DataNode* mitk::ToolManager::GetWorkingData ( unsigned  int)

Get the current working data.

Warning
If there is a list of items, this method will only return the first list item.

◆ InitializeTools()

void mitk::ToolManager::InitializeTools ( )

Initialize all classes derived from mitk::Tool by itkObjectFactoy.

◆ mitkClassMacroItkParent()

mitk::ToolManager::mitkClassMacroItkParent ( ToolManager  ,
itk::Object   
)

◆ mitkNewMacro1Param()

mitk::ToolManager::mitkNewMacro1Param ( ToolManager  ,
DataStorage  
)

◆ OnGeneralToolMessage()

void mitk::ToolManager::OnGeneralToolMessage ( std::string  s)

◆ OnNodeRemoved()

void mitk::ToolManager::OnNodeRemoved ( const mitk::DataNode node)
protected

Callback for NodeRemove events.

◆ OnOneOfTheReferenceDataDeleted()

void mitk::ToolManager::OnOneOfTheReferenceDataDeleted ( itk::Object *  caller,
const itk::EventObject &  e 
)

◆ OnOneOfTheReferenceDataDeletedConst()

void mitk::ToolManager::OnOneOfTheReferenceDataDeletedConst ( const itk::Object *  caller,
const itk::EventObject &  e 
)

◆ OnOneOfTheRoiDataDeleted()

void mitk::ToolManager::OnOneOfTheRoiDataDeleted ( itk::Object *  caller,
const itk::EventObject &  e 
)

◆ OnOneOfTheRoiDataDeletedConst()

void mitk::ToolManager::OnOneOfTheRoiDataDeletedConst ( const itk::Object *  caller,
const itk::EventObject &  e 
)

◆ OnOneOfTheWorkingDataDeleted()

void mitk::ToolManager::OnOneOfTheWorkingDataDeleted ( itk::Object *  caller,
const itk::EventObject &  e 
)

◆ OnOneOfTheWorkingDataDeletedConst()

void mitk::ToolManager::OnOneOfTheWorkingDataDeletedConst ( const itk::Object *  caller,
const itk::EventObject &  e 
)

◆ OnTimeChanged()

void mitk::ToolManager::OnTimeChanged ( itk::Object *  caller,
const itk::EventObject &  e 
)
protected

◆ OnTimeChangedConst()

void mitk::ToolManager::OnTimeChangedConst ( const itk::Object *  caller,
const itk::EventObject &  e 
)
protected

Callback for time changed events

◆ OnToolErrorMessage()

void mitk::ToolManager::OnToolErrorMessage ( std::string  s)

Connected to tool's messages.

This method just resends error messages coming from any of the tools. This way clients (GUIs) only have to observe one message.

◆ RegisterClient()

void mitk::ToolManager::RegisterClient ( )

Tell that someone is using tools. GUI elements should call this when they become active. This method increases an internal "client count".

◆ SetDataStorage()

void mitk::ToolManager::SetDataStorage ( DataStorage storage)

◆ SetReferenceData() [1/2]

void mitk::ToolManager::SetReferenceData ( DataVectorType  )

Set a list of data/images as reference objects.

◆ SetReferenceData() [2/2]

void mitk::ToolManager::SetReferenceData ( DataNode )

Set single data item/image as reference object.

◆ SetRoiData() [1/2]

void mitk::ToolManager::SetRoiData ( DataVectorType  )

Set a list of data/images as roi objects.

◆ SetRoiData() [2/2]

void mitk::ToolManager::SetRoiData ( DataNode )

Set a single data item/image as roi object.

◆ SetWorkingData() [1/2]

void mitk::ToolManager::SetWorkingData ( DataVectorType  )

Set a list of data/images as working objects.

◆ SetWorkingData() [2/2]

void mitk::ToolManager::SetWorkingData ( DataNode )

Set single data item/image as working object.

◆ StopTimeObservation()

void mitk::ToolManager::StopTimeObservation ( )
protected

◆ UnregisterClient()

void mitk::ToolManager::UnregisterClient ( )

Tell that someone is NOT using tools. GUI elements should call this when they become active. This method increases an internal "client count".

Member Data Documentation

◆ ActiveToolChanged

Message mitk::ToolManager::ActiveToolChanged

Definition at line 92 of file mitkToolManager.h.

◆ GeneralToolMessage

Message1<std::string> mitk::ToolManager::GeneralToolMessage

Definition at line 99 of file mitkToolManager.h.

◆ m_ActiveTool

Tool* mitk::ToolManager::m_ActiveTool
protected

Definition at line 264 of file mitkToolManager.h.

◆ m_ActiveToolID

int mitk::ToolManager::m_ActiveToolID
protected

Definition at line 265 of file mitkToolManager.h.

◆ m_ActiveToolRegistration

us::ServiceRegistration<InteractionEventObserver> mitk::ToolManager::m_ActiveToolRegistration
protected

Definition at line 266 of file mitkToolManager.h.

◆ m_DataStorage

WeakPointer<DataStorage> mitk::ToolManager::m_DataStorage
protected

Definition at line 279 of file mitkToolManager.h.

◆ m_ReferenceData

DataVectorType mitk::ToolManager::m_ReferenceData
protected

Definition at line 268 of file mitkToolManager.h.

◆ m_ReferenceDataObserverTags

NodeTagMapType mitk::ToolManager::m_ReferenceDataObserverTags
protected

Definition at line 269 of file mitkToolManager.h.

◆ m_RegisteredClients

int mitk::ToolManager::m_RegisteredClients
protected

Definition at line 277 of file mitkToolManager.h.

◆ m_RoiData

DataVectorType mitk::ToolManager::m_RoiData
protected

Definition at line 274 of file mitkToolManager.h.

◆ m_RoiDataObserverTags

NodeTagMapType mitk::ToolManager::m_RoiDataObserverTags
protected

Definition at line 275 of file mitkToolManager.h.

◆ m_Tools

ToolVectorType mitk::ToolManager::m_Tools
protected

Definition at line 262 of file mitkToolManager.h.

◆ m_WorkingData

DataVectorType mitk::ToolManager::m_WorkingData
protected

Definition at line 271 of file mitkToolManager.h.

◆ m_WorkingDataObserverTags

NodeTagMapType mitk::ToolManager::m_WorkingDataObserverTags
protected

Definition at line 272 of file mitkToolManager.h.

◆ NewNodeObjectsGenerated

Message1<DataVectorType *> mitk::ToolManager::NewNodeObjectsGenerated

Definition at line 90 of file mitkToolManager.h.

◆ NewNodesGenerated

Message mitk::ToolManager::NewNodesGenerated

Definition at line 89 of file mitkToolManager.h.

◆ NodePropertiesChanged

Message mitk::ToolManager::NodePropertiesChanged

Definition at line 88 of file mitkToolManager.h.

◆ ReferenceDataChanged

Message mitk::ToolManager::ReferenceDataChanged

Definition at line 93 of file mitkToolManager.h.

◆ RoiDataChanged

Message mitk::ToolManager::RoiDataChanged

Definition at line 95 of file mitkToolManager.h.

◆ SelectedTimePointChanged

Message mitk::ToolManager::SelectedTimePointChanged

Definition at line 96 of file mitkToolManager.h.

◆ ToolErrorMessage

Message1<std::string> mitk::ToolManager::ToolErrorMessage

Definition at line 98 of file mitkToolManager.h.

◆ WorkingDataChanged

Message mitk::ToolManager::WorkingDataChanged

Definition at line 94 of file mitkToolManager.h.


The documentation for this class was generated from the following file: