4 vtkMRMLAbstractViewNode,
6 vtkMRMLInteractionEventData,
7 vtkMRMLLayerDMPipeline,
8 vtkMRMLLayerDMPipelineManager,
9 vtkMRMLLayerDMScriptedPipelineBridge,
13from vtk
import vtkCamera, vtkRenderer, vtkObject
17 """Python base class for all Layer Displayable Manager pipelines."""
24 """Property returning the current view node on which the pipeline is attached."""
29 """Property returning the current display node for which the pipeline was created."""
34 Should return true + distance2 to interaction if the pipeline can process the input event data.
35 :param eventData: The MRML event needing to be processed
36 :return: (bool, distance2) default = False, float_max
40 return False, sys.float_info.max
44 Custom pipeline camera for the input renderOrder.
45 If the returned value is not None, then the pipeline (or dedicated logic) is expected to handle its own camera
46 for the given input render order.
47 Otherwise, the pipeline will be moved in a renderer with a default camera synchronized on its view default camera.
49 :return: None by default
55 Custom mouse cursor from VTK mouse cursor enum.
56 This value is only used if the pipeline actually processes an event and is ignored otherwise.
57 :return: 0 by default.
63 Arbitrary render order number where the pipeline wants to be displayed.
64 Return 0 to be at the default order (main 3D Slicer pipelines)
65 Return larger values to be rendered on top of pipelines with lower render orders.
67 See also: vtkMRMLLayerDMLayerManager
74 Arbitrary render orders number where the pipeline wants to be displayed.
75 Allows the pipeline to be displayed in more than one renderer (for instance in the background / foreground).
76 Return larger values to be rendered on top of pipelines with lower render orders.
78 :return: default = [self.GetRenderOrder()]
84 Current widget state of the pipeline.
85 :return: default = WidgetStateIdle
87 return vtkMRMLAbstractWidget.WidgetStateIdle
89 def LoseFocus(self, eventData: vtkMRMLInteractionEventData |
None) ->
None:
91 Triggered when the pipeline had focus (processed an interaction) and loses the focus (other pipeline
92 handled the new interaction or window leave event).
93 default behavior: does nothing.
94 :param eventData: Optional event data which triggered the lose focus
100 Triggered when the default camera is modified.
101 default behavior: does nothing.
102 :param camera: Instance of the default camera
108 Triggered when a reference to the display node is added
109 default behavior: does nothing.
111 See also: self.GetDisplayNode()
112 :param fromNode: Node which added a reference to the display node
113 :param role: Role of the added reference
119 Triggered when a reference to the display node is removed
120 default behavior: does nothing.
122 See also: self.GetDisplayNode()
123 :param fromNode: Node which removed a reference to the display node
124 :param role: Role of the removed reference
130 Triggered when the pipeline is displayed on a new renderer.
131 default behavior: does nothing.
132 See also: self.GetRenderer()
133 See also: self.UpdateDisplay()
134 See also: self.RequestRender()
136 :param renderer: Optional instance of renderer on which the pipeline is added
142 Triggered when the pipeline is removed from its previous renderer.
143 default behavior: does nothing.
144 See also: self.GetRenderer()
146 :param renderer: Optional instance of renderer from which the pipeline was removed
150 def OnUpdate(self, obj: vtkObject, eventId: int, callData: Any |
None) ->
None:
152 Observer update callback.
153 Triggered when any object & events observed using UpdateObservation is triggered.
155 :param obj: vtkObject instance which triggered the callback
156 :param eventId: Event id which triggered the callback
157 :param callData: Optional observer call data. Use self.CastCallData(callData, vtkType) to convert to Python
163 Triggered when the pipeline can process the interaction and is at the top of the priority list.
164 default behavior: does nothing and returns false.
166 :param eventData: The MRML event needing to be processed
167 :return: True if event was processed. False otherwise (default = false)
173 Called when the display node of the pipeline has changed (initialization).
174 default behavior: Stored and display node is observed for vtkCommand::ModifiedEvent.
175 See also: self.UpdateObservation(prevObj, newObj, eventIds)
176 See also: self.OnUpdate(obj, eventId, callData)
178 :param displayNode: The new instance of display node for the pipeline
184 Set the pipeline manager (initialization).
185 default behavior: Stores the pipeline manager to delegate request render calls (no active observer).
187 See also: self.GetPipelineManager()
188 See also: self.GetNodePipeline(node)
189 :param pipelineManager: The instance of pipeline manager managing the current pipeline
195 Set the pipeline scene (initialization).
196 default behavior: Stores the scene for access (no active observer).
202 Set the pipeline view node (initialization).
203 default behavior: Stored and view node is observed for vtkCommand::ModifiedEvent.
204 :param viewNode: The instance of viewNode the pipeline is attached to
210 Triggered by self.UpdateDisplay() calls
211 Override to update the representation of the pipeline in the different views.
213 See also: self.RequestRender()
214 default behavior: does nothing.
None OnReferenceToDisplayNodeRemoved(self, vtkMRMLNode|None fromNode, str role)
tuple[bool, float] CanProcessInteractionEvent(self, vtkMRMLInteractionEventData eventData)
None OnRendererRemoved(self, vtkRenderer renderer)
bool ProcessInteractionEvent(self, vtkMRMLInteractionEventData eventData)
None OnRendererAdded(self, vtkRenderer|None renderer)
vtkMRMLNode displayNode(self)
vtkMRMLAbstractViewNode viewNode(self)
None LoseFocus(self, vtkMRMLInteractionEventData|None eventData)
None OnDefaultCameraModified(self, vtkCamera camera)
None SetPipelineManager(self, vtkMRMLLayerDMPipelineManager pipelineManager)
None SetDisplayNode(self, vtkMRMLNode displayNode)
None OnReferenceToDisplayNodeAdded(self, vtkMRMLNode|None fromNode, str role)
None OnUpdate(self, vtkObject obj, int eventId, Any|None callData)
None SetScene(self, vtkMRMLScene scene)
None SetViewNode(self, vtkMRMLAbstractViewNode viewNode)
vtkMRMLAbstractViewNode * GetViewNode() const
Returns the current view node.
virtual vtkCamera * GetCustomCamera() const
virtual void SetViewNode(vtkMRMLAbstractViewNode *viewNode)
virtual void SetScene(vtkMRMLScene *scene)
vtkMRMLNode * GetDisplayNode() const
Returns the current display node.
virtual void SetPipelineManager(vtkMRMLLayerDMPipelineManager *pipelineManager)
virtual void SetDisplayNode(vtkMRMLNode *displayNode)
Python bridge for vtkMRMLLayerDMPipeline. Delegates calls to the pipeline to its underlying python ob...
unsigned int GetRenderOrder() const override
int GetWidgetState() const override
void SetPythonObject(PyObject *object)
std::vector< unsigned int > GetRenderOrders() const override
void UpdateFromMRML() override
int GetMouseCursor() const override