Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkFeedbackContourTool.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 mitkFeedbackContourTool_h
14 #define mitkFeedbackContourTool_h
15 
16 #include <mitkCommon.h>
17 #include <mitkContourModelUtils.h>
18 #include <mitkImage.h>
19 #include <mitkSegTool2D.h>
21 
22 #include <mitkDataNode.h>
23 
24 #include <mitkImageCast.h>
25 
26 namespace mitk
27 {
49  {
50  public:
52 
53  protected:
54  FeedbackContourTool(const char *); // purposely hidden
56 
58 
62  void InitializeFeedbackContour(bool isClosed);
63 
65  void ClearsCurrentFeedbackContour(bool isClosed);
66 
70  void UpdateCurrentFeedbackContour(const ContourModel* sourceModel, TimeStepType sourceTimeStep = 0);
74  void UpdateFeedbackContour(const ContourModel* sourceModel, TimeStepType feedbackTimeStep, TimeStepType sourceTimeStep = 0);
75 
78 
80  void AddVertexToFeedbackContour(const Point3D& point, TimeStepType feedbackTimeStep);
81 
83 
85  void SetFeedbackContourColor(float r, float g, float b);
86  void SetFeedbackContourColor(const Color& color);
88  void SetFeedbackContourWidth(float width);
89 
90  void Deactivated() override;
91 
92  void Activated() override;
93 
100  ContourModel::Pointer ProjectContourTo2DSlice(const Image *slice,
101  const ContourModel *contourIn3D);
102 
109  ContourModel::Pointer BackProjectContourFrom2DSlice(const BaseGeometry *sliceGeometry,
110  const ContourModel *contourIn2D);
111 
125  void WriteBackFeedbackContourAsSegmentationResult(const InteractionPositionEvent* positionEvent, MultiLabelSegmentation::LabelValueType labelValue, bool addMode, bool setInvisibleAfterSuccess = true);
126 
138  mitk::Image::Pointer GenerateSliceWithContourUpdate(const MultiLabelSegmentation* seg, const PlaneGeometry* sliceGeometry,
139  const ContourModel* contour, MultiLabelSegmentation::LabelValueType labelValue, TimePointType timePoint, bool addMode);
140 
141  private:
142  ContourModel::Pointer m_FeedbackContour;
143  DataNode::Pointer m_FeedbackContourNode;
144  bool m_FeedbackContourVisible;
145  };
146 
147 } // namespace
148 
149 #endif
#define MITKSEGMENTATION_EXPORT
Abstract base class describing the geometry of a data object.
A time-resolved contour representation consisting of linked vertices in 3D space.
Base class for tools that use a contour for feedback.
FeedbackContourTool(const char *)
ContourModel::Pointer ProjectContourTo2DSlice(const Image *slice, const ContourModel *contourIn3D)
Projects a contour onto an image point by point. Converts from world to index coordinates.
void Activated() override
Called when the tool gets activated.
void SetFeedbackContourColor(float r, float g, float b)
Provide values from 0.0 (black) to 1.0 (full color)
void AddVertexToFeedbackContour(const Point3D &point, TimeStepType feedbackTimeStep)
void WriteBackFeedbackContourAsSegmentationResult(const InteractionPositionEvent *positionEvent, MultiLabelSegmentation::LabelValueType labelValue, bool addMode, bool setInvisibleAfterSuccess=true)
Checks preconditions and writes the feedback contour as a segmentation result.
mitkClassMacro(FeedbackContourTool, SegTool2D)
void UpdateCurrentFeedbackContour(const ContourModel *sourceModel, TimeStepType sourceTimeStep=0)
void AddVertexToCurrentFeedbackContour(const Point3D &point)
const ContourModel * GetFeedbackContour() const
void Deactivated() override
Called when the tool gets deactivated.
ContourModel::Pointer BackProjectContourFrom2DSlice(const BaseGeometry *sliceGeometry, const ContourModel *contourIn2D)
Projects a slice index coordinates of a contour back into world coordinates.
void SetFeedbackContourWidth(float width)
void SetFeedbackContourColor(const Color &color)
void SetFeedbackContourVisible(bool)
void InitializeFeedbackContour(bool isClosed)
void ClearsCurrentFeedbackContour(bool isClosed)
void UpdateFeedbackContour(const ContourModel *sourceModel, TimeStepType feedbackTimeStep, TimeStepType sourceTimeStep=0)
mitk::Image::Pointer GenerateSliceWithContourUpdate(const MultiLabelSegmentation *seg, const PlaneGeometry *sliceGeometry, const ContourModel *contour, MultiLabelSegmentation::LabelValueType labelValue, TimePointType timePoint, bool addMode)
Generates an updated slice image with the contour applied.
Image class for storing multi-dimensional medical image data.
Definition: mitkImage.h:76
Super class for all position-aware interaction events.
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
mitk::Label::PixelType LabelValueType
Describes the geometry of a plane object.
Abstract base class for segmentation tools.
Definition: mitkSegTool2D.h:57
Find image slices visible on a given plane.
itk::RGBPixel< float > Color
Standard RGB color typedef using float components.
std::size_t TimeStepType
Type for time step indices (non-negative integers starting from 0).
mitk::ScalarType TimePointType
Type for time point values in milliseconds (ms).