Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLLayerDMPipelineManager.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Program: 3D Slicer
4
5 Copyright (c) Kitware SAS
6
7 See COPYRIGHT.txt
8 or http://www.slicer.org/copyright/copyright.txt for details.
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 This file was originally developed by Thibault Pelletier, Kitware SAS,
17 and was partially funded by ANR grants ANR-22-CE45-0034 and ANR-18-RHUS-005.
18
19==============================================================================*/
20
21#ifndef __vtkMRMLLayerDMPipelineManager_h
22#define __vtkMRMLLayerDMPipelineManager_h
23
24#include "vtkSlicerLayerDMModuleMRMLDisplayableManagerExport.h"
25
26// VTK includes
27#include <vtkCommand.h>
28#include <vtkObject.h>
29#include <vtkSmartPointer.h>
30#include <vtkWeakPointer.h>
31
32// STL includes
33#include <functional>
34#include <map>
35
36class vtkCamera;
47class vtkMRMLNode;
48class vtkMRMLScene;
49class vtkRenderWindow;
50class vtkRenderer;
51
56class VTK_SLICER_LAYERDM_MODULE_MRMLDISPLAYABLEMANAGER_EXPORT vtkMRMLLayerDMPipelineManager : public vtkObject
57{
58public:
60 vtkTypeMacro(vtkMRMLLayerDMPipelineManager, vtkObject);
61 void PrintSelf(ostream& os, vtkIndent indent) override;
62
66 bool AddNode(vtkMRMLNode* node);
67
69 bool CanProcessInteractionEvent(vtkMRMLInteractionEventData* eventData, double& distance2) const;
70
74
77 vtkCamera* GetDefaultCamera() const;
78
82
84 int GetMouseCursor() const;
85
87 vtkSmartPointer<vtkMRMLLayerDMPipeline> GetNodePipeline(vtkMRMLNode* node) const;
88
91
97
100 void LoseFocus() const;
103
106
110 bool RemovePipeline(vtkMRMLNode* displayNode);
112
115
119
122 void SetFactory(const vtkSmartPointer<vtkMRMLLayerDMPipelineFactory>& factory);
123
125 void SetRenderWindow(vtkRenderWindow* renderWindow);
126
128 void SetRenderer(vtkRenderer* renderer) const;
129
131 void SetRequestRender(const std::function<void()>& requestRender);
132
134 void SetScene(vtkMRMLScene* scene);
135
138
142
147
153 bool BlockRequestRender(bool isBlocked);
154
155protected:
158
159private:
161 void OnDefaultCameraModified();
162
164 void UpdatePipeline(const vtkSmartPointer<vtkMRMLLayerDMPipeline>& pipeline) const;
165
169 void RemoveOutdatedPipelines();
170
172 void AddMissingPipelines();
173
176 bool IsPipelineCreatorOutdated(vtkMRMLNode* node) const;
177
178 vtkSmartPointer<vtkMRMLLayerDMPipelineFactory> Factory;
179 vtkSmartPointer<vtkMRMLLayerDMLayerManager> LayerManager;
180 vtkSmartPointer<vtkMRMLLayerDMCameraSynchronizer> CameraSynchronizer;
181 vtkSmartPointer<vtkMRMLLayerDMInteractionLogic> InteractionLogic;
182 vtkSmartPointer<vtkMRMLLayerDMObjectEventObserver> EventObserver;
183 vtkSmartPointer<vtkCamera> DefaultCamera;
184 vtkSmartPointer<vtkMRMLLayerDMNodeReferenceObserver> NodeReferenceObserver;
185
186 vtkWeakPointer<vtkMRMLAbstractViewNode> ViewNode;
187 vtkWeakPointer<vtkMRMLScene> Scene;
188 vtkWeakPointer<vtkRenderWindow> RenderWindow;
189
190 std::map<vtkMRMLNode*, vtkSmartPointer<vtkMRMLLayerDMPipeline>> PipelineMap;
191 std::map<vtkMRMLNode*, vtkWeakPointer<vtkMRMLLayerDMPipelineCreator>> PipelineCreatorMap;
192 std::function<void()> RequestRenderCallback;
193
194 bool IsRequestRenderBlocked{ false };
195};
196
197#endif
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D,...
Class responsible for synchronizing the camera of the different display layers. If a pipeline doesn't...
Pipeline manager interaction logic class.
Responsible for adding and removing renderer layers to a vtkRenderWindow depending on the display pip...
VTK object observer with one callback endpoint when an event is triggered. Can observe multiple objec...
Interface responsible for creating new pipelines given input pairs of viewNode and node.
Class responsible for creating new pipelines given input viewNode and Node pairs.
bool CreatePipelineForNode(vtkMRMLNode *displayNode)
void SetFactory(const vtkSmartPointer< vtkMRMLLayerDMPipelineFactory > &factory)
int GetNumberOfPipelines() const
Returns the number of pipelines currently managed by the pipeline manager.
void RequestRender()
Reset camera clipping range and call display manager request render.
void ResetCameraClippingRange() const
void LoseFocus(vtkMRMLInteractionEventData *eventData) const
bool ProcessInteractionEvent(vtkMRMLInteractionEventData *eventData) const
Delegates process interaction event to.
int GetMouseCursor() const
Returns the mouse cursor from the latest pipeline having handled the latest interaction.
void PrintSelf(ostream &os, vtkIndent indent) override
void SetViewNode(vtkMRMLAbstractViewNode *viewNode)
Set the view node (initialization).
bool RemovePipeline(vtkMRMLNode *displayNode)
bool BlockRequestRender(bool isBlocked)
void SetRequestRender(const std::function< void()> &requestRender)
Set the request render callback used during.
static vtkMRMLLayerDMPipelineManager * New()
~vtkMRMLLayerDMPipelineManager() override
void SetRenderWindow(vtkRenderWindow *renderWindow)
Set the render window on which the pipeline manager is attached (initialization).
bool AddNode(vtkMRMLNode *node)
vtkMRMLLayerDMPipeline * GetNthPipeline(int iPipeline) const
bool CanProcessInteractionEvent(vtkMRMLInteractionEventData *eventData, double &distance2) const
Delegates can process interaction event to.
void SetRenderer(vtkRenderer *renderer) const
Set the default renderer used by the display manager (initialization).
vtkCamera * GetDefaultCamera() const
void SetScene(vtkMRMLScene *scene)
Set the scene (initialization).
bool RemoveNode(vtkMRMLNode *node)
vtkSmartPointer< vtkMRMLLayerDMPipeline > GetNodePipeline(vtkMRMLNode *node) const
Returns the pipeline associated with the input display node if any.
Interface for the layered displayable manager pipelines.
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.