NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
niftk::Tool Class Reference

Base class for segmentor tools that need access to the list of seeds for the current reference data volume registered with the ToolManager. More...

Inheritance diagram for niftk::Tool:
Inheritance graph
[legend]
Collaboration diagram for niftk::Tool:
Collaboration graph
[legend]

Public Types

enum  {
  SEGMENTATION, SEEDS, CONTOURS, DRAW_CONTOURS,
  PRIOR_CONTOURS, NEXT_CONTOURS, REGION_GROWING, INITIAL_SEGMENTATION,
  INITIAL_SEEDS
}
 Constants that identify the data needed for the irregular edit tools. They should be used to index the vector of working data. More...
 

Public Member Functions

 mitkClassMacro (Tool, mitk::FeedbackContourTool) static void LoadBehaviourStrings()
 Loads the behaviour string to the global interaction. This function should be called before any niftk::Tool object is created. More...
 
const char * GetGroup () const override
 
virtual void Activated ()
 When called, we get a reference to the set of seeds, and set up the interactor(s). More...
 
virtual void Deactivated ()
 When called, we unregister the reference to the set of seeds, and deactivate the interactors(s). More...
 
bool GetBlockNumberOfSeedsSignal () const
 Gets the flag to block the signal that indicates that the number of seeds has changed. More...
 
void SetBlockNumberOfSeedsSignal (bool blockNumberOfSeedsSignal)
 Sets the flag to block the signal that indicates that the number of seeds has changed. More...
 
virtual void InstallEventFilter (StateMachineEventFilter *eventFilter)
 Adds an event filter that can reject a state machine event or let it pass through. Overrides niftk::FilteringStateMachine::InstallEventFilter() so that it adds every filter also to the internal point set interactor. More...
 
virtual void RemoveEventFilter (StateMachineEventFilter *eventFilter)
 Removes an event filter that can reject a state machine event or let it pass through. Overrides niftkFilteringStateMachine::InstallEventFilter() to that it removes every filter also from the internal point set interactor. More...
 
- Public Member Functions inherited from niftk::FilteringStateMachine
 FilteringStateMachine ()
 Constructs a FilteringStateMachine object. More...
 
virtual ~FilteringStateMachine ()
 Destructs the FilteringStateMachine object. More...
 
float CanHandleEvent (const mitk::StateEvent *event) const
 This function is to replace the original CanHandleEvent function to support event filtering. More...
 
bool CanHandleEvent (mitk::InteractionEvent *event)
 
std::vector
< StateMachineEventFilter * > 
GetEventFilters () const
 Gets the list of the installed event filters. More...
 
bool IsFiltered (const mitk::StateEvent *stateEvent) const
 Tells if the event is rejected by the installed event filters or they let it pass through. More...
 
bool IsFiltered (mitk::InteractionEvent *event)
 Tells if the event is rejected by the installed event filters or they let it pass through. More...
 

Static Public Member Functions

static bool LoadBehaviour (const std::string &fileName, us::Module *module)
 

Public Attributes

mitk::Message1< intNumberOfSeedsHasChanged
 Used to signal that the number of seeds has changed. More...
 

Static Public Attributes

static const std::string SEEDS_NAME = "MIDAS_SEEDS"
 Stores a seed point set name, so all classes have access to the name. More...
 
static const std::string CONTOURS_NAME = "MIDAS_CURRENT_CONTOURS"
 Stores the name of the current slice contours, so all classes have access to the name. More...
 
static const std::string DRAW_CONTOURS_NAME = "MIDAS_DRAW_CONTOURS"
 Stores the name of the draw tool contours, so all classes have access to the name. More...
 
static const std::string PRIOR_CONTOURS_NAME = "MIDAS_PRIOR_CONTOURS"
 Stores the name of the prior contours, so all classes have access to the name. More...
 
static const std::string NEXT_CONTOURS_NAME = "MIDAS_NEXT_CONTOURS"
 Stores the name of the next contours, so all classes have access to the name. More...
 
static const std::string REGION_GROWING_NAME = "MIDAS_REGION_GROWING_IMAGE"
 Stores the name of the region growing image, so all classes have access to the name. More...
 
static const std::string INITIAL_SEGMENTATION_NAME = "MIDAS_INITIAL_SEGMENTATION_IMAGE"
 Stores the name of the initial segmentation image, so all classes have access to the name. More...
 
static const std::string INITIAL_SEEDS_NAME = "MIDAS_INITIAL_SEEDS"
 Stores the name of the initial set of seeds, so all classes have access to the name. More...
 

Protected Member Functions

 Tool ()
 
virtual ~Tool ()
 
bool FilterEvents (mitk::InteractionEvent *event, mitk::DataNode *dataNode)
 Tells if this tool can handle the given event. More...
 
virtual void RenderCurrentWindow (const mitk::PositionEvent &event)
 Makes the current window re-render. More...
 
virtual void RenderAllWindows ()
 Makes all windows re-render. More...
 
virtual void UpdateWorkingDataNodeBoolProperty (int dataIndex, const std::string &name, bool value)
 Helper method to update a boolean property on a given working data node. More...
 
mitk::DataNode::Pointer GetPointSetNode () const
 The node that contains the point set that is the working data of the seed tool. More...
 
mitk::PointSet::Pointer GetPointSet () const
 The point set that is the working data of the seed tool. More...
 
- Protected Member Functions inherited from niftk::FilteringStateMachine
virtual float CanHandle (const mitk::StateEvent *stateEvent) const
 
virtual bool CanHandle (mitk::InteractionEvent *event)
 

Detailed Description

Base class for segmentor tools that need access to the list of seeds for the current reference data volume registered with the ToolManager.

Matt: I made it inherit from FeedbackContourTool, as multiple inheritance was getting messy.

Note that the SeedTool, DrawTool and PolyTool all inherit from this class. Each of these tools will have their point set interactor. Each tool is managed by an mitk::ToolManager which guarantees that only one is active at any given time. As each tool becomes activated it will register the interactor with GlobalInteraction, and as the tool becomes deactivated it will de-register the interactor with GlobalInteraction.

In addition (as of 18th May 2012), this class keeps track of the number of seeds and calls OnNumberOfSeedsChanged(int numberOfSeeds) when the number of seeds changed. This means derived classes could be notified when the number of seeds has changed. This is only called if the tool is Active.

See also
SeedTool
ContourTool
DrawTool
PolyTool
PointSetDataInteractor

Member Enumeration Documentation

anonymous enum

Constants that identify the data needed for the irregular edit tools. They should be used to index the vector of working data.

Enumerator
SEGMENTATION 
SEEDS 
CONTOURS 
DRAW_CONTOURS 
PRIOR_CONTOURS 
NEXT_CONTOURS 
REGION_GROWING 
INITIAL_SEGMENTATION 
INITIAL_SEEDS 

Constructor & Destructor Documentation

niftk::Tool::Tool ( )
protected
niftk::Tool::~Tool ( )
protectedvirtual

Member Function Documentation

void niftk::Tool::Activated ( )
virtual

When called, we get a reference to the set of seeds, and set up the interactor(s).

Reimplemented in niftk::DrawTool, niftk::PolyTool, and niftk::SeedTool.

void niftk::Tool::Deactivated ( )
virtual

When called, we unregister the reference to the set of seeds, and deactivate the interactors(s).

Note: The interactor is disabled after it is destructed, therefore we have to make sure that we remove every reference to it. The data node also has a reference to it, therefore we have to decouple them here. If we do not do this, the interactor stays active and will keep processing the events.

Reimplemented in niftk::PolyTool, and niftk::SeedTool.

bool niftk::Tool::FilterEvents ( mitk::InteractionEvent *  event,
mitk::DataNode *  dataNode 
)
protected

Tells if this tool can handle the given event.

This implementation delegates the call to FilteringStateMachine::CanHandleEvent(), that checks if the event is filtered by one of the installed event filters and if not, calls CanHandle() and returns with its result.

Note that this function is purposefully not virtual. Eventual subclasses should override the CanHandle function.

bool niftk::Tool::GetBlockNumberOfSeedsSignal ( ) const

Gets the flag to block the signal that indicates that the number of seeds has changed.

const char * niftk::Tool::GetGroup ( ) const
override
mitk::PointSet::Pointer niftk::Tool::GetPointSet ( ) const
protected

The point set that is the working data of the seed tool.

mitk::DataNode::Pointer niftk::Tool::GetPointSetNode ( ) const
protected

The node that contains the point set that is the working data of the seed tool.

void niftk::Tool::InstallEventFilter ( StateMachineEventFilter eventFilter)
virtual

Adds an event filter that can reject a state machine event or let it pass through. Overrides niftk::FilteringStateMachine::InstallEventFilter() so that it adds every filter also to the internal point set interactor.

Reimplemented from niftk::FilteringStateMachine.

Reimplemented in niftk::SeedTool.

bool niftk::Tool::LoadBehaviour ( const std::string fileName,
us::Module *  module 
)
static
niftk::Tool::mitkClassMacro ( Tool  ,
mitk::FeedbackContourTool   
)

Loads the behaviour string to the global interaction. This function should be called before any niftk::Tool object is created.

void niftk::Tool::RemoveEventFilter ( StateMachineEventFilter eventFilter)
virtual

Removes an event filter that can reject a state machine event or let it pass through. Overrides niftkFilteringStateMachine::InstallEventFilter() to that it removes every filter also from the internal point set interactor.

Reimplemented from niftk::FilteringStateMachine.

Reimplemented in niftk::SeedTool.

void niftk::Tool::RenderAllWindows ( )
protectedvirtual

Makes all windows re-render.

void niftk::Tool::RenderCurrentWindow ( const mitk::PositionEvent &  event)
protectedvirtual

Makes the current window re-render.

void niftk::Tool::SetBlockNumberOfSeedsSignal ( bool  blockNumberOfSeedsSignal)

Sets the flag to block the signal that indicates that the number of seeds has changed.

void niftk::Tool::UpdateWorkingDataNodeBoolProperty ( int  dataIndex,
const std::string name,
bool  value 
)
protectedvirtual

Helper method to update a boolean property on a given working data node.

Member Data Documentation

const std::string niftk::Tool::CONTOURS_NAME = "MIDAS_CURRENT_CONTOURS"
static

Stores the name of the current slice contours, so all classes have access to the name.

const std::string niftk::Tool::DRAW_CONTOURS_NAME = "MIDAS_DRAW_CONTOURS"
static

Stores the name of the draw tool contours, so all classes have access to the name.

const std::string niftk::Tool::INITIAL_SEEDS_NAME = "MIDAS_INITIAL_SEEDS"
static

Stores the name of the initial set of seeds, so all classes have access to the name.

const std::string niftk::Tool::INITIAL_SEGMENTATION_NAME = "MIDAS_INITIAL_SEGMENTATION_IMAGE"
static

Stores the name of the initial segmentation image, so all classes have access to the name.

const std::string niftk::Tool::NEXT_CONTOURS_NAME = "MIDAS_NEXT_CONTOURS"
static

Stores the name of the next contours, so all classes have access to the name.

mitk::Message1<int> niftk::Tool::NumberOfSeedsHasChanged

Used to signal that the number of seeds has changed.

const std::string niftk::Tool::PRIOR_CONTOURS_NAME = "MIDAS_PRIOR_CONTOURS"
static

Stores the name of the prior contours, so all classes have access to the name.

const std::string niftk::Tool::REGION_GROWING_NAME = "MIDAS_REGION_GROWING_IMAGE"
static

Stores the name of the region growing image, so all classes have access to the name.

const std::string niftk::Tool::SEEDS_NAME = "MIDAS_SEEDS"
static

Stores a seed point set name, so all classes have access to the name.


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