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

Provides common functionality for DrawTool and PolyTool where these two tools enable drawing lines and poly-lines around voxel edges. More...

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

Public Member Functions

virtual void ExecuteOperation (mitk::Operation *operation)
 Method to enable this class to interact with the Undo/Redo framework. More...
 
virtual void ClearData ()
 Clears the contour, meaning it re-initialised the feedback contour in mitk::FeedbackContourTool, and also the background contour herein. More...
 
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
 
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 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

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...
 

Static Public Attributes

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

 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)
 

Protected Attributes

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
 

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...
 

Detailed Description

Provides common functionality for DrawTool and PolyTool where these two tools enable drawing lines and poly-lines around voxel edges.

This class derives from mitk::FeedbackContourTool, and uses several contours to do its magic. The base class "FeedbackContour" is the one that is visible as the tool is used. In addition, in this class we store a "BackgroundContour". The FeedbackContour goes round the edges of each voxel, and the BackgroundContour simply stores each mouse position, as each mouse event is received, and hence contains the trajectory of the mouse.

See also
mitk::FeedbackContourTool
niftk::Tool
niftk::DrawTool
niftk::PolyTool

Constructor & Destructor Documentation

niftk::ContourTool::ContourTool ( )
protected
niftk::ContourTool::~ContourTool ( )
protectedvirtual

Member Function Documentation

void niftk::ContourTool::AccumulateContourInWorkingData ( mitk::ContourModel &  contour,
int  contourIndex 
)
protected

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.

void niftk::ContourTool::ClearData ( )
virtual

Clears the contour, meaning it re-initialised the feedback contour in mitk::FeedbackContourTool, and also the background contour herein.

Reimplemented in niftk::PolyTool.

void niftk::ContourTool::ConvertPointInMmToVx ( const mitk::Point3D &  pointInMm,
mitk::Point3D &  pointInVx 
)
protected
void niftk::ContourTool::ConvertPointToNearestVoxelCentreInMm ( const mitk::Point3D &  pointInMm,
mitk::Point3D &  nearestVoxelCentreInMm 
)
protected
void niftk::ContourTool::ConvertPointToNearestVoxelCentreInVx ( const mitk::Point3D &  pointInMm,
mitk::Point3D &  nearestVoxelCentreInVx 
)
protected
void niftk::ContourTool::CopyContour ( mitk::ContourModel &  a,
mitk::ContourModel &  b 
)
static

Copies contour from a to b.

void niftk::ContourTool::CopyContourSet ( mitk::ContourModelSet &  a,
mitk::ContourModelSet &  b,
bool  initialise = true 
)
static

Copies contour set from a to b.

void niftk::ContourTool::Disable3dRenderingOfBackgroundContour ( )
protected
void niftk::ContourTool::Disable3dRenderingOfNode ( mitk::DataNode *  node)
protected

This method makes sure that the argument node will not show up in ANY 3D viewer thats currently registered with the global mitk::RenderingManager.

bool niftk::ContourTool::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 
)
protected
void niftk::ContourTool::ExecuteOperation ( mitk::Operation *  operation)
virtual

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

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

void niftk::ContourTool::GetAdditionalCornerPoint ( const mitk::Point3D &  cornerPoint1InMm,
const mitk::Point3D &  point2InMm,
const mitk::Point3D &  cornerPoint2InMm,
int whichTwoAxesInVx,
mitk::Point3D &  newCornerPointInMm 
)
protected
mitk::ContourModel * niftk::ContourTool::GetBackgroundContour ( )
protected
void niftk::ContourTool::GetClosestCornerPoint2D ( const mitk::Point3D &  pointInMm,
int whichTwoAxesInVx,
mitk::Point3D &  cornerPointInMm 
)
protected
mitk::ContourModel * niftk::ContourTool::GetContour ( )
virtual

Get a pointer to the current feedback contour.

int niftk::ContourTool::GetEqualCoordinateAxes ( const mitk::Point3D &  cornerPoint1InMm,
const mitk::Point3D &  cornerPoint2InMm,
int whichTwoAxesInVx 
)
protected

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.

void niftk::ContourTool::InitialiseContour ( mitk::ContourModel &  a,
mitk::ContourModel &  b 
)
static

Initialises the output contour b with properties like, closed, width and selected, copied from the reference contour a.

bool niftk::ContourTool::OnMousePressed ( mitk::StateMachineAction *  action,
mitk::InteractionEvent *  event 
)
protectedvirtual

Calls the FeedbackContour::OnMousePressed method, then checks for working image, reference image and geometry.

void niftk::ContourTool::SetBackgroundContour ( mitk::ContourModel &  contour)
protected
void niftk::ContourTool::SetBackgroundContourColor ( float  r,
float  g,
float  b 
)
protected
void niftk::ContourTool::SetBackgroundContourColorDefault ( )
protected
void niftk::ContourTool::SetBackgroundContourVisible ( bool  visible)
protected
void niftk::ContourTool::SetFeedbackContourVisible ( bool  b)
virtual

Turns the feedback contour on/off.

Member Data Documentation

mitk::Message niftk::ContourTool::ContoursHaveChanged

Used to signal that the contours have changed.

mitk::ContourModel::Pointer niftk::ContourTool::m_BackgroundContour
protected
mitk::DataNode::Pointer niftk::ContourTool::m_BackgroundContourNode
protected
bool niftk::ContourTool::m_BackgroundContourVisible
protected
bool niftk::ContourTool::m_ContourClosed
protected
int niftk::ContourTool::m_ContourWidth
protected
mitk::Image* niftk::ContourTool::m_ReferenceImage
protected
mitk::Image* niftk::ContourTool::m_SegmentationImage
protected
mitk::BaseGeometry* niftk::ContourTool::m_SegmentationImageGeometry
protected
float niftk::ContourTool::m_Tolerance
protected
const std::string niftk::ContourTool::MIDAS_CONTOUR_TOOL_BACKGROUND_CONTOUR
static

We store the name of a property to say we are editing.

We store the name of the background contour, which is the contour storing exact mouse position events.


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