Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
mitkMapper.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 mitkMapper_h
14 #define mitkMapper_h
15 
16 #include "mitkBaseRenderer.h"
17 #include "mitkCommon.h"
18 #include "mitkLevelWindow.h"
20 #include "mitkVtkPropRenderer.h"
21 #include <MitkCoreExports.h>
22 
23 #include <itkObject.h>
24 #include <itkWeakPointer.h>
25 
26 class vtkWindow;
27 class vtkProp;
28 
29 namespace mitk
30 {
31  class BaseRenderer;
32  class BaseData;
33  class DataNode;
34 
46  class MITKCORE_EXPORT Mapper : public itk::Object
47  {
48  public:
50 
52  itkSetObjectMacro(DataNode, DataNode);
53 
57  virtual DataNode *GetDataNode() const;
58 
65  DEPRECATED(BaseData *GetData() const);
66 
72  DEPRECATED(virtual bool GetColor(float rgb[3], BaseRenderer *renderer, const char *name = "color") const);
73 
80  DEPRECATED(virtual bool GetVisibility(bool &visible, BaseRenderer *renderer, const char *name = "visible") const);
81 
87  DEPRECATED(virtual bool GetOpacity(float &opacity, BaseRenderer *renderer, const char *name = "opacity") const);
88 
94  DEPRECATED(virtual bool GetLevelWindow(LevelWindow &levelWindow,
95  BaseRenderer *renderer,
96  const char *name = "levelwindow") const);
97 
108  DEPRECATED(virtual bool IsVisible(BaseRenderer *renderer, const char *name = "visible") const);
109 
113  virtual bool IsVtkBased() const { return true; }
114 
118  virtual void Update(BaseRenderer *renderer);
119 
123  virtual void MitkRender(mitk::BaseRenderer *renderer, mitk::VtkPropRenderer::RenderType type) = 0;
124 
131  virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer *renderer, vtkActor *actor = nullptr) = 0;
132 
141  static void SetDefaultProperties(DataNode *node, BaseRenderer *renderer = nullptr, bool overwrite = false);
142 
144  TimeStepType GetTimestep() const { return m_TimeStep; }
148  virtual bool IsLODEnabled(BaseRenderer * /*renderer*/) const { return false; }
149  protected:
151  explicit Mapper();
152 
154  ~Mapper() override;
155 
159  DEPRECATED(virtual void GenerateData()) {}
161  virtual void GenerateDataForRenderer(BaseRenderer * /* renderer */) {}
163  virtual void CalculateTimeStep(BaseRenderer *renderer);
164 
171  virtual void ResetMapper(BaseRenderer * /*renderer*/) {}
173 
174  private:
179  TimeStepType m_TimeStep;
180 
182  Mapper(const Mapper &);
183 
185  Mapper &operator=(const Mapper &);
186 
187  public:
191  {
192  public:
193  BaseLocalStorage() = default;
194  virtual ~BaseLocalStorage() = default;
195 
196  BaseLocalStorage(const BaseLocalStorage &) = delete;
197  BaseLocalStorage & operator=(const BaseLocalStorage &) = delete;
198 
199  bool IsGenerateDataRequired(mitk::BaseRenderer *renderer, mitk::Mapper *mapper, mitk::DataNode *dataNode) const;
200 
201  inline void UpdateGenerateDataTime() { m_LastGenerateDataTime.Modified(); }
202  inline itk::TimeStamp &GetLastGenerateDataTime() { return m_LastGenerateDataTime; }
203  protected:
205  itk::TimeStamp m_LastGenerateDataTime;
206  };
207  };
208 
209 } // namespace mitk
210 
211 #endif
mitk::Mapper::BaseLocalStorage::GetLastGenerateDataTime
itk::TimeStamp & GetLastGenerateDataTime()
Definition: mitkMapper.h:202
mitkLocalStorageHandler.h
mitk::VtkPropRenderer::RenderType
RenderType
Definition: mitkVtkPropRenderer.h:71
mitkVtkPropRenderer.h
DEPRECATED
#define DEPRECATED(func)
Definition: mitkCommon.h:175
mitk::Mapper::GetTimestep
TimeStepType GetTimestep() const
Returns the current time step as calculated from the renderer.
Definition: mitkMapper.h:144
mitk::Mapper::GenerateData
virtual void GenerateData()
Generate the data needed for rendering (independent of a specific renderer)
Definition: mitkMapper.h:159
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk::Mapper::ResetMapper
virtual void ResetMapper(BaseRenderer *)
Reset the mapper (i.e., make sure that nothing is displayed) if no valid data is present....
Definition: mitkMapper.h:171
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::Mapper::BaseLocalStorage::m_LastGenerateDataTime
itk::TimeStamp m_LastGenerateDataTime
timestamp of last update of stored data
Definition: mitkMapper.h:205
mitk::LevelWindow
The LevelWindow class Class to store level/window values.
Definition: mitkLevelWindow.h:45
MitkCoreExports.h
mitk::Mapper
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:46
mitk::Mapper::GenerateDataForRenderer
virtual void GenerateDataForRenderer(BaseRenderer *)
Generate the data needed for rendering into renderer.
Definition: mitkMapper.h:161
mitk::Mapper::BaseLocalStorage
Base class for mapper specific rendering resources.
Definition: mitkMapper.h:190
mitkCommon.h
mitk::Mapper::BaseLocalStorage::UpdateGenerateDataTime
void UpdateGenerateDataTime()
Definition: mitkMapper.h:201
mitk::BaseData
Base of all data objects.
Definition: mitkBaseData.h:42
mitk::TimeStepType
std::size_t TimeStepType
Definition: mitkTimeGeometry.h:27
mitkLevelWindow.h
mitk::BaseRenderer
Definition: mitkBaseRenderer.h:56
mitk::Mapper::IsLODEnabled
virtual bool IsLODEnabled(BaseRenderer *) const
Definition: mitkMapper.h:148
mitk::Mapper::m_DataNode
mitk::DataNode * m_DataNode
Definition: mitkMapper.h:172
mitk::Mapper::IsVtkBased
virtual bool IsVtkBased() const
Returns whether this is an vtk-based mapper.
Definition: mitkMapper.h:113
mitkBaseRenderer.h
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitk::ROIMapperHelper::SetDefaultProperties
void SetDefaultProperties(DataNode *node, BaseRenderer *renderer, bool override)
Set common default properties for both 2-d and 3-d ROI mappers.