Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkContourTool.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkContourTool_h
14 #define mitkContourTool_h
15 
16 #include <mitkCommon.h>
19 
20 namespace mitk
21 {
22  class Image;
23  class StateMachineAction;
24  class InteractionEvent;
25 
45  {
46  public:
48 
49  protected:
50  ContourTool(int paintingPixelValue = 1); // purposely hidden
51  ~ContourTool() override;
52 
54  void Activated() override;
55 
57  void Deactivated() override;
58 
60  virtual void OnMousePressed(StateMachineAction *, InteractionEvent *interactionEvent);
61 
63  virtual void OnMouseMoved(StateMachineAction *, InteractionEvent *interactionEvent);
64 
66  virtual void OnMouseReleased(StateMachineAction *, InteractionEvent *interactionEvent);
67 
69  virtual void OnInvertLogic(StateMachineAction *, InteractionEvent *interactionEvent);
70 
72  void ConnectActionsAndFunctions() override;
73 
76  };
77 
78 } // namespace
79 
80 #endif
#define MITKSEGMENTATION_EXPORT
Simple contour filling tool.
void Activated() override
Called when the tool is activated. Delegates to superclass.
mitkClassMacro(ContourTool, FeedbackContourTool)
virtual void OnInvertLogic(StateMachineAction *, InteractionEvent *interactionEvent)
Toggle painting pixel value between 0 and 1 (called when CTRL is pressed).
virtual void OnMousePressed(StateMachineAction *, InteractionEvent *interactionEvent)
Initialize the feedback contour with the first point on mouse press.
virtual void OnMouseMoved(StateMachineAction *, InteractionEvent *interactionEvent)
Add subsequent points to the feedback contour during mouse drag.
ContourTool(int paintingPixelValue=1)
virtual void OnMouseReleased(StateMachineAction *, InteractionEvent *interactionEvent)
Close the contour, project it to the image slice, and fill it on mouse release.
void ConnectActionsAndFunctions() override
Wire state machine actions to the corresponding member functions.
int m_PaintingPixelValue
The pixel value used when filling the contour (0 = erase, 1 = draw).
~ContourTool() override
void Deactivated() override
Called when the tool is deactivated. Delegates to superclass.
Base class for tools that use a contour for feedback.
Base class for all interaction events in MITK.
Represents an action that is executed after a certain event in the state machine mechanism.
class ITK_EXPORT Image
Find image slices visible on a given plane.