Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkPaintbrushTool.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 mitkPaintbrushTool_h
14 #define mitkPaintbrushTool_h
15 
16 #include <mitkCommon.h>
19 
20 namespace mitk
21 {
22  class StateMachineAction;
23  class InteractionEvent;
24  class InteractionPositionEvent;
25 
42  {
43  public:
46 
48 
53  void SetSize(int value);
54 
64  static ContourModel::Pointer CreateBrushContour(int size);
65 
76  static ContourModel::Pointer CreateGapContour(const Point3D& from,
77  const Point3D& to,
78  double radius);
79 
80  protected:
81  PaintbrushTool(bool startWithFillMode = true); // purposely hidden
82  ~PaintbrushTool() override;
83 
84  void ConnectActionsAndFunctions() override;
85 
86  void Activated() override;
87  void Deactivated() override;
88 
92  virtual void MouseMoved(mitk::InteractionEvent *interactionEvent, bool leftMouseButtonPressed);
96 
97  virtual int GetFillValue() const;
98 
100 
105 
110 
112 
114 
116  int m_Size;
117 
118  ContourModel::Pointer m_MasterContour;
119 
121 
122  Image::Pointer m_WorkingSlice;
123  Image::Pointer m_PaintingSlice;
124  PlaneGeometry::ConstPointer m_CurrentPlane;
125  DataNode::Pointer m_PaintingNode;
127 
128  };
129 
130 } // namespace
131 
132 #endif
#define MITKSEGMENTATION_EXPORT
Base class for tools that use a contour for feedback.
Base class for all interaction events in MITK.
Super class for all position-aware interaction events.
Paintbrush tool for InteractiveSegmentation.
virtual void OnMousePressed(StateMachineAction *, InteractionEvent *)
mitk::Point3D m_LastPosition
static ContourModel::Pointer CreateGapContour(const Point3D &from, const Point3D &to, double radius)
Builds a closed four-vertex rectangle ContourModel that fills the gap swept between two brush positio...
virtual void OnInvertLogic(StateMachineAction *, InteractionEvent *)
PlaneGeometry::ConstPointer m_CurrentPlane
void Deactivated() override
Called when the tool gets deactivated.
bool CheckIfCurrentSliceHasChanged(const InteractionPositionEvent *event)
void SetSize(int value)
Sets the radius of the circular paintbrush pen.
virtual void OnPrimaryButtonPressedMoved(StateMachineAction *, InteractionEvent *)
static ContourModel::Pointer CreateBrushContour(int size)
Builds a closed circular brush contour of the given size in 2D index coordinates, centered at the ori...
PaintbrushTool(bool startWithFillMode=true)
virtual void OnMouseMoved(StateMachineAction *, InteractionEvent *)
Image::Pointer m_WorkingSlice
virtual void OnMouseReleased(StateMachineAction *, InteractionEvent *)
static mitk::Point2D upperLeft(mitk::Point2D p)
void OnToolManagerWorkingDataModified()
void ResetWorkingSlice(const InteractionPositionEvent *event)
DataNode::Pointer m_PaintingNode
virtual void MouseMoved(mitk::InteractionEvent *interactionEvent, bool leftMouseButtonPressed)
Image::Pointer m_PaintingSlice
virtual int GetFillValue() const
void ConnectActionsAndFunctions() override
Message1< int > SizeChanged
Emitted when the pen size changes or should be updated in a GUI.
mitkClassMacro(PaintbrushTool, FeedbackContourTool)
~PaintbrushTool() override
void Activated() override
Called when the tool gets activated.
void UpdateContour(const InteractionPositionEvent *)
ContourModel::Pointer m_MasterContour
Represents an action that is executed after a certain event in the state machine mechanism.
Find image slices visible on a given plane.