Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkROIMapperHelper.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 mitkROIMapperHelper_h
14 #define mitkROIMapperHelper_h
15 
16 #include <mitkBaseRenderer.h>
17 #include <mitkROI.h>
18 
19 #include <vtkCaptionActor2D.h>
20 #include <vtkProperty.h>
21 #include <vtkSmartPointer.h>
22 
23 namespace mitk
24 {
34  namespace ROIMapperHelper
35  {
46  void ApplyIndividualProperties(const ROI::Element& roi, TimeStepType t, vtkActor* actor);
47 
62  vtkSmartPointer<vtkCaptionActor2D> CreateCaptionActor(const std::string& caption, const Point3D& attachmentPoint, vtkProperty* property, const DataNode* dataNode, const BaseRenderer* renderer);
63 
79  std::string ParseCaption(const std::string& captionTemplate, const ROI::Element& roi, TimeStepType t = 0);
80 
91  void SetDefaultProperties(DataNode* node, BaseRenderer* renderer, bool override);
92 
105  template <class T>
106  const T* GetConstProperty(const std::string& propertyKey, const ROI::Element& roi, TimeStepType t)
107  {
108  auto property = roi.GetConstProperty(propertyKey, t);
109 
110  if (property.IsNotNull())
111  return dynamic_cast<const T*>(property.GetPointer());
112 
113  return nullptr;
114  }
115  }
116 }
117 
118 #endif
Organizes the rendering process.
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72
Encapsulates a single (possibly time-resolved) ROI.
Definition: mitkROI.h:66
BaseProperty::ConstPointer GetConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
Get a const property by key and optional context.
void ApplyIndividualProperties(const ROI::Element &roi, TimeStepType t, vtkActor *actor)
Apply individual ROI properties at a certain time step to the given actor.
const T * GetConstProperty(const std::string &propertyKey, const ROI::Element &roi, TimeStepType t)
Retrieve a typed const property from an ROI element.
std::string ParseCaption(const std::string &captionTemplate, const ROI::Element &roi, TimeStepType t=0)
Substitute all placeholders in a caption template with corresponding property values.
void SetDefaultProperties(DataNode *node, BaseRenderer *renderer, bool override)
Set common default properties for both 2D and 3D ROI mappers.
vtkSmartPointer< vtkCaptionActor2D > CreateCaptionActor(const std::string &caption, const Point3D &attachmentPoint, vtkProperty *property, const DataNode *dataNode, const BaseRenderer *renderer)
Create a VTK caption actor for an ROI label.
Find image slices visible on a given plane.
std::size_t TimeStepType
Type for time step indices (non-negative integers starting from 0).