Refactoring of Mapper Architecture

From mitk.org
Revision as of 02:00, 1 January 1970 by (username removed)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Migration guide: Refactoring of the mapper architecture

The general description of the rendering pipeline and the integration of MITK into the VTK rendering concept can be found here http://docs.mitk.org/nightly-qt4/QVTKRendering.html . MITK supports both VTK and OpenGL rendering. VTK forms an abstract layer above the graphics language (e.g. OpenGL) and ensures cross-platform portability. By the help of mappers, the input data is transformed to tangible primitives, such as surfaces, points, lines, etc. Mitk::Mapper is the base class of all mappers, both Vtk as well as OpenGL mappers. Subclasses of mitk::Mapper control the creation of rendering primitives that interface to the graphics library (e.g., OpenGL, VTK). The interface which manages OpenGL and VTK rendering is the mitk::VtkPropRenderer. Its methods check which mapper wants to render and which mapper has been rendered last. The OpenGL context is modified accordingly.

Applied Changes

 The base architecture of the mapper super classes has been refactored in order to simplify the existing class structure. There is no further differentiation between 2D and 3D mappers in the mitk::Mapper subclasses, since they have never encapsulated common functionalities.
The following issues have to be dealt with:
  1. Introduction of new classes mitk::VtkMapper and mitk::GLMapper. The classes mitk::Mapper2D, mitk::Mapper3D are removed and the classes mitk::VtkMapper2D, mitk::VtkMapper3D and mitkGLMapper2D are marked as deprecated.
  2. MitkRenderOpaqueGeometry(), MitkRenderTranslucentGeometry(), MitkRenderVolumetricGeometry(), MitkRenderOverlay() are part of the new base class mitk::VtkMapper. They can be inherited in the subclasses of VtkMapper and do not need to be individually reimplemented any longer in each (Vtk)mapper. In the GLMappers, those functions are not needed any longer since their only purpose was to call the Paint() function. Instead, a common function MitkRender() is used.
  3. The following functions of class mitk::Mapper are only convenience functions and thus marked as deprecated:
 -          BaseData* GetData() const;
 -          virtual bool GetColor(float rgb[3], BaseRenderer* renderer, const char* name = "color") const;
 -          virtual bool GetVisibility(bool &visible, BaseRenderer* renderer, const char* name = "visible") const;
 -          virtual bool GetOpacity(float &opacity, BaseRenderer* renderer, const char* name = "opacity") const;
 -          virtual bool GetLevelWindow(LevelWindow &levelWindow, BaseRenderer* renderer, const char* name = "levelwindow") const;
 -          virtual bool IsVisible(BaseRenderer* renderer, const char* name = "visible") const;
 -          virtual bool IsVtkBased() const = 0;
  1. GenerateData() is marked as deprecated. Usage of this method will throw a warning.
  2. ApplyProperties() has been renamed to ApplyColorAndOpacityProperties ()
 For temporary backward compatibility, the outdated methods are still available in the interface of mitk::Mapper, but are marked as deprecated. After one whole release cycle those methods will be deleted.