Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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 MAPPER_H_HEADER_INCLUDED_C1E6EA08
14 #define MAPPER_H_HEADER_INCLUDED_C1E6EA08
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 // Just included to get VTK version
27 #include <vtkConfigure.h>
28 
29 class vtkWindow;
30 class vtkProp;
31 
32 namespace mitk
33 {
34  class BaseRenderer;
35  class BaseData;
36  class DataNode;
37 
49  class MITKCORE_EXPORT Mapper : public itk::Object
50  {
51  public:
53 
55  itkSetObjectMacro(DataNode, DataNode);
56 
60  virtual DataNode *GetDataNode() const;
61 
68  DEPRECATED(BaseData *GetData() const);
69 
75  DEPRECATED(virtual bool GetColor(float rgb[3], BaseRenderer *renderer, const char *name = "color") const);
76 
83  DEPRECATED(virtual bool GetVisibility(bool &visible, BaseRenderer *renderer, const char *name = "visible") const);
84 
90  DEPRECATED(virtual bool GetOpacity(float &opacity, BaseRenderer *renderer, const char *name = "opacity") const);
91 
97  DEPRECATED(virtual bool GetLevelWindow(LevelWindow &levelWindow,
98  BaseRenderer *renderer,
99  const char *name = "levelwindow") const);
100 
111  DEPRECATED(virtual bool IsVisible(BaseRenderer *renderer, const char *name = "visible") const);
112 
116  virtual bool IsVtkBased() const { return true; }
117 
121  virtual void Update(BaseRenderer *renderer);
122 
126  virtual void MitkRender(mitk::BaseRenderer *renderer, mitk::VtkPropRenderer::RenderType type) = 0;
127 
134  virtual void ApplyColorAndOpacityProperties(mitk::BaseRenderer *renderer, vtkActor *actor = nullptr) = 0;
135 
144  static void SetDefaultProperties(DataNode *node, BaseRenderer *renderer = nullptr, bool overwrite = false);
145 
147  int GetTimestep() const { return m_TimeStep; }
151  virtual bool IsLODEnabled(BaseRenderer * /*renderer*/) const { return false; }
152  protected:
154  explicit Mapper();
155 
157  ~Mapper() override;
158 
162  DEPRECATED(virtual void GenerateData()) {}
164  virtual void GenerateDataForRenderer(BaseRenderer * /* renderer */) {}
166  virtual void CalculateTimeStep(BaseRenderer *renderer);
167 
174  virtual void ResetMapper(BaseRenderer * /*renderer*/) {}
176 
177  private:
182  int m_TimeStep;
183 
185  Mapper(const Mapper &);
186 
188  Mapper &operator=(const Mapper &);
189 
190  public:
194  {
195  public:
196  BaseLocalStorage() = default;
197  virtual ~BaseLocalStorage() = default;
198 
199  BaseLocalStorage(const BaseLocalStorage &) = delete;
200  BaseLocalStorage & operator=(const BaseLocalStorage &) = delete;
201 
202  bool IsGenerateDataRequired(mitk::BaseRenderer *renderer, mitk::Mapper *mapper, mitk::DataNode *dataNode) const;
203 
204  inline void UpdateGenerateDataTime() { m_LastGenerateDataTime.Modified(); }
205  inline itk::TimeStamp &GetLastGenerateDataTime() { return m_LastGenerateDataTime; }
206  protected:
208  itk::TimeStamp m_LastGenerateDataTime;
209  };
210  };
211 
212 } // namespace mitk
213 
214 #endif /* MAPPER_H_HEADER_INCLUDED_C1E6EA08 */
Base class for mapper specific rendering ressources.
Definition: mitkMapper.h:193
#define MITKCORE_EXPORT
Base of all data objects.
Definition: mitkBaseData.h:37
Organizes the rendering process.
static void Update(vtkPolyData *)
Definition: mitkSurface.cpp:31
DataCollection - Class to facilitate loading/accessing structured data.
virtual bool IsVtkBased() const
Returns whether this is an vtk-based mapper.
Definition: mitkMapper.h:116
Base class of all mappers, Vtk as well as OpenGL mappers.
Definition: mitkMapper.h:49
itk::TimeStamp m_LastGenerateDataTime
timestamp of last update of stored data
Definition: mitkMapper.h:208
#define DEPRECATED(func)
Definition: mitkCommon.h:179
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:162
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:49
mitk::DataNode * m_DataNode
Definition: mitkMapper.h:175
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:174
virtual void GenerateDataForRenderer(BaseRenderer *)
Generate the data needed for rendering into renderer.
Definition: mitkMapper.h:164
itk::TimeStamp & GetLastGenerateDataTime()
Definition: mitkMapper.h:205
virtual bool IsLODEnabled(BaseRenderer *) const
Definition: mitkMapper.h:151
int GetTimestep() const
Returns the current time step as calculated from the renderer.
Definition: mitkMapper.h:147
Class for nodes of the DataTree.
Definition: mitkDataNode.h:64