Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkCrosshairVtkMapper2D.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 mitkCrosshairVtkMapper2D_h
14 #define mitkCrosshairVtkMapper2D_h
15 
16 #include <MitkCoreExports.h>
17 
18 #include <mitkBaseRenderer.h>
19 #include <mitkCrosshairData.h>
20 #include <mitkVtkMapper.h>
21 
22 #include <vtkSmartPointer.h>
23 
24 class vtkActor2D;
25 class vtkCellArray;
26 class vtkPropAssembly;
27 class vtkPolyDataMapper2D;
28 
29 namespace mitk
30 {
44  {
45  public:
46 
48  itkFactorylessNewMacro(Self);
49 
55  const CrosshairData* GetInput() const;
56 
65  void Update(mitk::BaseRenderer* renderer) override;
66 
73  vtkProp* GetVtkProp(BaseRenderer* renderer) override;
74 
84  static void SetDefaultProperties(DataNode* node, BaseRenderer* renderer = nullptr, bool overwrite = false);
85 
86  protected:
87 
90 
93 
98  {
99  public:
100 
103 
105  ~LocalStorage() override;
106 
110  };
111 
114 
120  void GenerateDataForRenderer(BaseRenderer *renderer) override;
121 
131 
140  void DrawLine(Point3D p0, Point3D p1, vtkCellArray* lines, vtkPoints* points);
141 
148 
155  void ApplyColorAndOpacityProperties2D(BaseRenderer* renderer, vtkActor2D* actor);
156 
157  const int defaultGapSize;
158  };
159 
160 }
161 
162 #endif
#define MITKCORE_EXPORT
Organizes the rendering process.
Data class that stores the 3D position for a crosshair.
Internal class holding the mapper, actor, etc. for each of the 2D render windows.
vtkSmartPointer< vtkPolyDataMapper2D > m_Mapper
The poly data mapper.
vtkSmartPointer< vtkActor2D > m_CrosshairActor
The crosshair line actor.
LocalStorage()
Constructor. Creates the VTK actor, mapper, and assembly.
vtkSmartPointer< vtkPropAssembly > m_CrosshairAssembly
The prop assembly grouping actors.
VTK-based 2D mapper for rendering a crosshair.
void ApplyColorAndOpacityProperties2D(BaseRenderer *renderer, vtkActor2D *actor)
Apply color and opacity properties to a 2D actor.
LocalStorageHandler< LocalStorage > m_LSH
The LocalStorageHandler holds all LocalStorages for the 2D render windows.
const int defaultGapSize
The default gap size in pixels for the crosshair center.
void Update(mitk::BaseRenderer *renderer) override
Check whether this mapper needs to update itself and generate data.
void GenerateDataForRenderer(BaseRenderer *renderer) override
Apply color and opacity properties and create the VTK crosshair geometry.
mitkClassMacro(CrosshairVtkMapper2D, VtkMapper)
void DrawLine(Point3D p0, Point3D p1, vtkCellArray *lines, vtkPoints *points)
Draw a line between two 3D points and add it to the given VTK structures.
~CrosshairVtkMapper2D() override
Destructor.
void CreateVtkCrosshair(BaseRenderer *renderer)
Create the VTK crosshair poly data for the given renderer.
static void SetDefaultProperties(DataNode *node, BaseRenderer *renderer=nullptr, bool overwrite=false)
Set default properties for the crosshair data node.
vtkProp * GetVtkProp(BaseRenderer *renderer) override
Get the VTK prop assembly for the given renderer.
void ApplyAllProperties(BaseRenderer *renderer)
Apply all visual properties (color, opacity, line width) to the crosshair actor.
CrosshairVtkMapper2D()
Constructor. Initializes the default gap size.
const CrosshairData * GetInput() const
Get the input CrosshairData from the data node.
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72
Base class for mapper-specific rendering resources.
Definition: mitkMapper.h:181
Base class of all VTK-based Mappers for displaying primitives using VTK functionality.
Definition: mitkVtkMapper.h:53
Find image slices visible on a given plane.