Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 */
179 };
180
182 void SetActionsEnabled(int actions);
183
186
191 void SetActionEnabled(int actionsMask, bool enable = true);
194 bool GetActionEnabled(int actionsMask);
195
197
198 // Allows the widget to request a cursor shape
199 int GetMouseCursor() override;
200
201protected:
204
209
214 double GetSliceRotationAngleRad(double eventPos[2]);
215
216 // Pan (move slice in-plane) by click-and-drag
218
220
226
235
237
239
241 bool Rotate(double sliceRotationAngleRad);
242
246 void ScaleZoom(double zoomScaleFactor, vtkMRMLInteractionEventData* eventData);
247
249 void SetLabelOpacity(double opacity);
251
254 bool IsEventInsideVolume(bool background, vtkMRMLInteractionEventData* eventData);
255
257
258 static void SliceModifiedCallback(vtkObject* caller, unsigned long eid, void* clientData, void* callData);
259 static void SliceLogicsModifiedCallback(vtkObject* caller, unsigned long eid, void* clientData, void* callData);
260
261 vtkWeakPointer<vtkCollection> SliceLogics;
262 vtkWeakPointer<vtkMRMLSliceNode> SliceNode;
263 vtkWeakPointer<vtkMRMLSliceLogic> SliceLogic;
264 vtkNew<vtkCallbackCommand> SliceLogicsModifiedCommand;
265 vtkNew<vtkCallbackCommand> SliceModifiedCommand;
266
272
276
280
281 double StartActionFOV[3];
283
284 enum
285 {
289 };
290
291 // Blend
295
296 // Browse slice
304 void MoveSlice(double delta);
305
311 void CycleVolumeLayer(int layer, int direction);
312
315
319
321
331
332 // Last intersecting slice node where interaction occurred
334
335private:
337 void operator=(const vtkMRMLSliceIntersectionWidget&) = delete;
338};
339
340#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.