Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkMRMLSliceIntersectionWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkMRMLSliceIntersectionWidget.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or https://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
24
25#ifndef vtkMRMLSliceIntersectionWidget_h
26#define vtkMRMLSliceIntersectionWidget_h
27
28#include "vtkMRMLDisplayableManagerExport.h" // For export macro
30#include "vtkMRMLSliceLogic.h"
31#include "vtkMRMLSliceNode.h"
32
33#include <vtkCallbackCommand.h>
34#include <vtkCollection.h>
35#include <vtkSmartPointer.h>
36#include <vtkWeakPointer.h>
37
38class vtkSliceIntersectionRepresentation2D;
42
43class VTK_MRML_DISPLAYABLEMANAGER_EXPORT vtkMRMLSliceIntersectionWidget : public vtkMRMLAbstractWidget
44{
45public:
50
52
56 void PrintSelf(ostream& os, vtkIndent indent) override;
58
63
66
68
69 void SetMRMLApplicationLogic(vtkMRMLApplicationLogic* applicationLogic) override;
70
72 bool CanProcessInteractionEvent(vtkMRMLInteractionEventData* eventData, double& distance2) override;
73
76
78 void Leave(vtkMRMLInteractionEventData* eventData) override;
79
81 enum
82 {
83 // Interactions without handles
90
91 // Interactions with slice intersection handles
98
99 // Interactions with intersecting slice thick slab handles
102
104 };
105
107 enum
108 {
109 // Interactions without handles
126 WidgetEventToggleAllSlicesVisibility, // currently does not work, only toggles current slice
132 WidgetEventRotateIntersectingSlicesStart, // rotate all intersecting slices (ctrl-alt-left-click-and-drag)
139 WidgetEventSetCrosshairPositionBackground, //< set crosshair position without consuming the event (so that other widgets can process the event)
141
142 // Interactions with slice intersection handles
143 // WidgetStateOnTranslateIntersectingSlicesHandle/WidgetStateTranslateIntersectingSlicesHandle
146 // WidgetStateOnRotateIntersectingSlicesHandle/WidgetStateRotateIntersectingSlicesHandle
149 // WidgetStateOnTranslateSingleIntersectingSliceHandle/WidgetStateOnTranslateSingleIntersectingSliceHandle
152
153 // Interactions with slice thickslab handles
154 // WidgetStateOnTranslateIntersectingThickSlabHandle/WidgetStateTranslateIntersectingThickSlabHandle
157 };
158
160 enum
161 {
165 ActionRotate = 4, /* not used */
166 ActionBlend = 8, /* fg to bg, labelmap to bg */
171 ActionSetCursorPosition = 1024, /* adjust cursor position in crosshair node as mouse is moved */
172 ActionSetCrosshairPosition = 2048, /* adjust cursor position in crosshair node as mouse is moved */
177 };
178
180 void SetActionsEnabled(int actions);
181
184
189 void SetActionEnabled(int actionsMask, bool enable = true);
192 bool GetActionEnabled(int actionsMask);
193
195
196 // Allows the widget to request a cursor shape
197 int GetMouseCursor() override;
198
199protected:
202
207
212 double GetSliceRotationAngleRad(double eventPos[2]);
213
214 // Pan (move slice in-plane) by click-and-drag
216
218
224
233
235
237
239 bool Rotate(double sliceRotationAngleRad);
240
244 void ScaleZoom(double zoomScaleFactor, vtkMRMLInteractionEventData* eventData);
245
247 void SetLabelOpacity(double opacity);
249
252 bool IsEventInsideVolume(bool background, vtkMRMLInteractionEventData* eventData);
253
255
256 static void SliceModifiedCallback(vtkObject* caller, unsigned long eid, void* clientData, void* callData);
257 static void SliceLogicsModifiedCallback(vtkObject* caller, unsigned long eid, void* clientData, void* callData);
258
259 vtkWeakPointer<vtkCollection> SliceLogics;
260 vtkWeakPointer<vtkMRMLSliceNode> SliceNode;
261 vtkWeakPointer<vtkMRMLSliceLogic> SliceLogic;
262 vtkNew<vtkCallbackCommand> SliceLogicsModifiedCommand;
263 vtkNew<vtkCallbackCommand> SliceModifiedCommand;
264
270
274
278
279 double StartActionFOV[3];
281
282 enum
283 {
287 };
288
289 // Blend
293
294 // Browse slice
302 void MoveSlice(double delta);
303
309 void CycleVolumeLayer(int layer, int direction);
310
313
317
319
329
330 // Last intersecting slice node where interaction occurred
332
333private:
335 void operator=(const vtkMRMLSliceIntersectionWidget&) = delete;
336};
337
338#endif
@ WidgetStateUser
this is a starting index that can be used for widget-specific states
@ WidgetEventUser
this is a starting index that can be used for widget-specific events
MRML node for representing segmentation display attributes.
MRML node to store display properties of slice nodes.
static void SliceLogicsModifiedCallback(vtkObject *caller, unsigned long eid, void *clientData, void *callData)
vtkWeakPointer< vtkMRMLSliceNode > SliceNode
void SetMRMLApplicationLogic(vtkMRMLApplicationLogic *applicationLogic) override
void SetLabelOpacity(double opacity)
Get/Set labelmap or segmentation opacity.
vtkMRMLSliceDisplayNode * GetSliceDisplayNode()
bool ProcessMaximizeView(vtkMRMLInteractionEventData *eventData)
double GetSliceRotationAngleRad(double eventPos[2])
bool ProcessZoomSlice(vtkMRMLInteractionEventData *eventData)
bool ProcessTouchGestureEnd(vtkMRMLInteractionEventData *eventData)
void SetActionEnabled(int actionsMask, bool enable=true)
void PrintSelf(ostream &os, vtkIndent indent) override
void IncrementSlice()
Adjust the slice position with respect to current slice node offset.
bool ProcessRotateIntersectingSlicesHandle(vtkMRMLInteractionEventData *eventData)
static vtkMRMLSliceIntersectionWidget * New()
void CycleVolumeLayer(int layer, int direction)
void Leave(vtkMRMLInteractionEventData *eventData) override
Called when the the widget loses the focus.
bool ProcessTranslateIntersectingSlicesHandle(vtkMRMLInteractionEventData *eventData)
bool ProcessRotateIntersectingSlicesHandleStart(vtkMRMLInteractionEventData *eventData)
bool ProcessTouchRotate(vtkMRMLInteractionEventData *eventData)
bool ProcessWidgetMenu(vtkMRMLInteractionEventData *eventData)
vtkMRMLSegmentationDisplayNode * GetVisibleSegmentationDisplayNode()
bool ProcessTranslateIntersectingThickSlabHandle(vtkMRMLInteractionEventData *eventData)
vtkNew< vtkCallbackCommand > SliceLogicsModifiedCommand
bool ProcessTranslateSingleIntersectingSliceHandleStart(vtkMRMLInteractionEventData *eventData)
static void SliceModifiedCallback(vtkObject *caller, unsigned long eid, void *clientData, void *callData)
vtkMRMLSliceNode * GetSliceNode()
bool ProcessBlend(vtkMRMLInteractionEventData *eventData)
vtkWeakPointer< vtkCollection > SliceLogics
bool ProcessRotateIntersectingSlices(vtkMRMLInteractionEventData *eventData)
void MoveSlice(double delta)
~vtkMRMLSliceIntersectionWidget() override
vtkMRMLSegmentationDisplayNode * StartActionSegmentationDisplayNode
bool GetActionEnabled(int actionsMask)
bool ProcessTouchGestureStart(vtkMRMLInteractionEventData *eventData)
bool ProcessTouchZoom(vtkMRMLInteractionEventData *eventData)
bool IsEventInsideVolume(bool background, vtkMRMLInteractionEventData *eventData)
bool ProcessStartMouseDrag(vtkMRMLInteractionEventData *eventData)
bool ProcessTouchTranslate(vtkMRMLInteractionEventData *eventData)
bool ProcessTranslateIntersectingSlicesHandleStart(vtkMRMLInteractionEventData *eventData)
bool ProcessSetCrosshairBackground(vtkMRMLInteractionEventData *eventData)
int GetActionsEnabled()
Set full list of enabled actions.
bool ProcessEndMouseDrag(vtkMRMLInteractionEventData *eventData)
@ WidgetStateMoveCrosshair
Move crosshair position, can be used for moving the crosshair with click-and-drag.
@ WidgetStateBlend
Fade between foreground/background volumes.
@ WidgetStateTranslateIntersectingSlicesHandle
translating all intersecting slices by drag-and-dropping handle
@ WidgetStateOnTranslateIntersectingThickSlabHandle
hovering over a slice thick slab translation handle
@ WidgetStateTranslateIntersectingThickSlabHandle
adjusting a slice thick slab thickness by drag-and-dropping handle
@ WidgetStateRotateIntersectingSlices
Rotate all intersecting slices (ctrl+alt+left-click-and-drag)
@ WidgetStateTouchGesture
Pinch/zoom/pan using touch gestures.
@ WidgetStateTranslateSlice
Pan (translate in-plane) the current slice (using shift+left-click-and-drag or middle-click-and-drag)
@ WidgetStateOnTranslateSingleIntersectingSliceHandle
hovering over a single-slice translation interaction handle
@ WidgetStateTranslateSingleIntersectingSliceHandle
translating a single slice by drag-and-dropping handle
@ WidgetStateZoomSlice
Zoom slice (using right-button or mouse wheel)
@ WidgetStateRotateIntersectingSlicesHandle
rotating all intersecting slices by drag-and-dropping handle
@ WidgetStateOnRotateIntersectingSlicesHandle
hovering over a rotation interaction handle
@ WidgetStateOnTranslateIntersectingSlicesHandle
hovering over a slice intersection point
bool ProcessRotateIntersectingSlicesStart(vtkMRMLInteractionEventData *eventData)
vtkNew< vtkCallbackCommand > SliceModifiedCommand
bool ProcessTranslateSingleIntersectingSliceHandle(vtkMRMLInteractionEventData *eventData)
bool CanProcessInteractionEvent(vtkMRMLInteractionEventData *eventData, double &distance2) override
Return true if the widget can process the event.
bool ProcessTranslateSlice(vtkMRMLInteractionEventData *eventData)
vtkWeakPointer< vtkMRMLSliceLogic > SliceLogic
bool ProcessMouseMove(vtkMRMLInteractionEventData *eventData)
bool ProcessSetCrosshair(vtkMRMLInteractionEventData *eventData)
void ScaleZoom(double zoomScaleFactor, vtkMRMLInteractionEventData *eventData)
void SetActionsEnabled(int actions)
Set exact list of actions to enable.
bool Rotate(double sliceRotationAngleRad)
Rotate the message by the specified amount. Used for touchpad events.
void SetSliceNode(vtkMRMLSliceNode *sliceNode)
bool ProcessTranslateIntersectingThickSlabHandleStart(vtkMRMLInteractionEventData *eventData)
bool ProcessInteractionEvent(vtkMRMLInteractionEventData *eventData) override
Process interaction event.
MRML node for storing a slice through RAS space.