Medical Imaging Interaction Toolkit  2025.12.02
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 "mitkContourUtils.h" //TODO remove legacy support
19 #include "mitkImage.h"
20 #include "mitkSegTool2D.h"
22 
23 #include "mitkDataNode.h"
24 
25 #include "mitkImageCast.h"
26 
27 namespace mitk
28 {
50  {
51  public:
53 
54  protected:
55  FeedbackContourTool(const char *); // purposely hidden
57 
59 
63  void InitializeFeedbackContour(bool isClosed);
64 
66  void ClearsCurrentFeedbackContour(bool isClosed);
67 
71  void UpdateCurrentFeedbackContour(const ContourModel* sourceModel, TimeStepType sourceTimeStep = 0);
75  void UpdateFeedbackContour(const ContourModel* sourceModel, TimeStepType feedbackTimeStep, TimeStepType sourceTimeStep = 0);
76 
79 
81  void AddVertexToFeedbackContour(const Point3D& point, TimeStepType feedbackTimeStep);
82 
84 
86  void SetFeedbackContourColor(float r, float g, float b);
87  void SetFeedbackContourColor(const Color& color);
89  void SetFeedbackContourWidth(float width);
90 
91  void Deactivated() override;
92 
93  void Activated() override;
94 
101  ContourModel::Pointer ProjectContourTo2DSlice(const Image *slice,
102  const ContourModel *contourIn3D);
103 
110  ContourModel::Pointer BackProjectContourFrom2DSlice(const BaseGeometry *sliceGeometry,
111  const ContourModel *contourIn2D);
112 
125  void WriteBackFeedbackContourAsSegmentationResult(const InteractionPositionEvent* positionEvent, MultiLabelSegmentation::LabelValueType labelValue, bool addMode, bool setInvisibleAfterSuccess = true);
126 
136  const ContourModel* contour, MultiLabelSegmentation::LabelValueType labelValue, TimePointType timePoint, bool addMode);
137 
138  private:
139  ContourModel::Pointer m_FeedbackContour;
140  DataNode::Pointer m_FeedbackContourNode;
141  bool m_FeedbackContourVisible;
142  };
143 
144 } // namespace
145 
146 #endif
#define MITKSEGMENTATION_EXPORT
BaseGeometry Describes the geometry of a data object.
ContourModel is a structure of linked vertices defining a contour in 3D space. The vertices are store...
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)
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)
Image class for storing images.
Definition: mitkImage.h:70
Super class for all position events.
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
mitk::Label::PixelType LabelValueType
Describes a two-dimensional, rectangular plane.
Abstract base class for segmentation tools.
Definition: mitkSegTool2D.h:57
Find image slices visible on a given plane.
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
std::size_t TimeStepType
mitk::ScalarType TimePointType