Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkLiveWireTool2D.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 mitkLiveWireTool2D_h
14 #define mitkLiveWireTool2D_h
15 
18 
19 namespace mitk
20 {
45  {
46  public:
48  itkFactorylessNewMacro(Self);
49 
52 
55 
57  const char *GetName() const override;
58 
63 
64  protected:
66  ~LiveWireTool2D() override;
67 
69  void ConnectActionsAndFunctions() override;
70 
73 
75  void OnTimePointChanged() override;
76 
80  mitk::Point3D PrepareInitContour(const mitk::Point3D& clickedPoint) override;
81 
83  virtual void FinalizePreviewContour(const Point3D& clickedPoint) override;
84 
86  virtual void InitializePreviewContour(const Point3D& clickedPoint) override;
87 
89  virtual void UpdatePreviewContour(const Point3D& clickedPoint) override;
90 
91  private:
92 
94  void OnMouseMoveNoDynamicCosts(StateMachineAction *, InteractionEvent *interactionEvent);
95 
97  void FinishTool() override;
98 
99  template <typename TPixel, unsigned int VImageDimension>
100  void FindHighestGradientMagnitudeByITK(itk::Image<TPixel, VImageDimension> *inputImage,
101  itk::Index<3> &index,
102  itk::Index<3> &returnIndex);
103 
104  mitk::ContourModelLiveWireInteractor::Pointer m_ContourInteractor;
105 
106  mitk::ImageLiveWireContourModelFilter::Pointer m_LiveWireFilter;
107 
108  bool m_CreateAndUseDynamicCosts;
109  };
110 }
111 
112 #endif
#define MITKSEGMENTATION_EXPORT
Base class for lasso-like tools that draw closed contours with multiple anchor points.
Base class for all interaction events in MITK.
AlgorithmType
Enumeration describing how a label was created or refined.
Definition: mitkLabel.h:283
A 2D segmentation tool based on a LiveWire approach.
void OnTimePointChanged() override
Update the working slice when the time point changes.
us::ModuleResource GetIconResource() const override
Return the toolbar icon resource for this tool.
~LiveWireTool2D() override
const char * GetName() const override
Return the human-readable name of this tool ("Live Wire").
void UpdateLiveWireContour()
Recompute the LiveWire contour between start and end points.
virtual void UpdatePreviewContour(const Point3D &clickedPoint) override
Update the preview contour as the mouse moves to a new position.
virtual void FinalizePreviewContour(const Point3D &clickedPoint) override
Finalize the preview contour segment for the given click position.
mitk::Label::AlgorithmType GetAlgorithmType() const override
Edge-snapping (least-cost path) determines the affected pixels, not the user's direct stroke,...
mitk::Point3D PrepareInitContour(const mitk::Point3D &clickedPoint) override
Prepare the initial contour anchor, snapping to the highest gradient magnitude.
virtual void InitializePreviewContour(const Point3D &clickedPoint) override
Initialize the preview contour for a new LiveWire segment starting at the clicked point.
mitkClassMacro(LiveWireTool2D, EditableContourTool)
void ConnectActionsAndFunctions() override
Wire state machine actions to the corresponding member functions.
us::ModuleResource GetCursorIconResource() const override
Return the cursor icon resource for this tool.
Represents an action that is executed after a certain event in the state machine mechanism.
Represents a resource (text file, image, etc.) embedded in a CppMicroServices module.
Find image slices visible on a given plane.