Medical Imaging Interaction Toolkit  2024.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 {
25  namespace ROIMapperHelper
26  {
29  void ApplyIndividualProperties(const ROI::Element& roi, TimeStepType t, vtkActor* actor);
30 
33  vtkSmartPointer<vtkCaptionActor2D> CreateCaptionActor(const std::string& caption, const Point3D& attachmentPoint, vtkProperty* property, const DataNode* dataNode, const BaseRenderer* renderer);
34 
39  std::string ParseCaption(const std::string& captionTemplate, const ROI::Element& roi, TimeStepType t = 0);
40 
43  void SetDefaultProperties(DataNode* node, BaseRenderer* renderer, bool override);
44 
47  template <class T>
48  const T* GetConstProperty(const std::string& propertyKey, const ROI::Element& roi, TimeStepType t)
49  {
50  auto property = roi.GetConstProperty(propertyKey, t);
51 
52  if (property.IsNotNull())
53  return dynamic_cast<const T*>(property.GetPointer());
54 
55  return nullptr;
56  }
57  }
58 }
59 
60 #endif
vtkSmartPointer
Definition: mitkROIMapperLocalStorage.h:19
mitk::ROIMapperHelper::CreateCaptionActor
vtkSmartPointer< vtkCaptionActor2D > CreateCaptionActor(const std::string &caption, const Point3D &attachmentPoint, vtkProperty *property, const DataNode *dataNode, const BaseRenderer *renderer)
Create an actor for the ROI caption located at a certain attachment point considering several propert...
mitk::ROIMapperHelper::ApplyIndividualProperties
void ApplyIndividualProperties(const ROI::Element &roi, TimeStepType t, vtkActor *actor)
Apply ROI properties at a certain time step to the given actor.
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::Point< ScalarType, 3 >
mitkROI.h
mitk::TimeStepType
std::size_t TimeStepType
Definition: mitkTimeGeometry.h:27
mitk::ROIMapperHelper::GetConstProperty
const T * GetConstProperty(const std::string &propertyKey, const ROI::Element &roi, TimeStepType t)
Syntactic sugar for getting ROI properties.
Definition: mitkROIMapperHelper.h:48
mitk::BaseRenderer
Definition: mitkBaseRenderer.h:56
mitk::ROI::Element::GetConstProperty
BaseProperty::ConstPointer GetConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
Get a const property.
mitk::ROIMapperHelper::ParseCaption
std::string ParseCaption(const std::string &captionTemplate, const ROI::Element &roi, TimeStepType t=0)
Substitute all placeholders in a caption with corresponding property values.
mitkBaseRenderer.h
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitk::ROI::Element
Encapsulates a single (possibly time-resolved) ROI.
Definition: mitkROI.h:65
mitk::ROIMapperHelper::SetDefaultProperties
void SetDefaultProperties(DataNode *node, BaseRenderer *renderer, bool override)
Set common default properties for both 2-d and 3-d ROI mappers.