Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLLayerDMPipeline.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 __vtkMRMLLayerDMPipeline_h
22#define __vtkMRMLLayerDMPipeline_h
23
24#include "vtkSlicerLayerDMModuleMRMLDisplayableManagerExport.h"
25
26// Slicer includes
28
29// VTK includes
30#include <vtkCommand.h>
31#include <vtkObject.h>
32
33class vtkCamera;
38class vtkMRMLNode;
39class vtkMRMLScene;
41class vtkRenderer;
42
53class VTK_SLICER_LAYERDM_MODULE_MRMLDISPLAYABLEMANAGER_EXPORT vtkMRMLLayerDMPipeline : public vtkObject
54{
55public:
57 vtkTypeMacro(vtkMRMLLayerDMPipeline, vtkObject);
58 void PrintSelf(ostream& os, vtkIndent indent) override;
59
60 enum Events
61 {
64 RenderGroupingModified = vtkCommand::UserEvent + 1
65 };
66
71 virtual bool CanProcessInteractionEvent(vtkMRMLInteractionEventData* eventData, double& distance2);
72
78 virtual vtkCamera* GetCustomCamera() const;
79 virtual vtkCamera* GetCustomCamera(unsigned int renderOrder) const;
80
83 virtual int GetMouseCursor() const;
84
92 virtual unsigned int GetRenderOrder() const;
93
96 virtual std::vector<unsigned int> GetRenderOrders() const;
97
99 unsigned int GetMaxRenderOrder() const;
100
103 unsigned int GetVtkRendererOrder(const vtkRenderer* renderer) const;
104
107 virtual int GetWidgetState() const;
108
112 virtual void LoseFocus(vtkMRMLInteractionEventData* eventData);
113
116 virtual void OnDefaultCameraModified(vtkCamera* camera);
117
121 virtual void OnReferenceToDisplayNodeAdded(vtkMRMLNode* fromNode, const std::string& role);
122 virtual void OnReferenceToDisplayNodeRemoved(vtkMRMLNode* fromNode, const std::string& role);
124
127 virtual void OnRendererAdded(vtkRenderer* renderer);
128
131 virtual void OnRendererRemoved(vtkRenderer* renderer);
132
139
144 virtual void SetDisplayNode(vtkMRMLNode* displayNode);
145
149 virtual void SetPipelineManager(vtkMRMLLayerDMPipelineManager* pipelineManager);
150
153 virtual void SetScene(vtkMRMLScene* scene);
154
158 virtual void SetViewNode(vtkMRMLAbstractViewNode* viewNode);
159
162 virtual void UpdateFromMRML();
163
165 bool BlockUpdateDisplay(bool isBlocked);
166
170 bool BlockInteractionProcessing(bool isBlocked);
173
176 bool BlockUpdateObserver(bool isBlocked) const;
179
186 void SetFrozen(bool isFrozen);
187 bool IsFrozen() const;
189
192
197
200
209 vtkRenderer* GetRenderer() const;
210
213 vtkRenderer* GetRenderer(unsigned int renderOrder) const;
214
216 std::vector<vtkRenderer*> GetRenderers() const;
217
220
223
230 bool UpdateObservation(vtkObject* prevObj, vtkObject* obj, const std::vector<unsigned long>& events) const;
231 bool UpdateObservation(vtkObject* prevObj, vtkObject* obj, unsigned long event = vtkCommand::ModifiedEvent) const;
233
238 void RemoveObservations(vtkObject* prevObj) const;
239
244 void RequestRender() const;
245
250
253 void SetRenderers(const std::vector<vtkRenderer*>& renderers, const std::vector<unsigned int>& renderOrders);
254
261 void SetRenderer(vtkRenderer* renderer);
262
263protected:
265 ~vtkMRMLLayerDMPipeline() override = default;
266
269 virtual void OnUpdate(vtkObject* obj, unsigned long eventId, void* callData);
270
271private:
272 bool RenderersMatchPipelineRenderers(const std::vector<vtkRenderer*>& renderers, const std::vector<unsigned int>& renderOrders);
273
274 vtkWeakPointer<vtkMRMLAbstractViewNode> ViewNode;
275 vtkWeakPointer<vtkMRMLNode> DisplayNode;
276 std::map<unsigned int, vtkWeakPointer<vtkRenderer>> RenderersMap;
277 bool IsUpdateDisplayBlocked;
278 bool Frozen;
279 bool InteractionProcessingBlocked;
280 vtkSmartPointer<vtkMRMLLayerDMObjectEventObserver> Observer;
281 vtkWeakPointer<vtkMRMLLayerDMPipelineManager> PipelineManager;
282 vtkWeakPointer<vtkMRMLScene> Scene;
283};
284
285#endif
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D,...
VTK object observer with one callback endpoint when an event is triggered. Can observe multiple objec...
Class responsible for handling adding / updating / removing pipelines depending on nodes added / remo...
Interface for the layered displayable manager pipelines.
unsigned int GetMaxRenderOrder() const
Maximum render order handled by the DM.
virtual std::vector< unsigned int > GetRenderOrders() const
~vtkMRMLLayerDMPipeline() override=default
virtual vtkCamera * GetCustomCamera(unsigned int renderOrder) const
vtkRenderer * GetRenderer() const
virtual bool CanProcessInteractionEvent(vtkMRMLInteractionEventData *eventData, double &distance2)
virtual void OnRendererRemoved(vtkRenderer *renderer)
virtual bool ProcessInteractionEvent(vtkMRMLInteractionEventData *eventData)
static vtkMRMLLayerDMPipeline * New()
virtual void OnUpdate(vtkObject *obj, unsigned long eventId, void *callData)
bool UpdateObservation(vtkObject *prevObj, vtkObject *obj, unsigned long event=vtkCommand::ModifiedEvent) const
vtkMRMLAbstractViewNode * GetViewNode() const
Returns the current view node.
vtkRenderer * GetRenderer(unsigned int renderOrder) const
vtkMRMLScene * GetScene() const
Returns the current scene.
unsigned int GetVtkRendererOrder(const vtkRenderer *renderer) const
void RemoveObservations(vtkObject *prevObj) const
vtkMRMLLayerDMPipeline * GetNodePipeline(vtkMRMLNode *node) const
bool IsInteractionProcessingBlocked() const
virtual vtkCamera * GetCustomCamera() const
virtual void OnRendererAdded(vtkRenderer *renderer)
vtkMRMLLayerDMPipelineManager * GetPipelineManager() const
Returns the instance of pipeline manager which created the pipeline.
virtual void LoseFocus(vtkMRMLInteractionEventData *eventData)
void RequestRender() const
virtual void SetViewNode(vtkMRMLAbstractViewNode *viewNode)
virtual unsigned int GetRenderOrder() const
bool BlockInteractionProcessing(bool isBlocked)
void SetFrozen(bool isFrozen)
bool UpdateObservation(vtkObject *prevObj, vtkObject *obj, const std::vector< unsigned long > &events) const
std::vector< vtkRenderer * > GetRenderers() const
Returns the current renderers attached to the pipeline in increasing order of GetRenderOrders.
virtual void OnDefaultCameraModified(vtkCamera *camera)
virtual void SetScene(vtkMRMLScene *scene)
virtual void UpdateFromMRML()
vtkMRMLNode * GetDisplayNode() const
Returns the current display node.
virtual int GetWidgetState() const
virtual void OnReferenceToDisplayNodeAdded(vtkMRMLNode *fromNode, const std::string &role)
void SetRenderers(const std::vector< vtkRenderer * > &renderers, const std::vector< unsigned int > &renderOrders)
bool BlockUpdateDisplay(bool isBlocked)
If.
virtual void SetPipelineManager(vtkMRMLLayerDMPipelineManager *pipelineManager)
void SetRenderer(vtkRenderer *renderer)
virtual int GetMouseCursor() const
bool IsUpdateObserverBlocked() const
void PrintSelf(ostream &os, vtkIndent indent) override
virtual void OnReferenceToDisplayNodeRemoved(vtkMRMLNode *fromNode, const std::string &role)
virtual void SetDisplayNode(vtkMRMLNode *displayNode)
bool BlockUpdateObserver(bool isBlocked) const
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.