Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef MAPPER_H_HEADER_INCLUDED_C1E6EA08
18 #define MAPPER_H_HEADER_INCLUDED_C1E6EA08
19 
20 #include "mitkBaseRenderer.h"
21 #include "mitkCommon.h"
22 #include "mitkLevelWindow.h"
24 #include "mitkVtkPropRenderer.h"
25 #include <MitkCoreExports.h>
26 
27 #include <itkObject.h>
28 #include <itkWeakPointer.h>
29 
30 // Just included to get VTK version
31 #include <vtkConfigure.h>
32 
33 class vtkWindow;
34 class vtkProp;
35 
36 namespace mitk
37 {
38  class BaseRenderer;
39  class BaseData;
40  class DataNode;
41  class OverlayManager;
42 
54  class MITKCORE_EXPORT Mapper : public itk::Object
55  {
56  public:
58 
60  itkSetObjectMacro(DataNode, DataNode);
61 
65  virtual DataNode *GetDataNode() const;
66 
73  DEPRECATED(BaseData *GetData() const);
74 
80  DEPRECATED(virtual bool GetColor(float rgb[3], BaseRenderer *renderer, const char *name = "color") const);
81 
88  DEPRECATED(virtual bool GetVisibility(bool &visible, BaseRenderer *renderer, const char *name = "visible") const);
89 
95  DEPRECATED(virtual bool GetOpacity(float &opacity, BaseRenderer *renderer, const char *name = "opacity") const);
96 
102  DEPRECATED(virtual bool GetLevelWindow(LevelWindow &levelWindow,
103  BaseRenderer *renderer,
104  const char *name = "levelwindow") const);
105 
116  DEPRECATED(virtual bool IsVisible(BaseRenderer *renderer, const char *name = "visible") const);
117 
121  virtual bool IsVtkBased() const = 0;
122 
126  virtual void Update(BaseRenderer *renderer);
127 
131  virtual void MitkRender(mitk::BaseRenderer *renderer, mitk::VtkPropRenderer::RenderType type) = 0;
132 
139  virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer *renderer, vtkActor *actor = nullptr) = 0;
140 
149  static void SetDefaultProperties(DataNode *node, BaseRenderer *renderer = nullptr, bool overwrite = false);
150 
152  int GetTimestep() const { return m_TimeStep; }
156  virtual bool IsLODEnabled(BaseRenderer * /*renderer*/) const { return false; }
157  protected:
159  explicit Mapper();
160 
162  virtual ~Mapper();
163 
167  DEPRECATED(virtual void GenerateData()) {}
169  virtual void GenerateDataForRenderer(BaseRenderer * /* renderer */) {}
171  virtual void CalculateTimeStep(BaseRenderer *renderer);
172 
179  virtual void ResetMapper(BaseRenderer * /*renderer*/) {}
180  virtual OverlayManager *GetOverlayManager() const;
181 
183 
184  private:
189  int m_TimeStep;
190 
192  Mapper(const Mapper &);
193 
195  Mapper &operator=(const Mapper &);
196 
197  public:
201  {
202  public:
203  bool IsGenerateDataRequired(mitk::BaseRenderer *renderer, mitk::Mapper *mapper, mitk::DataNode *dataNode) const;
204 
205  inline void UpdateGenerateDataTime() { m_LastGenerateDataTime.Modified(); }
206  inline itk::TimeStamp &GetLastGenerateDataTime() { return m_LastGenerateDataTime; }
207  protected:
209  itk::TimeStamp m_LastGenerateDataTime;
210  };
211  };
212 
213 } // namespace mitk
214 
215 #endif /* MAPPER_H_HEADER_INCLUDED_C1E6EA08 */
Base class for mapper specific rendering ressources.
Definition: mitkMapper.h:200
#define MITKCORE_EXPORT
Base of all data objects.
Definition: mitkBaseData.h:39
Organizes the rendering process.
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:35
DataCollection - Class to facilitate loading/accessing structured data.
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:54
int GetTimestep() const
Returns the current time step as calculated from the renderer.
Definition: mitkMapper.h:152
itk::TimeStamp m_LastGenerateDataTime
timestamp of last update of stored data
Definition: mitkMapper.h:209
#define DEPRECATED(func)
Definition: mitkCommon.h:183
T::Pointer GetData(const std::string &name)
The LevelWindow class Class to store level/window values.
virtual void GenerateData()
Generate the data needed for rendering (independent of a specific renderer)
Definition: mitkMapper.h:167
virtual bool IsLODEnabled(BaseRenderer *) const
Definition: mitkMapper.h:156
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
mitk::DataNode * m_DataNode
Definition: mitkMapper.h:182
virtual void ResetMapper(BaseRenderer *)
Reset the mapper (i.e., make sure that nothing is displayed) if no valid data is present. In most cases the reimplemented function disables the according actors (toggling visibility off)
Definition: mitkMapper.h:179
virtual void GenerateDataForRenderer(BaseRenderer *)
Generate the data needed for rendering into renderer.
Definition: mitkMapper.h:169
itk::TimeStamp & GetLastGenerateDataTime()
Definition: mitkMapper.h:206
The OverlayManager updates and manages Overlays and the respective Layouters.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66