Difference between revisions of "Documentation/4.1/Developers/DisplayableManagers"
From Slicer Wiki
(Prepend documentation/versioncheck template. See http://na-mic.org/Mantis/view.php?id=2887) |
|||
Line 1: | Line 1: | ||
+ | <noinclude>{{documentation/versioncheck}}</noinclude> | ||
=Displayable Managers= | =Displayable Managers= | ||
To be written. | To be written. |
Latest revision as of 07:25, 14 June 2013
Home < Documentation < 4.1 < Developers < DisplayableManagers
For the latest Slicer documentation, visit the read-the-docs. |
Displayable Managers
To be written.
Build
Displayable managers are instantiated from their class name by the displayable manager groups. An instantiator must be included in the library containing the displayable manager. To do so, add in your CMakeLists.txt:
set(displayable_manager_SRCS vtkMRMXYZDisplayableManager.cxx ) set(VTK_USE_INSTANTIATOR_NEW 1) VTK_MAKE_INSTANTIATOR3("${MODULE_NAME}Instantiator" displayable_manager_instantiator_SRCS "${displayable_manager_SRCS}" "${${KIT}_EXPORT_DIRECTIVE}" ${CMAKE_CURRENT_BINARY_DIR} "${KIT}Export.h" ) set(${KIT}_SRCS ${displayable_manager_instantiator_SRCS} ${displayable_manager_SRCS} ... )
Register
Displayable managers must be registered as early as possible (before the first view is created. Therefore, displayable managers should be registered when modules are setup.
void qSlicerXYZModule::setup() { ... // If the displayable manager is for 3D views: vtkMRMLThreeDViewDisplayableManagerFactory::GetInstance()->RegisterDisplayableManager( "vtkMRMLXYZDisplayableManager"); // If the displayable manager is for 2D views: vtkMRMLSliceViewDisplayableManagerFactory::GetInstance()->RegisterDisplayableManager( "vtkMRMLXYZDisplayableManager"); ... }
How a view is refreshed
It's the 3D view (ctkVTKAbstractView) that controls WHEN the vtkRenderWindow::Render is called. There are 2 ways to tell the view to re-render:
vtkRenderWindowInteractor::Render()
is called (byvtkInteractorStyle
when the mouse is moved or by some vtkWidgets that call it internally). The request is blocked andctkAbstractView::scheduleRender()
is called on the view.- or it is done by the
vtkMRMLDisplayableManager
s (e.g.vtkMRMLVolumeRenderingDisplayableManager
) by the RequestRender() calls. They call vtkMRMLDisplayableManagerGroup::RequestRender() which fires a vtkCommand::UpdateEvent. The Qt view (e.g.qMRMLThreeDView
) observes theUpdateEvent
and callsctkVTKAbstractView::scheduleRender()
.
The CTK view compacts the render requests and ensure the FPS (vtkRenderWindow::GetDesiredUpdateRate()
) is respected.
vtkInteractorStyle ---------------------------\ vtkWidget -------------------------------------> vtkRenderWindowInteractor::Render() ------------------------------\ vtkMRML???DisplayableManager::RequestRender() -> vtkMRML???DisplayableManagerGroup::RequestRender() -> UpdateEvent -> ctkVTKAbstractView::scheduleRender()