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

Tool to draw poly lines around voxel edges like MIDAS does rather than through them as most of the MITK tools do. More...

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

Public Member Functions

 mitkClassMacro (PolyTool, Tool) static Pointer New()
 
virtual const char * GetName () const
 
virtual const char ** GetXPM () const
 
virtual void ExecuteOperation (mitk::Operation *operation)
 Method to enable this class to interact with the Undo/Redo framework. More...
 
virtual void Activated ()
 When called, we initialize contours, as the PolyLine keeps going until the whole tool is Activated/Deactivated. More...
 
virtual void Deactivated ()
 When called, add the current poly line to the node specified by niftk::Tool::CURRENT_CONTOURS_NAME. More...
 
virtual bool AddLine (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 When called, we incrementally build up a poly line. More...
 
virtual bool SelectPoint (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 When called, we select the closest point in poly line, ready to move it. More...
 
virtual bool MovePoint (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 When called, we move the selected point and hence move the poly line. More...
 
virtual bool DeselectPoint (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 When called, we release the selected point and hence stop moving the poly line. More...
 
virtual void ClearData ()
 Clears the contour, meaning it re-initialised the feedback contour in mitk::FeedbackContourTool, and also the background contour in ContourTool and the Previous Contour and Poly Line points in this class. More...
 
- Public Member Functions inherited from niftk::ContourTool
virtual mitk::ContourModel * GetContour ()
 Get a pointer to the current feedback contour. More...
 
virtual void SetFeedbackContourVisible (bool)
 Turns the feedback contour on/off. More...
 
- Public Member Functions inherited from niftk::Tool
 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
 
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 Attributes

static const std::string MIDAS_POLY_TOOL_ANCHOR_POINTS
 We store the name of the anchor points node, which is used to store the first point on a poly line. More...
 
static const std::string MIDAS_POLY_TOOL_PREVIOUS_CONTOUR
 We store the name of the previous contour node, which is the contour display in green when middle-click dragging the poly line. More...
 
- Static Public Attributes inherited from niftk::ContourTool
static mitkClassMacro(ContourTool,
Tool) static const std const
std::string 
MIDAS_CONTOUR_TOOL_BACKGROUND_CONTOUR
 We store the name of a property to say we are editing. More...
 
- Static Public Attributes inherited from niftk::Tool
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

 PolyTool ()
 
virtual ~PolyTool ()
 
virtual void InitializeStateMachine ()
 
virtual void ConnectActionsAndFunctions ()
 Connects state machine actions to functions. More...
 
- Protected Member Functions inherited from niftk::ContourTool
 ContourTool ()
 
virtual ~ContourTool ()
 
virtual bool OnMousePressed (mitk::StateMachineAction *action, mitk::InteractionEvent *event)
 Calls the FeedbackContour::OnMousePressed method, then checks for working image, reference image and geometry. More...
 
void Disable3dRenderingOfNode (mitk::DataNode *node)
 This method makes sure that the argument node will not show up in ANY 3D viewer thats currently registered with the global mitk::RenderingManager. More...
 
void AccumulateContourInWorkingData (mitk::ContourModel &contour, int contourIndex)
 Adds the given contour to the Working Data registered with mitk::ToolManager, where the ToolManager can have multiple data sets registered, so we add the contour to the dataset specified by dataSetNumber. More...
 
void ConvertPointInMmToVx (const mitk::Point3D &pointInMm, mitk::Point3D &pointInVx)
 
void ConvertPointToNearestVoxelCentreInVx (const mitk::Point3D &pointInMm, mitk::Point3D &nearestVoxelCentreInVx)
 
void ConvertPointToNearestVoxelCentreInMm (const mitk::Point3D &pointInMm, mitk::Point3D &nearestVoxelCentreInMm)
 
void GetClosestCornerPoint2D (const mitk::Point3D &pointInMm, int *whichTwoAxesInVx, mitk::Point3D &cornerPointInMm)
 
int GetEqualCoordinateAxes (const mitk::Point3D &cornerPoint1InMm, const mitk::Point3D &cornerPoint2InMm, int *whichTwoAxesInVx)
 Compares two coordinates of the points and tells which of them are equal. The axes of the two coordinates to compare are given in whichTwoAxesInVx. Returns 0 if both coordinates are different, 1 if only the first coordinates are equal, 2 if only the second coordinates are equal and 3 the points are the same. More...
 
void GetAdditionalCornerPoint (const mitk::Point3D &cornerPoint1InMm, const mitk::Point3D &point2InMm, const mitk::Point3D &cornerPoint2InMm, int *whichTwoAxesInVx, mitk::Point3D &newCornerPointInMm)
 
bool DrawLineAroundVoxelEdges (const mitk::Image *image, const mitk::BaseGeometry *geometry, const mitk::PlaneGeometry *planeGeometry, const mitk::Point3D &currentPoint, const mitk::Point3D &previousPoint, mitk::ContourModel &contourAroundCorners, mitk::ContourModel &contourAlongLine)
 
mitk::ContourModel * GetBackgroundContour ()
 
void SetBackgroundContour (mitk::ContourModel &)
 
void Disable3dRenderingOfBackgroundContour ()
 
void SetBackgroundContourVisible (bool)
 
void SetBackgroundContourColor (float r, float g, float b)
 
void SetBackgroundContourColorDefault ()
 
- Protected Member Functions inherited from niftk::Tool
 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)
 

Additional Inherited Members

- Public Types inherited from niftk::Tool
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...
 
- Static Public Member Functions inherited from niftk::ContourTool
static void CopyContour (mitk::ContourModel &a, mitk::ContourModel &b)
 Copies contour from a to b. More...
 
static void CopyContourSet (mitk::ContourModelSet &a, mitk::ContourModelSet &b, bool initialise=true)
 Copies contour set from a to b. More...
 
static void InitialiseContour (mitk::ContourModel &a, mitk::ContourModel &b)
 Initialises the output contour b with properties like, closed, width and selected, copied from the reference contour a. More...
 
- Static Public Member Functions inherited from niftk::Tool
static bool LoadBehaviour (const std::string &fileName, us::Module *module)
 
- Public Attributes inherited from niftk::ContourTool
mitk::Message ContoursHaveChanged
 Used to signal that the contours have changed. More...
 
- Public Attributes inherited from niftk::Tool
mitk::Message1< intNumberOfSeedsHasChanged
 Used to signal that the number of seeds has changed. More...
 
- Protected Attributes inherited from niftk::ContourTool
int m_ContourWidth
 
bool m_ContourClosed
 
float m_Tolerance
 
mitk::BaseGeometry * m_SegmentationImageGeometry
 
mitk::Image * m_SegmentationImage
 
mitk::Image * m_ReferenceImage
 
mitk::ContourModel::Pointer m_BackgroundContour
 
mitk::DataNode::Pointer m_BackgroundContourNode
 
bool m_BackgroundContourVisible
 

Detailed Description

Tool to draw poly lines around voxel edges like MIDAS does rather than through them as most of the MITK tools do.

Provides

1. Left mouse button = place marker for poly line
2. Middle mouse button = select nearest marker point
3. Move with middle mouse button down = move/drag the marker point selected in step 2.

and includes Undo/Redo functionality. The poly lines keep going until the tool is deselected. When the tool is deselected, the poly line is copied to the mitk::ToolManagers WorkingData, specifically dataset 2, which should be the mitk::ContourModelSet representing the current set of contours in the gui, which in MIDAS terms is the green lines representing the current segmentation.

Constructor & Destructor Documentation

niftk::PolyTool::PolyTool ( )
protected
niftk::PolyTool::~PolyTool ( )
protectedvirtual

Member Function Documentation

void niftk::PolyTool::Activated ( )
virtual

When called, we initialize contours, as the PolyLine keeps going until the whole tool is Activated/Deactivated.

Reimplemented from niftk::Tool.

bool niftk::PolyTool::AddLine ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual

When called, we incrementally build up a poly line.

Poly lines are created by responding only to left mouse down. When the tool is activated, the next mouse click starts the line. We then keep adding points and lines until the tool is deactivated.

void niftk::PolyTool::ClearData ( )
virtual

Clears the contour, meaning it re-initialised the feedback contour in mitk::FeedbackContourTool, and also the background contour in ContourTool and the Previous Contour and Poly Line points in this class.

Reimplemented from niftk::ContourTool.

void niftk::PolyTool::ConnectActionsAndFunctions ( )
protectedvirtual

Connects state machine actions to functions.

void niftk::PolyTool::Deactivated ( )
virtual

When called, add the current poly line to the node specified by niftk::Tool::CURRENT_CONTOURS_NAME.

Reimplemented from niftk::Tool.

bool niftk::PolyTool::DeselectPoint ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual

When called, we release the selected point and hence stop moving the poly line.

void niftk::PolyTool::ExecuteOperation ( mitk::Operation *  operation)
virtual

Method to enable this class to interact with the Undo/Redo framework.

Reimplemented from niftk::ContourTool.

const char * niftk::PolyTool::GetName ( ) const
virtual
See also
mitk::Tool::GetName()
const char ** niftk::PolyTool::GetXPM ( ) const
virtual
See also
mitk::Tool::GetXPM()
void niftk::PolyTool::InitializeStateMachine ( )
protectedvirtual
niftk::PolyTool::mitkClassMacro ( PolyTool  ,
Tool   
)
bool niftk::PolyTool::MovePoint ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual

When called, we move the selected point and hence move the poly line.

bool niftk::PolyTool::SelectPoint ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
virtual

When called, we select the closest point in poly line, ready to move it.

Member Data Documentation

const std::string niftk::PolyTool::MIDAS_POLY_TOOL_ANCHOR_POINTS
static

We store the name of the anchor points node, which is used to store the first point on a poly line.

const std::string niftk::PolyTool::MIDAS_POLY_TOOL_PREVIOUS_CONTOUR
static

We store the name of the previous contour node, which is the contour display in green when middle-click dragging the poly line.


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